RAMjET

ramjet.photometric_database.sql_metadata_lightcurve_collection

Code for a lightcurve collection that stores its metadata in the SQL database.

Module Contents

Classes

SqlMetadataLightcurveCollection Class for a lightcurve collection that stores its metadata in the SQL database.
class SqlMetadataLightcurveCollection[source]

Bases: ramjet.photometric_database.lightcurve_collection.LightcurveCollection

Class for a lightcurve collection that stores its metadata in the SQL database.

__init__(self)[source]
Parameters:
  • label – The label corresponding to the lightcurves in the collection.
  • function_to_get_paths – A function which returns an iterable of the lightcurve paths.
  • function_to_load_times_and_fluxes_from_path – A function which, given a lightcurve path, will load the times and fluxes of the lightcurve.
  • function_to_load_times_and_magnifications_from_path – A function which, given a lightcurve path, will load the times and magnifications of the lightcurve.
get_sql_query(self)[source]

Gets the SQL query for the database models for the lightcurve collection.

Returns:The SQL query.
sql_count(self)[source]

Gets the count of the rows returned by the SQL query.

Returns:The count.
get_path_from_model(self, model: MetadatabaseModel)[source]

Gets the lightcurve path from the SQL database model.

Returns:The path to the lightcurve.
get_paths(self)[source]

Gets the paths for the lightcurves in the collection.

Returns:An iterable of the lightcurve paths.
static order_by_uuid_with_random_start(select_query: Select, uuid_field: Field)[source]

Applies an “order by” on a query using a passed UUID field. The “order by” starts at a random UUID and then loops back to the minimum UUID include all entities.

Parameters:
  • select_query – The query to add the “order by” to.
  • uuid_field – The UUID field to order on.
Returns:

The query updated to include the “order by”.

static order_by_dataset_split_with_random_start(select_query: Select, dataset_split_field: Field, available_dataset_splits: Union[List[int], None])[source]

Applies an “order by” on a query using a passed dataset_split field. The “order by” starts at a random dataset_split out of the passed available options, then loops back to the minimum dataset_split to include all entities.

Parameters:
  • select_query – The query to add the “order by” to.
  • dataset_split_field – The dataset_split field to order on.
  • available_dataset_splits – The available dataset_splits to start on.
Returns:

The query updated to include the “order by”.