survey.basesurvey#
This module defines the generic Survey and GridSurvey classes, combining healpix and polygon survey capabilities with a camera footprint.
- class skysurvey.survey.basesurvey._FootPrintHandler_[source]#
Bases:
objectMixin class handling footprint geometries for survey objects.
- Parameters:
_FOOTPRINT (shapely.geometry.base.BaseGeometry or None) – Default camera footprint geometry used if no footprint is provided during initialization. Usually a Polygon or MultiPolygon.
- _FOOTPRINT = None#
- show_footprint(ax=None, add_text=False, **kwargs)[source]#
Shows the survey footprint.
- Parameters:
ax (matplotlib.axes) – axes to plot the footprint on.
add_text (bool) – if True, adds text to the plot.
facecolor (**kwargs goes to matplotlib (e.g.)
edgecolor)
- Return type:
matplotlib.figure
- get_skyarea(as_multipolygon=True)[source]#
Multipolygon (or list) of field geometries.
- Parameters:
as_multipolygon (bool) – if True, returns a multipolygon. Otherwise, returns a list of polygons.
- Return type:
shapely.geometry.MultiPolygon or list
- property footprint#
Camera footprint (geometry).
- class skysurvey.survey.basesurvey.Survey(footprint=None, nside=200, data=None)[source]#
Bases:
HealpixSurvey,_FootPrintHandler_The Survey class.
- Parameters:
footprint (shapely.geometry) – footprint in the sky of the observing camera
nside (int) – healpix nside parameter
data (pandas.DataFrame) – observing data.
- classmethod from_data(data, footprint=None, nside=200)[source]#
Load an instance given survey data and healpix size (nside) .
- Parameters:
data (pandas.DataFrame) – observing data.
footprint (shapely.geometry) – footprint in the sky of the observing camera
nside (int) – healpix nside parameter
- Return type:
instance
See also
from_randomgenerate random observing data and loads the instance.
- classmethod from_pointings(data, footprint=None, rakey='ra', deckey='dec', nside=200, backend='polars', use_pyarrow_extension_array=True, **kwargs)[source]#
Loads an instance given observing poitings of a survey.
This loads an
polygon.PolygonSurveyusingfrom_pointingand converts that into an healpix using theto_healpix()method.- Parameters:
data (pandas.DataFrame or dict) – observing data, must contain the rakey and deckey columns.
footprint (shapely.geometry) – footprint in the sky of the observing camera
rakey (str) – name of the R.A. column (in deg)
deckey (str) – name of the Declination column (in deg)
nside (int) – healpix nside parameter
backend (str) – which backend to use to merge the data (speed issue): - polars (fastest): requires polars installed -> converted to pandas at the end - pandas (classic): the normal way - dask (lazy): as persisted dask.dataframe is returned
use_pyarrow_extension_array (bool) – = ignored in backend != ‘polars’ or polars_to_pandas is not True = should the pandas dataframe be based on numpy array (slow to load but faster then) or based on pyarrow array (like in polars) ; faster but numpy.asarray will be used by pandas when need (which will then slow things down).
polygon.PolygonSurvey.from_pointings (**kwargs goes to)
- Return type:
instance
- class skysurvey.survey.basesurvey.GridSurvey(data=None, fields=None, footprint=None, **kwargs)[source]#
Bases:
PolygonSurvey,_FootPrintHandler_The GridSurvey class.
- Parameters:
data (pandas.DataFrame) – observing data.
fields (geodataframe) – field definitions.
footprint (shapely.geometry) – footprint in the sky of the observing camera.
- classmethod from_pointings(data, fields_or_coords=None, footprint=None, **kwargs)[source]#
Loads an instance given observing poitings of a survey.
- Parameters:
data (pandas.DataFrame or dict) – observing data, must contain the rakey and deckey columns.
fields_or_coords (geodataframe or dict) – field definitions or coordinates.
footprint (shapely.geometry) – footprint in the sky of the observing camera
super().__init__ (**kwargs goes to)
- Return type:
- classmethod _parse_fields(fields_or_coords, footprint=None)[source]#
Parse the fields from coordinates.
- Parameters:
fields_or_coords (geodataframe or dict) – field definitions or coordinates.
footprint (shapely.geometry) – footprint in the sky of the observing camera
- Return type:
geopandas.GeoDataFrame
- property fields#
Geodataframe containing the fields coordinates.