panoptes.data package#

Submodules#

panoptes.data.observations module#

class panoptes.data.observations.ObservationInfo(sequence_id=None, meta=None, image_query='')[source]#

Bases: object

A container class for information about an Observation.

download_images(image_list=None, output_dir=None, show_progress=True, warn_on_error=True)[source]#

Download the images to the output directory (by default named after the sequence_id).

Parameters:
  • image_list – A list of images to download.

  • output_dir – The directory to download the images to.

  • show_progress – Whether to show a progress bar.

  • warn_on_error – If True (default) issue a warning if an image fails to download, otherwise raise an exception.

get_image_cutout(data=None, coords=None, box_size=None, *args, **kwargs)[source]#

Gets a Cutout2D object for the given coords and box_size.

get_image_data(idx=0, use_raw=True)[source]#

Downloads the image data for the given index.

get_image_list(bucket: str | None = None, file_ext: str = '.fits.fz')[source]#

Get the images for the observation.

Parameters:
  • bucket – The bucket where the images are stored.

  • file_ext – The file extension of the images to retrieve.

Returns:

A pandas DataFrame containing the images for the observation.

get_metadata(query='')[source]#

Download the image metadata associated with the observation.

panoptes.data.search module#

panoptes.data.search.get_all_observations(settings: CloudSettings = None) DataFrame[source]#

Get all the observations.

Parameters:

settings (CloudSettings, optional) – The settings to use for the observations. Defaults to None.

Returns:

A DataFrame of all the observations.

Return type:

pd.DataFrame

panoptes.data.search.get_metadata(observations: DataFrame) DataFrame[source]#

Get the metadata for a set of observations.

Parameters:

observations (pd.DataFrame) – A DataFrame of observations.

Returns:

A DataFrame of metadata for the observations.

Return type:

pd.DataFrame

panoptes.data.search.search_observations(by_name=None, coords=None, unit_id=None, start_date=None, end_date=None, ra=None, dec=None, radius=10, status=None, min_num_images=1, source=None, ra_col='coordinates.mount_ra', dec_col='coordinates.mount_dec') DataFrame[source]#

Search PANOPTES observations.

Either a coords or ra and dec must be specified for search to work.

>>> from astropy.coordinates import SkyCoord
>>> from panoptes.data.search import search_observations
>>> coords = SkyCoord.from_name('Andromeda Galaxy')
>>> start_date = '2019-01-01'
>>> end_date = '2019-12-31'
>>> search_results = search_observations(coords=coords, min_num_images=10, start_date=start_date, end_date=end_date)
>>> # The result is a DataFrame you can further work with.
>>> image_count = search_results.groupby(['unit_id', 'field_name']).num_images.sum()
>>> image_count
unit_id  field_name
PAN001   Andromeda Galaxy     378
         HAT-P-19             148
         TESS_SEC17_CAM02    9949
PAN012   Andromeda Galaxy      70
         HAT-P-16 b           268
         TESS_SEC17_CAM02    1983
PAN018   TESS_SEC17_CAM02     244
Name: num_images, dtype: Int64
>>> print('Total minutes exposure:', search_results.total_minutes_exptime.sum())
Total minutes exposure: 20376.83
Parameters:
  • by_name (str|None) – If present, this will use the SkyCoords.from_name method to do a search for the appropriate coords.

  • coords (`astropy.coordinates.SkyCoord`|None) – A valid coordinate instance.

  • ra (float|None) – The RA position in degrees of the center of search.

  • dec (float|None) – The Dec position in degrees of the center of the search.

  • radius (float) – The search radius in degrees. Searches are currently done in a square box, so this is half the length of the side of the box.

  • start_date (str|`datetime.datetime`|None) – A valid datetime instance or None (default). If None then the beginning of the current year is used as a start date.

  • end_date (str|`datetime.datetime`|None) – A valid datetime instance or None (default). If None then today is used.

  • unit_id (str|list|None) – A str or list of strs of unit_ids to include. Default None will include all.

  • status (str|list|None) – A str or list of observation status to include. Defaults to “matched” for observations that have been fully processed. Passing None will return all status.

  • min_num_images (int) – Minimum number of images the observation should have, default 1.

  • source (`pandas.DataFrame`|None) – The dataframe to use or the search. If None (default) then the source_url will be used to look up the file.

  • ra_col (str) – The column in the source table to use for the RA, default ‘coordinates.mount_ra’.

  • dec_col (str) – The column in the source table to use for the Dec, default ‘coordinates.mount_dec’.

Returns:

A table with the matching observation results.

Return type:

pandas.DataFrame

panoptes.data.settings module#

class panoptes.data.settings.CloudSettings(*args: Any, **kwargs: Any)[source]#

Bases: BaseSettings

img_base_url: pydantic.networks.AnyHttpUrl = 'https://storage.googleapis.com'#
img_bucket: str = 'panoptes-images-incoming'#
img_metadata_url: pydantic.networks.AnyHttpUrl = 'https://us-central1-project-panoptes-01.cloudfunctions.net/get-observation-info'#
observations_url: pydantic.networks.AnyHttpUrl = 'https://storage.googleapis.com/panoptes-assets/observations.csv'#
class panoptes.data.settings.ImageStatus(*values)[source]#

Bases: IntEnum

The status of an image.

CALIBRATED = 9#
CALIBRATING = 8#
ERROR = 1#
EXTRACTED = 15#
EXTRACTING = 14#
MASKED = 2#
MATCHED = 13#
MATCHING = 12#
PROCESSING = 7#
RECEIVED = 5#
RECEIVING = 4#
SOLVED = 11#
SOLVING = 10#
UNKNOWN = 3#
UNSOLVED = 6#
class panoptes.data.settings.ObservationStatus(*values)[source]#

Bases: IntEnum

The status of an observation.

CALIBRATED = 9#
CALIBRATING = 8#
CREATED = 4#
ERROR = 1#
MATCHED = 11#
MATCHING = 10#
NOT_ENOUGH_FRAMES = 2#
PROCESSING = 7#
RECEIVED = 6#
RECEIVING = 5#
UNKNOWN = 3#

Module contents#