sorcha.activity
Submodules
Attributes
Classes
Abstract base class for cometary activity models |
|
!!! THIS SHOULD NEVER BE USED - FOR TESTING ONLY !!! |
Functions
|
This method will identify all of the subclasses of |
|
This function is used to register newly created subclasses of the |
Package Contents
- class AbstractCometaryActivity(required_column_names: List[str] = [])[source]
Bases:
abc.ABCAbstract 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
observationsdataframe provided bySorcha.
- _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
observationsdataframe provided bySorcha.
- _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
- 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
observationdataframe. 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
observationsdataframe provided bySorcha.- Returns:
The original
observationsdataframe, 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
AbstractCometaryActivityand build a dictionary that mapsname : subclass.- Returns:
A dictionary of all of subclasses of
AbstractCometaryActivity. Where the string returned fromsubclass.name_id()is the key, and the subclass is the value.- Return type:
dict
- Raises:
ValueError -- If a duplicate key is found, a
ValueErroris raised. This would likely occur if a user copy/pasted an existing subclass but failed to update the string returned fromname_id().