bioverse.classes module
Contains class definitions.
- class bioverse.classes.Object(label=None)
Bases:
object
This class allows the Generator and Survey classes to be saved as .pkl files under the Objects/ directory.
- Parameters:
label (str, optional) – Name of the Generator or Survey. Default is to create a new object.
- save(label=None)
Saves the Object as a template in a .pkl file under ./<object type>s/.
- get_filename_from_label(label)
- class bioverse.classes.Table(*args, **kwargs)
Bases:
dict
Class for storing numpy arrays in a table-like format. Inherits dict. Each key is treated as a separate table column.
- split_key(key)
Splits a key such as ‘Planets:Atmosphere:O2’ into (‘Planets’,’Atmosphere:O2’) and ensures that the first key refers to a dict-like object.
- keys()
Returns an array of keys instead of a dict_keys object, because I prefer it this way.
- sort_by(key, inplace=False, ascending=True)
Sorts the table by the values in one column.
- Parameters:
key (str) – Name of the column by which to sort the table.
inplace (bool, optional) – If True, sort the table in-place. Otherwise return a new sorted Table.
ascending (bool, optional) – If True, sort from least to greatest.
- Returns:
sortd – A sorted copy of this table. Only returned if inplace is True.
- Return type:
- get_stars()
Returns just the first entry for each star in the Table.
- legend(keys=None, filename='/home/docs/checkouts/readthedocs.org/user_builds/bioverse/envs/stable/lib/python3.7/site-packages/bioverse-1.1.0-py3.7.egg/bioverse/Data/legend.dat')
Prints the description of parameter(s) in the Table.
- Parameters:
keys (str or str array, optional) – Key or list of keys to describe. If not specified, every key is described.
filename (str, optional) – CSV file containing the list of parameter descriptions. Default is ./legend.dat.
- copy()
Returns a deep copy of the Table instead of a shallow copy (as in dict.copy). This way, if a column is filled by objects (such as Atmosphere objects), a copy of those is returned instead of a reference.
- append(table, inplace=True)
Appends another table onto this table in-place. The second table must have the same columns, unless this table is empty, in which case the columns are copied over.
- Parameters:
table (Table) – Table to be appended onto this one.
inplace (bool, optional) – If True, append inplace and return None. If False, return a new Table.
- compute(key, force=False)
Computes the value of key using other values in the dictionary and a pre-defined formula. Useful for translating measured values (e.g. ‘a’, ‘L_st’) into secondary data products (e.g., ‘S’). Will also propagate uncertainties contained in self.error.
- shuffle(inplace=True)
Re-orders rows in the Table. If inplace is False, return a new re-ordered Table instead.
- pdshow()
If pandas is installed, show the Table represented as a DataFrame. Otherwise return an error.
- to_pandas()
export Table into a pandas DataFrame
- observed(key)
Returns the subset of rows for which self[key] is not nan.
- class bioverse.classes.Stopwatch
Bases:
object
This class uses the time module to profile chunks of code. Use the start() and stop() methods to start and stop the Stopwatch, and the mark() methods to record a time. stop() and read() will report the total time elapsed as well as the time between each step.
- clear()
- mark(flag=None)
- stop(flag=None)
- read()