sorcha.lightcurves

Submodules

Attributes

LC_METHODS

Classes

AbstractLightCurve

Abstract base class for lightcurve models

IdentityLightCurve

!!! THIS SHOULD NEVER BE USED - FOR TESTING ONLY !!!

Functions

register_lc_subclasses(→ Dict[str, Callable])

This method will identify all of the subclasses of AbstractLightCurve

update_lc_subclasses(→ None)

This function is used to register newly created subclasses of the

Package Contents

class AbstractLightCurve(required_column_names: List[str] = [])[source]

Bases: abc.ABC

Abstract base class for lightcurve models

required_column_names = []
abstractmethod compute(df: pandas.DataFrame) numpy.array[source]

User implemented calculation based on the input provided by the pandas dataframe df.

Parameters:

df (Pandas dataframe) -- The observations dataframe provided by Sorcha.

_validate_column_names(df: pandas.DataFrame) None[source]
Private method that checks that the provided pandas dataframe contains

the required columns defined in self.required_column_names.

Parameters:

df (Pandas dataframe) -- The observations dataframe provided by Sorcha.

_log_exception(exception: Exception) None[source]

Log an error message from an exception to the error log file

Parameters:

exception (Exception) -- The exception with a string to appended to the error log

_log_error_message(error_msg: str) None[source]

Log a specific error string to the error log file

Parameters:

error_msg (string) -- The string to be appended to the error log

static name_id() str[source]
Abstractmethod:

This method will return the unique name of the LightCurve Model

class IdentityLightCurve(required_column_names: List[str] = ['fieldMJD_TAI'])[source]

Bases: sorcha.lightcurves.base_lightcurve.AbstractLightCurve

!!! THIS SHOULD NEVER BE USED - FOR TESTING ONLY !!!

Rudimentary lightcurve model that returns no shift. This class is explicitly created for testing purposes.

compute(df: pandas.DataFrame) numpy.array[source]

Returns numpy array of 0's with shape equal to the input dataframe time column.

Parameters:

df (Pandas dataframe) -- The observations dataframe provided by Sorcha.

Returns:

Numpy array of 0's with shape equal to the input dataframe time column.

Return type:

np.array

static name_id() str[source]

Returns the string identifier for this light curve method. It must be unique within all the subclasses of AbstractLightCurve.

We have chosen the name "identity" here because the input brightness will equal the output brightness if this model is applied.

Returns:

Unique identifier for this light curve calculator

Return type:

string

register_lc_subclasses() Dict[str, Callable][source]

This method will identify all of the subclasses of AbstractLightCurve and build a dictionary that maps name : subclass.

Returns:

A dictionary of all of subclasses of AbstractLightCurve. Where the string returned from subclass.name_id() is the key, and the subclass is the value.

Return type:

dict

Raises:

ValueError -- If a duplicate key is found, a ValueError is raised. This would likely occur if a user copy/pasted an existing subclass but failed to update the string returned from name_id().

update_lc_subclasses() None[source]

This function is used to register newly created subclasses of the AbstractLightCurve.

LC_METHODS[source]