sorcha.activity

Submodules

Attributes

CA_METHODS

Classes

AbstractCometaryActivity

Abstract base class for cometary activity models

IdentityCometaryActivity

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

Functions

register_activity_subclasses(→ Dict[str, Callable])

This method will identify all of the subclasses of AbstractCometaryActivity

update_activity_subclasses(→ None)

This function is used to register newly created subclasses of the

Package Contents

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

Bases: abc.ABC

Abstract base class for cometary activity 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 value 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 (str) -- 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 IdentityCometaryActivity[source]

Bases: sorcha.activity.base_activity.AbstractCometaryActivity

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

Rudimentary cometary activity model that returns no change to the input observation dataframe. This class is explicitly created for testing purposes.

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

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

Parameters:

df (pd.DataFrame) -- The observations dataframe provided by Sorcha.

Returns:

The original observations dataframe, unchanged.

Return type:

pd.DataFrame

static name_id() str[source]

Returns the string identifier for this cometary activity method. It must be unique within all the subclasses of AbstractCometaryActivity.

We have chosen the name "identity" here because the input dataframe is returned unchanged.

Returns:

Unique identifier for this cometary activity model

Return type:

str

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

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

Returns:

A dictionary of all of subclasses of AbstractCometaryActivity. 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_activity_subclasses() None[source]

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

CA_METHODS[source]