data¶
Module handling data (experiment and simulation).
Data
¶
Data(
index,
symbol=None,
task=None,
dataset=None,
function=None,
variables=None,
parameters=None,
sid=None,
)
Data.
Main data generator class which uses data either from experimental data, simulations or via function calculations.
All transformation of data and a tree of data operations. This is just a promise for data which will be fullfilled with data from tasks.
Construct data.
selection
property
¶
Get selection string.
Depending on symbol, different selections have to be performed.
Types
¶
Bases: Enum
Data types.
Symbols
¶
Bases: Enum
Symbols.
get_data
¶
Return actual data from the data object.
The data is resolved from the available datasets and the injected Experiment.
:param to_units: units to convert to :return:
DataSeries
¶
Bases: Series
DataSet - a pd.Series with additional unit information.
DataSet
¶
Bases: DataFrame
DataSet, a pd.DataFrame with additional unit information.
get_quantity
¶
Return quantity for given key.
Requires using the numpy data instead of the series.
from_df
classmethod
¶
Create DataSet from given pandas.DataFrame.
The DataFrame can have various formats which should be handled. Standard formats are 1. units annotations based on '_unit' columns, with additional '_sd' or '*_se' units 2. units annotations based on 'unit' column which is applied on 'mean', 'value', 'sd' and 'se' columns
:param df: pandas.DataFrame :param uinfo: optional units information
:return: dataset
unit_conversion
¶
Convert the units of the given key in the dataset via key * factor.
Changes values in place in the DataSet.
The quantity in the dataset is multiplied with the conversion factor. In addition to the key, also the respective error measures are converted with the same factor, i.e. - {key} - {key}_sd - {key}_se - {key}_min - {key}_max
FIXME: in addition base keys should be updated in the table, i.e. if key in [mean, median, min, max, sd, se, cv] then the other keys should be updated; use default set of keys for automatic conversion
:param key: column key in dataset (this column is unit converted) :param factor: multiplicative Quantity factor for conversion :return: None
load_pkdb_dataframe
¶
Load TSV data from PKDB figure or table id.
This is a simple helper functions to directly loading the TSV data.
It is recommended to use pkdb_analysis methods instead.
This function will be removed.
E.g. for 'Amchin1999_Tab1' the file data_path / 'Amchin1999' / '.Amchin1999.tsv' is loaded.
:param sid: figure or table id :param data_path: base path of data or iterable of data_paths :param sep: separator :param comment: comment characters :param kwargs: additional kwargs for csv parsing :return: pandas DataFrame
load_pkdb_dataframes_by_substance
¶
Load dataframes from given PKDB figure/table id split on substance.
The DataFrame is split on the 'substance' key.
This is a simple helper functions to directly loading the TSV data.
It is recommended to use pkdb_analysis methods instead.
This function will be removed.
:param sid: :param data_path: :param kwargs: :return: dict[substance, pd.DataFrame]