kromatography.model package

Submodules

kromatography.model.api module

kromatography.model.base_parameter_scan_description module

Describe how a simulation parameter is/should be scanned.

class kromatography.model.base_parameter_scan_description.BaseParameterScanDescription(**traits)[source]

Bases: traits.has_traits.HasStrictTraits

Description of how a simulation parameter should be scanned.

Warning: this is a base class. Use one of the subclasses instead. See ParameterScanDescription or RandomParameterScanDescription.

Parameters:name (str) – That should be an attribute path of the parameter to scan. Should be able to be appended to ‘simulation.’ and lead to an eval-able string. For example: ‘binding_model.sma_ka[1]’.
valid_parameter_names = List(Str)

List of valid parameter names

target_simulation = Instance(Simulation)

Simulation whose parameter will be scanned (OPTIONAL)

center_value = Property(depends_on='target_simulation, name')

Value of the parameter in the target simulation if available

name = Enum(Str, values='valid_parameter_names')

Name/path of the simulation attribute to scan

kromatography.model.base_product_model module

class kromatography.model.base_product_model.BaseProductModel(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Base class for binding and transport models, describing the behavior of a Product’s components.

target_product = Str

Name of the product this object describes the binding of

component_names = List(Str)

Component names. Useful for building a view for the model. Auto-generated if not provided.

num_prod_comp = Property(Int, depends_on='num_comp')

Number of product components described

num_comp = Int

Total number of components, including cation.

kromatography.model.base_product_model.validate_inputs(num_comp, num_prod_comp, traits)[source]

Validate that the arguments to create a product model are valid.

kromatography.model.base_study module

class kromatography.model.base_study.BaseStudy(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Study base class for both a modelling study or an experimental study.

A study in general analyses a product and can contains simulations and experiments, as well as a datasource, that is a bank of standard chromatography components.

datasource = Instance(DataSource)

Cross study datasource to assist in the experiment loading and parameter validation

product = Any

Production studied

experiments = List(Instance(Experiment))

Experiments

product_set = Property(Bool)

Is there a valid product set

add_experiments(experiment_list)[source]

Add multiple experiments to the study, checking that the target product is the same as the study and that they have different names.

Parameters:experiment_list (iterable) – List (or other iterable) of experiments to add to the study.
search_experiment_by_name(name)[source]

Search and return experiment with a specific name.

kromatography.model.binding_model module

class kromatography.model.binding_model.BindingModel(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.base_product_model.BaseProductModel

Base class for all binding models.

model_type = Enum(values='all_model_types')

The type of binding model (e.g. STERIC_MASS_ACTION) used for the chromatography simulation.

is_kinetic = Enum([0, 1])

Kinetic rate expression or isotherm

type_id = Constant(BINDING_MODEL_TYPE)

The type of data being represented by this class

class kromatography.model.binding_model.StericMassAction(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.binding_model.BindingModel

Steric Mass Action (SMA) Binding Model.

sma_ka = ParameterArray

A vector with adsorption rate constants in the steric mass action model

sma_kd = ParameterArray

A vector with desorption rate constants in the steric mass action model

sma_lambda = PositiveFloatParameter(0.0)

Stationary phase capacity (monovalent salt counterions); The total number of binding sites available on the resin surface

sma_nu = ParameterArray

A vector with characteristic charges of the protein; The number of sites nu that the protein interacts with on the resin surface

sma_sigma = ParameterArray

A vector with steric factors of the protein; The number of sites sigma on the surface that are shielded by the protein and prevented from exchange with the salt counteri- ons in solution

model_type = Constant(STERIC_BINDING_MODEL)

The type of binding model.

class kromatography.model.binding_model.PhDependentStericMassAction(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.binding_model.StericMassAction

pH dependent steric Mass Action (SMA) Binding Model.

Note that this class inherits the parameters sma_ka, sma_nu, sma_sigma, but these values in this model don’t represent the center value anymore but the constant term in the pH dependence. if nominal pH is 5 during the experiment, the effective ka will be:

ka = exp(sma_ka + sma_ka_ph * pH + sma_ka_ph2 * pH**2)

Similarly for the other parameters:

kd = exp(sma_kd + sma_kd_ph * pH + sma_kd_ph2 * pH**2)

sigma = sma_sigma + sma_sigma_ph * pH + sma_sigma_ph2 * pH**2

nu = sma_nu + sma_nu_ph * pH + sma_nu_ph2 * pH**2
sma_ka_ph = ParameterArray

A vector with pH linear dependence of adsorption rate constants

sma_ka_ph2 = ParameterArray

Vector with pH quadratic dependence of adsorption rate constants

sma_kd_ph = ParameterArray

Vector with pH linear dependence of desorption rate constants

sma_kd_ph2 = ParameterArray

Vector with pH quadratic dependence of desorption rate constants

sma_nu_ph = ParameterArray

Vector with pH linear dependence of characteristic charges of protein

sma_nu_ph2 = ParameterArray

Vector with pH quadratic dependence of characteristic charges of protein

sma_sigma_ph = ParameterArray

Vector with pH linear dependence of steric factors of the protein

sma_sigma_ph2 = ParameterArray

Vector with pH linear dependence of steric factors of the protein

model_type = Constant(PH_STERIC_BINDING_MODEL)

The type of binding model.

class kromatography.model.binding_model.Langmuir(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.binding_model.BindingModel

Multi-Component Langmuir Binding Model.

mcl_ka = ParameterArray

Adsorption rate constant coefficients in the MCL Langmuir model

mcl_kd = ParameterArray

Desorption rate denominator coefficients in the MCL Langmuir model

mcl_qmax = ParameterArray

Maximum adsorption capacity coefficients in the MCL Langmuir model

model_type = Constant(LANGMUIR_BINDING_MODEL)

The type of binding model.

class kromatography.model.binding_model.ExternalLangmuir(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.binding_model.Langmuir

Langmuir Binding Model w/ parameters depending on an external profile.

extl_ka_t = ParameterArray

All vectors with adsorption rate constant coefficients in the External Function Langmuir model

extl_kd_t = ParameterArray

All vectors with desorption rate constant coefficients in the External Function Langmuir model

extl_qmax_t = ParameterArray

All vectors with maximum adsorption capacity coefficients in the External Function Langmuir model

model_type = Constant(PH_LANGMUIR_BINDING_MODEL)

The type of binding model.

kromatography.model.buffer module

class kromatography.model.buffer.Buffer(**traits)[source]

Bases: kromatography.model.solution.Solution

A Solution with a name but not containing Product

type_id = Constant(BUFFER_TYPE)

The type of data being represented by this class

kromatography.model.buffer_prep module

class kromatography.model.buffer_prep.BufferPrep(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Class to create a Buffer instance via chemicals where chemical components and their concentrations will be computed from mass and volume information.

FIXME: unit conversions hard-coded: replace with dynamic unit management.

description = Str

User description of the buffer to be created

source = Str()

The source of the buffer prep

lot_id = Str()

lot id of buffer prep

chemicals = List(Chemical)

FIXME we can potentially ignore this, it is a string in the excel file we currently haven’t needed to read in yet, so not used The chemicals contained by the buffer prep

chemical_amounts = List(UnitScalar)

The amounts (g or mL, depending on state) of each chemical

chemical_stock_concentrations = Instance(UnitArray)

The stock concentrations (M i.e. mol/L) of each chemical

volume = Parameter()

The volume (mL) of the buffer prep

density = Parameter()

the density of the buffer prep

conductivity = Instance(UnitScalar)

the conductivity of the buffer prep

pH = Parameter()

the pH of the buffer prep

temperature = Instance(UnitScalar)

the temperature of the buffer prep

chemical_concentrations = Property(Instance(UnitArray), depends_on=['chemicals', 'chemical_amounts', 'volume', 'chemical_stock_concentrations'])

The concentrations (M) of each chemical in the buffer prep.

chemical_components = Property(List(Component), depends_on=['chemicals'])

The list of chemicals in the buffer prep.

chemical_component_concentrations = Property(Instance(UnitArray), depends_on=['chemical_components', 'chemicals', 'chemical_concentrations'])

The concentrations (M) of each chemical component in the buffer prep.

type_id = Constant(BUFFER_PREP_TYPE)

The type of data being represented by this class

build_buffer()[source]

Builds a Buffer object from the BufferPrep information.

kromatography.model.cadet_input module

CADET input class that gets automatically translated into HDF5 input file.

Consequently, the class names, attribute names and units that contained in this class and its children are set by the specs of the version of CADET using the generated input file.

class kromatography.model.cadet_input.CADETInput[source]

Bases: traits.has_traits.HasStrictTraits

The class that models the CADET input h5 group (i.e. /input). The attributes of the class are H5 nodes under the input group.

chromatography_type = Str(GRM_TRANSPORT_MODEL)

The type of the chromatography model used in simulation.

discretization = Instance(Discretization, ())

The instance containing discretization parameters.

model = Instance(CADETModel)

The instance containing CADET model parameters.

sensitivity = Instance(Sensitivity, args=())

The instance containing sensitivity parameters.

solver = Instance(Solver, args=())

The instance containing solver parameters.

kromatography.model.cadet_model module

Largest component insit the CADET input class that gets translated into the HDF5 input file.

Consequently, the class names, attribute names and units that contained in this class and its children are set by the specs of the version of CADET using the generated input file.

class kromatography.model.cadet_model.CADETModel(num_components, num_sections, **traits)[source]

Bases: traits.has_traits.HasStrictTraits

The CADET model parameters to be stored in the HDF5 input file.

Notes

Keep in mind:

  • This class is primarily used for creating the input parameters to the CADET simulator.
  • The attributes here correspond to the H5 nodes under /input/model.
  • The units have to be in SI units. For more details, see the CADET documentation.
adsorption_type = Enum(ALL_CADET_TYPES.values())

Specifies the type of binding model

col_dispersion = PositiveFloat(6e-08)

Axial dispersion coefficient(m2/s) [Range: >=0]

col_length = PositiveFloat(0.2, exclude_low=True)

Column length (m) (default: 0.20) [Range: > 0]

col_porosity = PositiveFloat(0.35)

Column porosity [Range: > 0]

film_diffusion = Array(dtype=float, shape=(None,))

A vector with film diffusion coefficients (m/2) [len(ncomp)] (Default:N/A) [Range: >=0]

init_c = Array(dtype=float, shape=(None,))

A vector with initial concentrations for each comp. in the bulk mobile phase (mmol/m3)[len(ncomp)] (Default:N/A) [Range: >=0]

init_cp = Array(dtype=float, shape=(None,))

Same as INIT_C but for the bead liquid phase (optional, INIT_C is used if left out). (mmol/m3) [len(ncomp)] (Default:N/A) [Range: >=0]

init_q = Array(dtype=float, shape=(None,))

Same as INIT_C but for the bound phase (mmol/m3) [len(ncomp)] (Default:N/A) [Range: >=0]

par_diffusion = Array(dtype=float, shape=(None,))

A vector with particle di usion coefficients (m2/s) [len(ncomp)] (Default: NA) [Range: >=0]

par_surfdiffusion = Array(dtype=float, shape=(None,))

A vector with particle surface diffusion cofficients (m2/s) [len(ncomp)] (Default: NA) [Range: >=0]

par_porosity = PositiveFloat(0.5, exclude_low=True)

Particle porosity (Default: 0.5) [Range: > 0]

par_radius = PositiveFloat(4.5e-05, exclude_low=True)

Particle Radius (Default: 4.5e-5) [Range: > 0]

velocity = Array(dtype=float, shape=(None,))

A vector of Interstitial velocity of the mobile phase (m/2) [len(nsec)] (Default: NA) [Range: >=0]

adsorption = Instance(BindingModel)

Binding Model

inlet = Instance(Inlet)

Inlet

external = Instance(CADETPhExternalProfile)

External pH dependence profile

ncomp = PositiveInt(exclude_low=True)

Number of chemical components in the chromatographic media [Range: > 0]

kromatography.model.cadet_ph_external_profile module

Largest component insit the CADET input class that gets translated into the HDF5 input file.

Consequently, the class names, attribute names and units that contained in this class and its children are set by the specs of the version of CADET using the generated input file.

class kromatography.model.cadet_ph_external_profile.CADETPhExternalProfile[source]

Bases: traits.has_traits.HasStrictTraits

The CADET external folder/object to contain the pH profile for pH-dependent binding models.

ext_profile = Array(dtype=float, shape=(None,))

A vector with the pH values at various points in time (time set by ext_prof_delta). (Default:N/A) [Range: >=0]

ext_prof_delta = Array(dtype=float, shape=(None,))

A vector with the time deltas at which the pH changes. Unit: seconds. (Default:N/A) [Range: >=0]

ext_velocity = PositiveFloat(0.0, exclude_low=True)

The superficial flow velocity of the above profiles. Unit: meter/second. (Default:N/A) [Range: >0]

classmethod from_simulation(sim)[source]

Compute the profiles and instantiate a CADETExternal.

kromatography.model.cadet_ph_external_profile.get_step_velocity(step, column=None)[source]

Extract the step linear superficial velocity (flow_rate), in m/s.

kromatography.model.chemical module

class kromatography.model.chemical.Chemical(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a chemical compound, that is a list of (chemical) components in a given state.

Parameters:
  • name (str) – Name of the compound.
  • state (str in {"Solid", "Liquid"}) – State the compound is in. Set to ‘Solid’ by default.
  • component_list (list of Component) – List of components the chemical compound is made of.
  • component_atom_count (list of int) – List of counts of each component to build the compound. All set to 1 if not provided.
state = Key(Enum(['Solid', 'Liquid']))

The physical state the compound is in.

formula = Property

Formula for the compound

molecular_weight = Parameter()

The molecular weight, assumed to be in g/mol.

component_list = List(Component)

List of components. Needed at construction.

component_atom_counts = List(Int)

List of atom counts for each component.

type_id = Constant(CHEMICAL_TYPE)

The type of data being represented by this class.

kromatography.model.chromatography_data module

class kromatography.model.chromatography_data.ChromatographyData(**traits)[source]

Bases: app_common.model_tools.data_element.DataElement

Base class for all the data objects.

Provides a base class describing the API for all the data objects in a chromatography workflow. These objects are assumed to have two special kinds of data:

  • key : refers to identifying data (name, lot id etc.)
  • parameter : a physical quantity (bead diameter etc.)
type_id = Key()

The human readable id for the type of this data (product, resin etc)

unique_id = Property(Dict)

The id that uniquely identifies the data to the user. Key-value map pairs for keys in _unique_keys.

kromatography.model.chromatography_results module

Chromatography run results contain continuous XY data, performance information, collected into in a ChromatographyResults object.

class kromatography.model.chromatography_results.ChromatographyResults(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Base class for the results from Chromatography experiment/simulation.

Specifies the interface for the outputs/results that are of interest in a chromatography process as opposed to raw data from an experiment/simulation.

This is a base class. Use either ExperimentResults or SimulationResults instead.

continuous_data = Dict

Holds the continuous measurements of various quantities for the duration of the experiment/simulation.

fraction_data = Dict

Results from fractionation study of sample collected at various sampling times. For an experiment, these are typically a few time samples. For a simulation, it can be as large as the number of time steps in the simulation.

performance_data = Instance(PerformanceData)

Contains the results pertaining to the performance of the chromatography process. For an experiment, these results come from analysis of the collected pool solution. For a simulation, these parameters need to be computed from the continuous_data using the collection criteria.

class kromatography.model.chromatography_results.ExperimentResults(**traits)[source]

Bases: kromatography.model.chromatography_results.ChromatographyResults

Implementation of ChromatographyResults for experiment results.

It contains continuous data in the continuous_data dictionary, and the fraction data found in Excel input file in the fraction_data dictionary.

Compared to a simulation result object, this one contains an additional import_settings dict containing information about the mapping between AKTA header to dataset types, as well as the time shifts applied (hold up volume as well as a manual shift during AKTA file import).

import_settings = Dict

Settings with which the AKTA file and fractions were loaded.

type_id = Constant('Experiment Results')

The type-id for this class.

class kromatography.model.chromatography_results.SimulationResults(**traits)[source]

Bases: kromatography.model.chromatography_results.ChromatographyResults

Implementation of ChromatographyResults for simulation results.

type_id = Constant('Simulation Results')

The type-id for this class.

kromatography.model.collection_criteria module

class kromatography.model.collection_criteria.CollectionCriteria(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a criteria used for starting/stoping collection of product during the chromatography process.

start_collection_type = Key(Enum(ALLOWED_START_COLLECT_TYPES))

The methodology used to signal start collecting

start_collection_target = ParameterFloat

When to start collecting

start_collection_while = Enum(['Ascending', 'Descending'])

When to look for target to be reached? While ascending to peak?

stop_collection_type = Key(Enum(ALLOWED_STOP_COLLECT_TYPES))

The methodology used to signal stop collecting

stop_collection_target = ParameterFloat

When to stop collecting

stop_collection_while = Enum(['Descending', 'Ascending'])

When to look for target to be reached? While descending from peak?

type_id = Constant(COLLECTION_CRITERIA)

The type of data being represented by this class.

kromatography.model.column module

Column and Column model class definitions.

class kromatography.model.column.ColumnType(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a possible column type to use for chromatography.

manufacturer = Key()

The name of the manufacturer

manufacturer_name = Key()

The model number the manufacturer uses

diameter = Instance(UnitScalar)

Diameter of the tube in cm

bed_height_range = Instance(UnitArray)

Min and Max bed height in cm

bed_height_adjust_method = Str

Bed height adjustment method (typically “Manual” or “Automated”)

type_id = Constant(COLUMN_TYPE)

The type of data being represented by this class.

class kromatography.model.column.Column(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a column used in chromatography (column + resin).

The class will enforce the bed_height to be within the range defined by the ColumnType it uses.

column_lot_id = Str

Packed column lot ID

column_type = Instance(ColumnType)

Column type used

resin = Instance(Resin)

Resin contained in the Column

bed_height_actual = Parameter()

Bed height, typically in cm

compress_factor = Instance(UnitScalar)

Compression Factor (settled vol/packed vol, unit-less)

hetp = Instance(UnitScalar)

Height Equivalent to a Theoretical Plate (HETP, in cm)

hetp_asymmetry = Instance(UnitScalar)

HETP Asymmetry (dimensionless)

volume = Property(depends_on=['bed_height_actual', 'column_type.diameter'])

Column volume (calculated from column diameter and bed height).

type_id = Constant(COLUMN)

The type of data being represented by this class.

kromatography.model.component module

class kromatography.model.component.Component(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents the properties associated with a component.

charge = Instance(UnitScalar)

The charge of the component (e.g. Sodium is -1)

pKa = Instance(UnitScalar)

The negative logarithm of the acidity constant of the component

type_id = Constant(COMPONENT_TYPE)

The type of data being represented by this class

kromatography.model.data_manager module

class kromatography.model.data_manager.DataManager[source]

Bases: traits.has_traits.HasStrictTraits

Data container for all data objects to edit and visualize.

That will include ChromatographyData objects as well as job, analysis, and anything that the GUI will edit.

kromatography.model.data_source module

Interface for a DataSource for chromatography experiment data.

A DataSource can contain both a catalog of objects and a catalog of data (implemented in the SimpleDataSource). A DataSource offers the ability to lookup an object or its data based on a type and one of its attribute. That lookup is done ignoring case and treating an underscore and a space as identical character. A DataSource offers also a constrained way to add new entries, checking against existing entries for name collision (or near collisions).

exception kromatography.model.data_source.DataSourceCollisionError[source]

Bases: exceptions.KeyError

Error raised when trying to insert in a datasource an object that collides with an existing entry.

exception kromatography.model.data_source.DataSourceLookupError[source]

Bases: exceptions.KeyError

Error raised when trying to retrieve an object from a datasource but 0 or strictly more than 1 object is found to match criteria specified.

exception kromatography.model.data_source.DataSourceTypeIDError[source]

Bases: exceptions.KeyError

Error raised when trying to request a typeID that doesn’t exist.

class kromatography.model.data_source.DataSource[source]

Bases: app_common.model_tools.data_element.DataElement

Interface for a data source.

FIXME: Fill out the API as part of serialization/DB access.

get_objects_by_type(type_id, filter_by=None)[source]

Return a list of known objects of a given type.

Parameters:
  • type_id (string) – The type_id for the data. For a DB this could be the table name, and for a serialized H5 object, this could be the type_id of the class.
  • filter_by (dict) – Key/value(s) to filter the objects of requested type. By default, no filtering is done.
get_object_type_ids()[source]

Return a list of known object type IDs.

set_object_of_type(type_id, obj)[source]

Add a new object to the object catalog. Raises an error if the name of the object is already an entry in the catalog.

class kromatography.model.data_source.InMemoryDataSource(**traits)[source]

Bases: kromatography.model.data_source.DataSource

General in-memory datasource for any kind of objects to be stored.

The objects are stored in the object_catalog. The keys of this dict are called type_ids and are mapped to a list of objects of that type. To monitor these lists easily with Traits listeners, these lists are also added to the datasource as direct attributes since one cannot listen to changes on the values of a dict. These direct lists are the ones exposed in the UI and appended to by the user, so dynamic listeners on these lists are needed to make sure the object catalog (which is what is serialized) is sync-ed up. In this picture, _type_ids_map contains the mapping between the type_ids (the keys in the object_catalog) and the name of the list attributes.

object_catalog = Dict

A dictionary mapping type_ids to all objects contained by the datasource of that type.

dirty = Bool(False)

Flag that the datasource was modified since it was last saved.

make_dirty()[source]

Manual action to make the DS dirty. Subclasses must call this when appropriate.

make_clean()[source]

Manual action to make the DS clean. Subclasses must call this when appropriate.

get_objects_by_type(type_id, filter_by=None)[source]

Return a (filtered) list of known objects of a given type.

Parameters:
  • type_id (str) – Type of object searched for.
  • filter_by (dict) – Key/value(s) to filter the objects of requested type. By default, no filtering is done.
get_object_of_type(type_id, attr_value, attr_name='name', strict=False)[source]

Retrieve object of given type and attribute from object catalog.

Note that fuzzy matching is applied by default unless strict is set to True. That means that filtering happens loosely, treating _ and spaces the same and ignoring letter case.

Parameters:
  • type_id (str) – Type ID of the object searched for.
  • attr_value (str) – Value of the attribute of the object searched for.
  • attr_name (str [OPTIONAL]) – Name of the attribute to filter on. Defaults to ‘name’.
  • strict (bool [OPTIONAL]) – Whether to apply strict or fuzzy object attribute matching. Defaults to False.
Returns:

Object with the correct name and type_id.

Return type:

ChromatographyData

Raises:

DataSourceLookupError – Raised if the request leads to 0 or 2+ candidates.

Notes

TODO: support a more complex filter instead of just a name, though allow someone wanting to request just a name to do so simply.

FIXME: Why not reusing here get_objects_by_type? Something like self.get_objects_by_type(type_id, filter_by={‘name’: object_name})

get_object_names_by_type(type_id, key='name')[source]

Return the list of names (or another key) for a type_id.

set_object_of_type(type_id, obj)[source]

Add a new object to the object catalog. Raises an error if there is already an object in the catalog with the same unique_id or if the type_id doesn’t already exist.

Parameters:
  • type_id (str) – Type of object to add. Must be a type already known by the DS.
  • obj (ChromatographyData) – Object to add to the datasource.
get_object_type_ids()[source]

Return a list of known object type IDs.

direct_list_changed()[source]

A change was made to the list attribute specified. Update dirty flag and object_catalog.

Parameters:list_names (str) – Name of the direct list that changed.
resync_object_catalog(type_ids=None)[source]

Sync the object catalog with the list attributes of the DS.

Parameters:type_ids (list of str) – List of type_ids to resync. By default it will resync all type_ids.
class kromatography.model.data_source.InStudyDataSource(**traits)[source]

Bases: kromatography.model.data_source.InMemoryDataSource

Implementation of the InMemoryDataSource to store study specific data.

In addition to the object_catalog, it contains direct access to entries in it (used by the data explorer). Note: event though, all these entries are dictionaries, they are declared as Any rather than Dict so that they can be the same object, rather than wrappers around the target dict.

class kromatography.model.data_source.SimpleDataSource(**traits)[source]

Bases: kromatography.model.data_source.InMemoryDataSource

Implementation of in-memory version of general user/multi-study DS.

Used to implement the user datasource, which provides building blocks for study to be built. It contains hardcoded default objects to get started, but users can contribute, store and load their custom study components.

products = List(Instance(Product))

Direct access to entries in object_catalog (can be listened to)

classmethod from_data_catalog(data_catalog, **traits)[source]
kromatography.model.data_source.standardise(str_input)[source]
kromatography.model.data_source.is_simple_datasource_blank(datasource)[source]

Is the provided datasource equivalent to the default SimpleDataSource?

kromatography.model.data_source.build_object_catalog(data_catalog=None)[source]

Convert a data_catalog into an object catalog.

Parameters:data_catalog (dict) – Dictionary mapping object types to data to build them.
Returns:Dictionary mapping object types to a list of objects to populate a SimpleDataSource with.
Return type:dict

kromatography.model.discretization module

class kromatography.model.discretization.Discretization[source]

Bases: traits.has_traits.HasStrictTraits

Discretization parameters.

ncol = PositiveInt(50, exclude_low=True)

Number of column (axial) discretization cells (Default: 50) [Range: >=1]

npar = PositiveInt(5, exclude_low=True)

Number of particle (radial) discretization cells (Default: 5) [Range: >=1]

par_disc_type = Enum(['EQUIDISTANT_PAR', 'EQUIVOLUME_PAR', 'USER_DEFINED_PAR'])

Specifies the discretization scheme inside the particles (default: EQUIDISTANT_PAR) [Range: EQUIDISTANT_PAR, EQUIVOLUME_PAR, USER_DEFINED_PAR]

reconstruction = Enum(['WENO'])

Type of reconstruction method for fluxes (default: WENO) [Range: WENO]

par_disc_vector = Array(dtype=float, shape=(None,))

A vector with node coordinates for the cell boundaries (default: NA) [Range: 0-1] [Length: NPAR+1]

weno = Instance(Weno, args=())

Weno class instance

kromatography.model.experiment module

Defines the base class for simulations and experiments, and the experiment implementation.

class kromatography.model.experiment.Experiment(**traits)[source]

Bases: kromatography.model.experiment._BaseExperiment

Represents a physical chromatography experiment.

system = Instance(System)

The chromatography system used/modeled by the experiment.

strip_mass_fraction = Instance(UnitScalar)

Fraction of the mass loaded in the column that elutes after pooling step

type_id = Constant(EXPERIMENT_TYPE)

The user visible type-id for the class.

kromatography.model.experimental_study module

class kromatography.model.experimental_study.ExperimentalStudy(**traits)[source]

Bases: kromatography.model.base_study.BaseStudy

Experimental study, that is a set of experiments that can be loaded from an Excel file written by an experimentalist.

filepath = Unicode

Excel file the study is loaded from

study_purpose = Str

Description of the scientific purpose for the experiments

study_id = Str

Study ID (lab notebook or ELN reference)

study_type = Str

Study type (e.g. Process Development, Process Characterization).

study_site = Str

Location where the experiments were conducted

experimentalist = Str

Experimentalist conducting the experiments

product = Property(depends_on='experiments')

Product studied.

kromatography.model.inlet module

class kromatography.model.inlet.Inlet(num_components, num_sections, **traits)[source]

Bases: traits.has_traits.HasStrictTraits

Inlet information for the simulation

nsec = PositiveInt()

Number of sections in the simulation (Default: NA) [Range >= 1]

section_times = Array(dtype=float, shape=(None,))

A vector with simulation times at which inlet function is discontinous; including start and end times (units = seconds) (Default: Vector of length nsec + 1 containing zeros) [Range >= 0.0]

section_continuity = Array(dtype=int, shape=(None,))

A vector indicating continuity of each section transition 0 (discontinuous) or 1 (continuous) (Default: Vector of length nsec-1 containing zeros) [Range: 0 or 1]

section = List(Instance(Section))

A vector containing nsec Section class objects (Default: Empty Vector ) [Range: NA]

kromatography.model.kromatography_project module

class kromatography.model.kromatography_project.KromatographyProject[source]

Bases: traits.has_traits.HasStrictTraits

Global model to support the Kromatography GUI application.

Responsible for holding data, and notifying when data gets deleted.

name = Str

Project’s name

data_manager = Instance(DataManager)

Accessor for all data to edit

datasource = Instance(DataSource)

Source of default data objects for creating new data elements. Set to parent KromatographyApp.

job_manager = Instance(JobManager)

Manager for running CADET jobs

study = Instance(Study)

Study this project will make

deleted_objects = List

List of UUIDs of deleted object so that containing Task can close related tab

chrom_plots = List

List of chromatogram plots created

is_blank = Property(Bool, depends_on='name, study, datasource, chrom_plots')

Check if the project’s components have been modified

add_object_deletion_listeners()[source]

Add a listener to each and every list where object may be deleted.

This is used by the KromTask to trigger the closure of corresponding central pane editor(s) if any.

kromatography.model.lazy_simulation module

class kromatography.model.lazy_simulation.LazyLoadingSimulation(**traits)[source]

Bases: kromatography.model.simulation.Simulation

Simulation object, where the output is lazy loaded from CADET file JIT.

This is useful when massive amounts of simulations are created because it doesn’t require keeping the SimulationResults in memory.

output = None

The output isn’t held by any (instance) attribute in a LazySimulation

classmethod from_simulation(sim)[source]

Create a LazyLoadingSimulation from a regular simulation.

Copy all attributes including run ones, except for the output. To replace the output, the source cadet file is copied into the target simulation unless the cadet file has been erased.

to_simulation()[source]

Export the current simulation to a regular simulation with its results data in memory.

kromatography.model.lazy_simulation.is_lazy(sim)[source]

Evaluate if the provided simulation is of type LazyLoading or not.

kromatography.model.mass_balance_analyzer module

Tool to compare mass loaded both from method information and from loaded continuous data of an experiment.

class kromatography.model.mass_balance_analyzer.MassBalanceAnalyzer(**traits)[source]

Bases: traits.has_traits.HasStrictTraits

Tool to compare loaded mass from continuous data to the method/solution information.

target_experiment = Instance(Experiment)

Target information we are evaluating mass balance for

time_of_origin = Instance(UnitScalar)

Time before which to truncate experiment data

mass_from_method = Instance(UnitScalar)

Loaded mass, as computed from method information

mass_from_uv = Instance(UnitScalar)

Loaded mass, as computed from UV continuous data

current_concentration = Property(Instance(UnitScalar))

Current load product concentration in target experiment

current_volume = Property(Instance(UnitScalar))

Current load step volume in target experiment

balance_threshold = Float

Threshold for relative difference to define the data as imbalanced

balanced = Bool

Whether the target experiment’s data is balanced (in agreement)

plot = Instance(Plot)

Plot of the UV data

plot_data = Instance(ArrayPlotData)

Data container for the plot

continuous_data = Instance(XYData)

Continuous UV data to evaluate loaded mass from (passed separately to support doing analysis while building an exp)

traits_view()[source]
analyze()[source]

Analyze all available loads, and compare to experiments cont. data.

Returns:Returns list of load names that are not balanced.
Return type:list
loaded_mass_from_method()[source]

Returns loaded product mass in grams, as compute from method data.

loaded_mass_from_uv()[source]

Returns loaded product mass in grams, as compute from UV data.

compute_loaded_vol(tgt_units=1.0)[source]

Compute the load step volume that would match the UV data at constant load solution concentration.

Returns:Load step volume, in CV, that would be needed to match the UV data.
Return type:UnitScalar
compute_concentration()[source]

Compute the load solution concentration that would match the UV data at constant load step volume.

Returns:Load solution concentration, in g/L, that would be needed to match the UV data.
Return type:UnitScalar

kromatography.model.method module

exception kromatography.model.method.StepLookupError[source]

Bases: exceptions.ValueError

class kromatography.model.method.Method(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a chromatography method, i.e. a sequence of MethodSteps.

TODO: This class should really be subclassed into a ExperimentMethod and a SimulationMethod and move in the latter the initial_buffer and its name. That class would also be better to host some of the attributes of the Simulation such as first_simulated_step, last_simulated_step and step_indices map.

run_type = Key(Enum(ALLOWED_METHOD_RUN_TYPES))

The method type

method_steps = List(Instance(MethodStep))

List of steps to implement the method

initial_buffer = Instance(Solution)

The initial solution in the column before first (simulated) method step

initial_buffer_name = Property(Str, depends_on='initial_buffer')

Provide a name attribute for easy access to the initial_buffer name

collection_step_number = Int(UNSET)

The number of the method step which creates the pool with the product.

collection_criteria = Instance(CollectionCriteria)

The criteria to start and stop collection during the method.

num_steps = Property(Int, depends_on='method_steps')

Number of steps in the method

load = Property(Instance(MethodStep), depends_on='method_steps')

Load step among all steps

offline_steps = List(Str)

List of steps not described by continuous data

type_id = Constant(METHOD_TYPE)

The type of data being represented by this class.

get_step_of_type(step_type, handle_not_unique='raise', collect_step_num=False)[source]

Returns step of type ‘step_type’ among the method_steps if present.

Parameters:
  • step_type (str) – Type of the step searched for. Must be one of the type list in kromatography.models.method_step.ALLOWED_METHOD_STEP_TYPES.
  • handle_not_unique (str) – Strategy to handle cases where there is not step with the property requested, or multiple steps with the property requested. Support values are ‘raise’ or ‘warn’.
  • collect_step_num (bool) – Return the step number together with the step object?
Returns:

  • step (or list of steps if handle_not_unique == ‘warn’) for which the
  • attribute has the value requested. If collect_step_num is on, instead
  • of a step, a tuple with the step and its number in the step list is
  • returned.

get_step_of_name(step_name, handle_not_unique='raise', collect_step_num=False)[source]

Returns step with name ‘step_name’ among the method_steps if present.

Parameters:
  • step_name (str) – Name of the step searched for.
  • handle_not_unique (str) – Strategy to handle cases where there is not step with the property requested, or multiple steps with the property requested. Support values are ‘raise’ or ‘warn’.
  • collect_step_num (bool) – Return the step number together with the step object?
Returns:

  • step (or list of steps if handle_not_unique == ‘warn’) for which the
  • attribute has the value requested. If collect_step_num is on, instead
  • of a step, a tuple with the step and its number in the step list is
  • returned.

get_step_of_attr(attr_name, attr_value, handle_not_unique='raise', collect_step_num=False)[source]

Search for the step with a certain values for a certain attribute.

Parameters:
  • attr_name (str) – Name of the step attribute to test.
  • attr_value (any) – Value to search for in the attribute selected.
  • handle_not_unique (str) – Strategy to handle cases where there is not step with the property requested, or multiple steps with the property requested. Support values are ‘raise’ or ‘warn’.
  • collect_step_num (bool) – Return the step number together with the step object?
Returns:

  • step (or list of steps if handle_not_unique == ‘warn’) for which the
  • attribute has the value requested. If collect_step_num is on, instead
  • of a step, a tuple with the step and its number in the step list is
  • returned.

kromatography.model.method_step module

class kromatography.model.method_step.MethodStep(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a chromatography method step.

step_type = Key(Enum(ALLOWED_METHOD_STEP_TYPES))

The step type

solutions = List(Instance(Solution))

Liquid involved in chromatography step. Can be a Buffer or a Load.

flow_rate = Parameter()

Flow rate of solution, typically in cm/hr

volume = Parameter()

Volume of solution involved (in Column Volume CVs)

type_id = Constant(METHOD_STEP_TYPE)

The type of data being represented by this class.

update_solution_names()[source]

kromatography.model.parameter_description module

class kromatography.model.parameter_description.ParameterDescription[source]

Bases: traits.has_traits.HasStrictTraits

Description of a fixed simulation parameter.

Parameters:name (str) – That should be an attribute path of the parameter to scan. Should be able to be appended to ‘simulation.’ and lead to an eval-able string. For example: ‘binding_model.sma_ka[1]’.
name = Str

Name/path of the simulation attribute to scan

class kromatography.model.parameter_description.SMAParameterDescription[source]

Bases: kromatography.model.parameter_description.ParameterDescription

Custom param descriptions for SMA models which ajusts the default value based on the parameter name.

kromatography.model.parameter_scan_description module

Describe how a simulation parameter is/should be scanned if scanned regularly. Contains an implementation of a general parameter as well as a specific SMA binding parameter.

class kromatography.model.parameter_scan_description.ParameterScanDescription(**traits)[source]

Bases: kromatography.model.base_parameter_scan_description.BaseParameterScanDescription

Description of how a simulation parameter should be regularly scanned.

name

str – That should be an attribute path of the parameter to scan. Should be able to be appended to ‘simulation.’ and lead to an eval-able string. For example: ‘binding_model.sma_ka[1]’.

low

float – Low value to start scanning at.

high

float – High value to stop scanning at (included).

num_values

int [OPTIONAL, default=5] – Number of values to split the space between low and high.

spacing

str – Type of spacing between the values. Choose between ‘Linear’ and ‘Log’.

low = Float

Lowest value to scan.

high = Float(1.0)

Highest value to scan as long as num_values > 1.

num_values = Range(value=DEFAULT_NUM_VALUES, low=1, exclude_low=False)

Number of values to scan between low and high

spacing = Enum(['Linear', 'Log'])

Type of spacing between the scanned values

scanned_values = Array

Final values that will be scanned based on all other attributes

parallel_parameters = List

List of parameter to scan simultaneously

add_parallel_params = Button('View/Edit')

Button to trigger the selection of parameters to scan simultaneously

update_scanned_values()[source]
to_sim_diffs()[source]

Convert the current scan description to a simulation diff.

validate_parallel_parameters()[source]
class kromatography.model.parameter_scan_description.SMAParameterScanDescription(**traits)[source]

Bases: kromatography.model.parameter_scan_description.ParameterScanDescription

Custom param descriptions for SMA models.

Compared to a ParameterScanDescription, it has simplified parameter name/path and suggests low and high based on the parameter name.

to_param_scan_desc()[source]

Convert to regular, eval-able ParameterScanDescription.

kromatography.model.parameter_scan_description.full_param_name_from_short_name(short_name)[source]

Convert short SMAParamScanDescription name to full one to be eval-ed.

kromatography.model.parameter_scan_description.extract_short_name_from_param_scan(param)[source]

Extract the parameter name from its path.

Parameters:param (Instance(ParameterScanDescription)) – Parameter to extract the name from its extended name.

Examples

>>> extract_short_name_from_param_scan('binding_model.sma_ka[1]')
sma_ka

kromatography.model.performance_data module

class kromatography.model.performance_data.PerformanceData(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Container to hold performance data from simulation or experiment

start_collect_time = Instance(UnitScalar)

The time that start collect was initiated/should start

stop_collect_time = Instance(UnitScalar)

The time that collection was stopped/should stop

pool_volume = Instance(UnitScalar)

Volume of Product Pool resulting from chromatography process in CVs

pool = Instance(SolutionWithProduct)

Pool created by selected start and stop times

step_yield = Instance(UnitScalar)

Percent of product yielded by process (product in pool/product in load)

pool_concentration = Instance(UnitScalar)

Concentration of all product components in the pool

pool_purities = Str

String representation of all component purities

type_id = Constant('Performance Data')

The type-id for this class.

update_pool_purities()[source]

kromatography.model.product module

Product Class Implementation. In chromatography, the product is the most important material, since it is the set of components that the chromatography is set to produce. Note that that might differ from the finaly product that the drug being manufactured will contain, since there are multiple chromatography steps during the purification process.

exception kromatography.model.product.ExpressionComputationError[source]

Bases: exceptions.ValueError

Specific exception raised when sympy’s solver fails to invert concentration expressions.

class kromatography.model.product.Product(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a product, which is made up of components, impurities, and amino acids.

The product stores the expressions needed to compute the concentration of each component, which are used by SolutionWithProduct for the actual computation, since the solution’s overall concentration is needed.

description = Str

User notes about the product’s origin, purpose, ...

product_type = Key()

The type of product

product_components = List(Instance(ProductComponent))

List of components this product is composed of

product_component_names = Property(List(Str), depends_on='product_components')

List of component names. Built from the product_components list

product_component_assays = List(Str)

List of assay names to compute the concentrations of each component

product_component_concentration_exps = Instance(pd.Series)

Expressions to compute the concentration of each product_component given the product’s concentration and assays results. This should be a Pandas Series indexed on the component names, and containing string expressions. Each string should be an eval-able expression involving the ‘product_component_assays’ as well as the total product_concentration. (e.g. ‘product_concentration * CEX_Acidic_2 / 100’)

product_component_assay_exps = Property(Instance(List(Str)), depends_on='product_component_concentration_exps' )

Expressions to compute the assay of each product_component given the product’s component concentration. Each string should be a valid Python expression that can use the names in the ‘product_component_names’ attribute as well as the name product_concentration

impurity_names = List(Str)

List of impurities in the product

impurity_assays = List(Str)

List of the assay names for each impurity

impurity_concentration_exps = Instance(pd.Series)

Expressions to compute the concentration of each impurity given the product’s concentration and impurity assays. This should be a Pandas Series indexed on the component names, and containing string expressions. Each string should be an eval-able expression that can use the names in the ‘impurity_assays’ attribute as well as the name product_concentration.

impurity_assay_exps = Property(Instance(List(Str)), depends_on='impurity_concentration_exps')

Expressions to compute the assay of each product_component given the product’s component concentration. Each string should be a valid Python expression that can use the names in the ‘product_component_names’ attribute as well as the name product_concentration

pI = Instance(UnitScalar)

Iso-electric point of the product (in pH unit)

amino_acids = List(Str)

List of titrating amino acids in the product

amino_acid_numbers = List(Int)

Number of each amino acid in the product

num_components = Property(Int, depends_on='product_components')

Number of components the product contains

type_id = Constant(PRODUCT_TYPE)

The type of data being represented by this class.

component_attrs = None

check for each set of attributes, the same number was given

get_component_with_name(name)[source]

Returns component with specified name.

Raises:KeyError: – If the name requested isn’t a valid component name.
kromatography.model.product.make_blank_product()[source]

kromatography.model.product_component module

ProductComponent Class Implementation

class kromatography.model.product_component.ProductComponent(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Repesents one component of a product.

target_product = Str

Target product, optional

molecular_weight = Instance(UnitScalar)

Molecular weight (kg/mol)

extinction_coefficient = Instance(UnitScalar)

Extinction Coefficient (uses extinction_coefficient_unit as units)

kromatography.model.product_component_assay module

ProductComponentAssay Class Implementation (just a name for now.)

class kromatography.model.product_component_assay.ProductComponentAssay(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Assay class to describe the product’s list of component assays.

kromatography.model.random_parameter_scan_description module

Describe how a simulation parameter is/should be scanned if scanned regularly. Contains an implementation of a general parameter as well as a specific SMA binding parameter.

kromatography.model.random_parameter_scan_description.collect_numpy_distros()[source]

Automatically collect all random number generation functions in numpy.

class kromatography.model.random_parameter_scan_description.RandomParameterScanDescription(**traits)[source]

Bases: kromatography.model.base_parameter_scan_description.BaseParameterScanDescription

Description of how a simulation parameter should be regularly scanned.

Parameters:
  • name (str) – That should be an attribute path of the parameter to scan. Should be able to be appended to ‘simulation.’ and lead to an eval-able string. For example: ‘binding_model.sma_ka[1]’.
  • distribution (str) – Type of random distribution to use to generate random values. Choose between “Uniform” and “Gaussian”, or one of the numpy functions contained in the numpy.random module.
  • dist_param1 (float) – First parameter to describe the distribution used to sample the parameter.
  • dist_param2 (float) – High value to stop scanning at (included).
  • additional_params (tuple) – Additional parameters needed to describe the distribution. Not needed for ‘Uniform’ or ‘Gaussian’.
distribution = Enum(FAMILIAR_DISTROS + collect_numpy_distros())

Type of random distribution to draw random values from to scan parameter

dist_param1 = Float

First parameter to describe the distribution. Corresponds to ‘mean’ for ‘Gaussian’ distribution to ‘low’ (inclusive) for ‘Uniform’ distribution.

dist_param2 = Float

First parameter to describe the distribution. Corresponds to ‘standard deviation’ for ‘Gaussian’ distribution to ‘high’ (exclusive) for ‘Uniform’ distribution.

additional_params = Tuple

Additional parameters to describe the distribution. Used only for distributions more complex than “Uniform” or “Gaussian”.

kromatography.model.resin module

class kromatography.model.resin.Resin(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents the properties associated with a sample of resin.

lot_id = Str()

The lot/batch id for this sample of resin

resin_type = Key()

The type of the resin.

ligand = Str()

The name/id of the ligand in this sample of resin.

average_bead_diameter = Parameter()

The average diameter (um) of the beads in this sample of resin.

ligand_density = Parameter()

The density of the ligand (mM) in this sample of resin.

settled_porosity = Instance(UnitScalar)

FIXME: better doc : This seems like some kind of normalized (wrt bed height / compaction factor) porosity.

type_id = Constant(RESIN_TYPE)

The type of data being represented by this class.

kromatography.model.schur_solver module

class kromatography.model.schur_solver.SchurSolver[source]

Bases: traits.has_traits.HasStrictTraits

Schur Solver parameters.

gs_type = Enum([1, 2])

Type of Gram-Schmidt orthogonalization (1-Classical GS (default), 2-Modified GS)

max_krylov = Int(0)

Defines the size of the iterative linear SPGMR solver (Default: 0) [Range: 0-NCOL]

max_restarts = PositiveInt(0)

Maximum number of restarts in the GMRES algorithm. If lack of memory is not an issue, better use a larger Krylov space than restarts (default: 0) [Range: >=0]

schur_safety = PositiveFloat(1e-08)

Schur safety factor; Influences the tradeof between linear iterations and nonlinear error control; see IDAS guide 2.1, 5 (default: 1.0e-8) [Range: >=0]

kromatography.model.section module

class kromatography.model.section.Section(ncomp, **traits)[source]

Bases: traits.has_traits.HasStrictTraits

Inlet concentration profile for each component in section in mM

const_coeff = Array(dtype=float, shape=(None,))

A vector with constant coefficients for inlet concentrations (Default: Vector of length ncomp containing zeros) [Range >= 0.0]

lin_coeff = Array(dtype=float, shape=(None,))

A vector with linear coefficients for inlet concentrations (Default: Vector of length ncomp containing zeros) [Range: Any]

quad_coeff = Array(dtype=float, shape=(None,))

A vector with quadratic coefficients for inlet concentrations (Default: Vector of length ncomp containing zeros) [Range: Any]

cube_coeff = Array(dtype=float, shape=(None,))

A vector with cubic coefficients for inlet concentrations (Default: Vector of length ncomp containing zeros) [Range: Any]

kromatography.model.sensitivity module

class kromatography.model.sensitivity.Sensitivity[source]

Bases: traits.has_traits.HasStrictTraits

Sensitivities to be computed by solver.

nsens = PositiveInt(0)

Number of sensitivities to be computed (Default: 0) [Range: >=0]

sens_method = Enum(['ad1', 'fd1', 'fd2', 'fd3', 'fd4'])

Method used for computation of sensitivities; algorithmic differentiation (ad1) or finite difference of order 1-4 (fd1, fd2, fd3, fd4) (Default: ad1) [Range: ad1, fd1, fd2, fd3, fd4]

kromatography.model.simulation module

Simulation class implementation

class kromatography.model.simulation.Simulation(**traits)[source]

Bases: kromatography.model.experiment._BaseExperiment

Class containing data necessary to run Cadet Simulation.

The description of the steps involved in the simulation are to be found in its method, attribute declared in the BaseExperiment. Information about the steps of the experiment that corresponds to the simulation are accessible via the source_experiment attribute.

description = Str()

User notes about the simulation’s origin, purpose, ...

binding_model = Instance(BindingModel)

Binding model (binding of the protein to the resins)

transport_model = Instance(TransportModel)

Transport model (transport of the protein across the column)

discretization = Instance(Discretization, args=())

CADET solver discretization parameters (for solving differential eq.)

sensitivity = Instance(Sensitivity, args=())

Sensitivity parameters

solver = Instance(Solver, args=())

Wrapper around the CADET diff equ solver

source_experiment = Instance(Experiment)

Experiment this simulation was built from.

section_times = Instance(UnitArray)

Timestamps at the beginning/end of each simulated steps

first_simulated_step = Str

Name of the first step simulated by CADET, among source experiment steps

last_simulated_step = Str

Name of the last step simulated by CADET, among source experiment steps

has_run = Bool

Set to false at the creation/before a run, and set to True after running

run_status = Enum(ALL_SIM_RUN_STATUSES)

CADET run status in more details

cadet_filename = Property(Str, depends_on='uuid')

Name of the HDF5 CADET input file generated to run this simulation

cadet_filepath = Property(Str, depends_on='uuid')

Full absolute path to the HDF5 CADET input/output file.

plot_request = Event

Fires when user executes right-click menu action ‘Plot Simulation’, is listened to by KromatographyTask

cadet_request = Event

Fires when user executes right-click menu action ‘Run Simulation...’, is listened to by KromatographyTask

cadet_run_finished = Event

Fires when cadet has finished running, whether successfully or not

perf_param_data_event = Event

Fires when Simulation perf param results get updated (i.e. after Cadet get’s called)

duplicate_request = Event

Fires when user executes right-click menu action ‘Duplicate’, is listened to by Study

type_id = Constant(SIMULATION_TYPE)

The user visible type-id for the class.

copy()[source]

Returns new sim equal to this one except uuid and set as not-run.

Note: It is important that a new simulation copies only the inputs and not the outputs and that it supports modifications. It is also critical that the new simulation respects all objects linking. For example, a simulation using a buffer multiple times should be using the same instance of that buffer, such that changes to it affects all its uses.

clone()[source]

Returns a new & independent simulation but equal to this one, except for its uuid.

run(job_manager, wait=False)[source]

Run the current simulation submitting the job to the provided job_manager.

set_as_not_run()[source]

Reset to not be run: updates flags and deletes output.

set_as_run()[source]

Reset the run flags to be run.

Note: run_status not set because it depends how the run went.

create_cadet_input_file()[source]

Create CADET input file if doesn’t already exist and return path.

load_results()[source]
reset_solver_user_times()[source]

Set simulation output properties, including solver solution times.

fire_plot_request()[source]
fire_cadet_request()[source]
fire_perf_param_data_event()[source]
fire_duplicate_request()[source]
kromatography.model.simulation.get_section_times(section_steps, column, tgt_units=None)[source]

Return timestamps start/stop of all method steps. First start is 0.

Parameters:
  • section_steps (list(MethodStep)) – The list of method steps in the simulation.
  • column (Column) – The column the steps are flowing through.
  • tgt_units (scimath.Unit (OPTIONAL)) – The units for the returned data. Defaults to “seconds”.
Returns:

section_times – The step timestamps for the section in the units given in tgt_units. These are the boundary times for all steps. Therefore len(section_times) == len(section_steps) + 1

Return type:

UnitArray

kromatography.model.simulation_group module

SimulationGroup class implementation and supporting classes and functions.

This defines an unordered collection of simulations that are specified as their difference to some reference simulation called “center point”.

That requires the introduction of a SimulationDiff concept wich needs to encapsulate all the information to generate the Simulation if added to the center point. That is currently implemented as a sequence (tuple) of SingleParamSimulationDiff, with attributes ‘extended_attr’ and ‘val’.

class kromatography.model.simulation_group.SingleParamSimulationDiff(extended_attr, val)

Bases: tuple

extended_attr

Alias for field number 0

val

Alias for field number 1

class kromatography.model.simulation_group.SimulationGroup(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a group of simulations around a “center point” simulation.

These groups of simulations describes and manages an unordered collection of Simulations that are specified as their difference to some reference simulation called “center point” (CP). That center point isn’t necessarily part of the group, though it can and is then mapped to “None”. Alternatively, a simulation in the group may have all it parameters (almost) equal to the values in the CP.

In addition to the CP simulation, the group is characterized by the list of simulation differences describing how the simulations in the group differ from the CP. A “simulation diff” is just a tuple of SingleParamSimulationDiff instances, which contain the path to the parameter to change, and the value.

Note: to save memory, simulation groups may be built with a LazyLoadingSimulation as its center point. Then, all simulations in the group will be LazyLoading.

type = Enum(GROUP_TYPES)

Type of simulation group: regular grid, randomly generated, ...

center_point_simulation = Instance(Simulation)

Central simulation around which to build the group

is_lazy_loading = Property(Bool, depends_on='center_point_simulation')

Whether the group contains LazyLoading or in-memory simulations.

auto_delete_run_sims = Bool(False)

Delete CADET files along the way to conserve disk space?

center_point_simulation_name = Str

Name of central sim from which all simulations are a deviation

simulation_diffs = List

List of simulation diffs to create the simulations in the group

simulations = List

List of simulations in the group. Same order as simulation_diffs

size = Property(depends_on='simulation_diffs')

Number of simulations in the group.

cadet_request = Event

Fires when user executes context menu action ‘Run All Simulations...’ Listened to by KromatographyTask

plot_request = Event

Fires when user executes context menu action ‘Plot All Simulations...’ Listened to by KromatographyTask

group_data = Instance(pd.DataFrame)

Collated results from all simulations

perf_params = Dict

Dict mapping performance parameter name and attribute paths

group_data_updated_event = Event

Event triggered when the group_data dataframe is updated

has_run = Property(Bool, depends_on='simulations:cadet_run_finished')

Has the group’s simulation been run?

run_status = Enum([MULTI_SIM_RUNNER_CREATED, MULTI_SIM_RUNNER_RUNNING, MULTI_SIM_RUNNER_FINISHED])

Status of the optimizer as a string

sims_run = Set

Set of simulation UUIDs already run

size_run = Property(Int, depends_on='sims_run')

Number of simulations already run

percent_run = Property(Str, depends_on='size_run')

Percentage of the group run

sim_runner = Any

Simulation runner

type_id = Constant(SIMULATIONGROUP_TYPE)

The user visible type-id for the class.

fire_cadet_request()[source]

Trigger event that a CADET run was requested. The Study containing the group listens to this.

fire_plot_request()[source]

Trigger event that a plot of all simulations was requested. The Study containing the group listens to this.

initialize_group_data()[source]

Initialize the group_data DataFrame from the simulation_diffs.

run(job_manager, study=None, wait=False)[source]

Rebuild and run CADET on all simulations of the group.

Parameters:
  • job_manager (JobManager) – Manager to send simulation runs to.
  • study (Study [OPTIONAL]) – Study containing the simulation that serves as center point for the group. Needed only if the simulation_group doesn’t have its center_point_simulation set.
  • wait (bool [OPTIONAL]) – Make this call blocking, by forcing to wait until the job manager has run all simulations. False by default. In that case, listen to has_run to know that all simulation have finished running.
Returns:

List of Job ids submitted for run.

Return type:

list

wait()[source]

Wait for all simulations in the group to be run and has_run to update to True.

initialize_simulations(use_output_cache=False)[source]

Initialize the list of simulation from the diffs and center point.

Parameters:use_output_cache (bool [OPTIONAL, default=False]) – Whether to initialize the simulations reusing the cached cadet file names. This is used when a group’s simulations have been cleared to conserve memory, and needs to be rebuilt.
clear_simulations()[source]

Empty simulation list without creating a new one

Needed to be done that way so that the data browser doesn’t loose track of it.

release_simulation_list()[source]

Free up memory by emptying the list of simulations and releasing handle on the simulation runner.

The simulations can be rebuilt from the list of simulation diffs and the list of output file names.

Note that the corresponding memory will only be freed up once the python garbage collector runs, at a time hard to predict.

get_simulation(sim_idx)[source]

Retrieve or rebuild a simulation from the group.

Parameters:sim_idx (int) – Index of the simulation in the simulations list.
create_and_append_sim_from_sim_diff(diff_idx, diff, use_output_cache=False)[source]

Create new simulation from center point + diff and append to simulation list.

listen_to_sim_has_run(sim, attr, new)[source]

A simulation has finished running: update group data and run status/progress.

static col_is_output(col_name)[source]
kromatography.model.simulation_group.short_sim_name_from_fullname(sim_name)[source]

Shorter version of the simulation name for the simulation in a group.

kromatography.model.simulation_group.short_sim_name_from_sim_number(sim_num)[source]
kromatography.model.simulation_group.get_val_for_sim(sim, attr)[source]

Look up extended attribute for the provided simulation (using eval).

Parameters:
  • sim (Simulation) – Simulation to extract the value from.
  • attr (str) – Extended attribute path to lookup.
Returns:

Return type:

Value for the attribute or np.nan if not found.

kromatography.model.simulation_group.add_sim_to_diff(orig_sim, diff)[source]

Create a new simulation that differs from orig_sim only by diff.

Note: since this operation typically modifies the inputs, the new simulation’s outputs are cleared and the simulation is reset to having not been run.

FIXME: could define a SimDiff object and have this code below be the definition of the + between a simulation and a Diff.

Parameters:
  • orig_sim (Simulation or LazyLoadingSimulation) – Simulation to build the result from.
  • diff (tuple of SingleParamSimDiff) – Difference between orig_sim and the Simulation to generate.
Returns:

Result of the “operation” orig_sim + diff, with the output cleared. The type of the resulting simulation is the same as the input simulation.

Return type:

Simulation or LazyLoadingSimulation

kromatography.model.simulation_group.append_run_sim_to_group(group, sim, diff=None)[source]

Utility to append an already run simulation to a SimulationGroup.

kromatography.model.solution module

class kromatography.model.solution.Solution(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Base class for the solution like objects.

NOTE: type_id is not specified for this class as this is not meant to be instantiated.

description = Str()

The lot id of the solution

source = Str()

The source of the solution

lot_id = Str()

The lot id of the solution

density = Instance(UnitScalar)

The density of the solution

conductivity = Instance(UnitScalar)

The conductivity of the solution

pH = Parameter()

The pH of the solution

temperature = Instance(UnitScalar)

The temperature of the solution

chemical_components = List(Component)

The list of chemical components in the solution.

chemical_component_concentrations = ParameterUnitArray

The concentrations (M) of each chemical component in the buffer.

cation_concentration = Property(Instance(UnitArray), depends_on=['chemical_components', 'chemical_component_concentrations'])

The concentration of the cations (positively charged ions) in the solution.

anion_concentration = Property(Instance(UnitArray), depends_on=['chemical_components', 'chemical_component_concentrations'])

The concentration of the anions (negatively charged ions) in the solution.

kromatography.model.solution_with_product module

class kromatography.model.solution_with_product.SolutionWithProduct(**traits)[source]

Bases: kromatography.model.solution.Solution

Represents the properties associated with a component.

FIXME: Break the code here into a Pool subclass and a Load so that we don’t constantly test on solution_type.

solution_type = Key(Enum(['Load', 'Pool', 'Fraction']))

The type of solution (load, frac, pool)

product = Instance(Product)

The product associated with the solution.

product_concentration = Parameter()

The concentration (g/liter) of the product in the solution.

product_component_purities = Property(Instance(UnitArray), depends_on= 'product_concentration, product,_product_component_concentrations')

Concentration ratio for each product component in %

product_component_assay_values = ParameterUnitArray()

The values for the product component assays (attribute of Product class)

strip_mass_fraction = Property(Parameter, depends_on= 'product_component_assay_values, _strip_fraction_updated')

The assay value specifically for the strip component (if any) since treated differently.

product_component_concentrations = Property(Instance(UnitArray), depends_on= 'solution_type, product_concentration, product, product_component_assay_values' )

The concentrations of each product component in the solution.

impurity_assay_values = Instance(UnitArray)

The values for the impurity assays (attribute of the Product class).

impurity_concentrations = Property(Instance(UnitArray), depends_on= 'solution_type, product_concentration, impurity_assay_values, product')

The concentrations of each impurity in the solution.

type_id = Constant(SOLUTIONWITHPRODUCT_TYPE)

The type of data being represented by this class

compute_concentrations(component_group, product)[source]

Returns a list of UnitScalars representing the concentrations of each component in the SolutionWithProduct object calling this method.

Parameters:
  • component_group (str) – The group to compute the concentrations for. Is either ‘product_component’ or ‘impurity’
  • product (Product) – Instance of the Product class
Returns:

concentrations – The concentrations of the individual components for the the group specified by component_group. The units for concentrations is decided by the user specified expressions in <component_group>_concentration_exps.

Return type:

UnitArray

compute_assays(component_group, product)[source]

Returns fractions of assays computed from the product’s components/impurities concentrations.

Parameters:
  • component_group (str) – The group to compute the concentrations for. Either ‘product_component’ or ‘impurity’.
  • product (Product) – Product contained in the solution, whose assays are being computed.

kromatography.model.solver module

class kromatography.model.solver.Solver[source]

Bases: traits.has_traits.HasStrictTraits

Solver parameters.

nthreads = PositiveInt(exclude_low=True)

Number of used OpenMP threads

log_level = Enum(['INFO', 'WARNING', 'ERROR', 'DEBUG1', 'DEBUG2', 'TRACE1', 'TRACE2'])

Specifies the verbosity of the logging output (Only errors; warning and errors; info and warnings and errors, etc.)

print_config = Enum([1, 0])

Print configuration message before simulation

print_paramlist = Enum([0, 1])

Print list of parameters before simulation

print_progress = Enum([1, 0])

Print current state of simulation

print_statistics = Enum([1, 0])

Print integrator statistics after each section

print_timing = Enum([1, 0])

Print timing information after simulation

use_analytic_jacobian = Enum([1, 0])

Use analytically computed jacobian matrix (faster) instead of jacobian generated by algorithmic differentiation (slower)

number_user_solution_points = Int(DEFAULT_NUM_TIMES)

A integer with the number of time-points at which a solution is desired

user_solution_times = Array(dtype=float, shape=(None,))

A vector with timepoints at which a solution is desired

write_at_user_times = Enum([0, 1])

Write solutions at times specified by USER_SOLUTION_TIMES (write integration timepoints otherwise)

write_solution_times = Enum([1, 0])

Write times at which a solution was produced

write_solution_column_inlet = Enum([1, 0])

Write solutions at column inlet (boundary condition)

write_solution_column_outlet = Enum([1, 0])

Write solutions at column outlet (chromatograms)

write_solution_all = Enum([1, 0])

Write all (intermediate) solutions

write_solution_last = Enum([0, 1])

Write full solution state vector at last time point

write_sens_column_outlet = Enum([0, 1])

Write sensitivity data at column outlet

write_sens_all = Enum([0, 1])

Write all (intermediate) sensitivity data

write_sens_last = Enum([0, 1])

Write sensitivity data at column outlet

schur_solver = Instance(SchurSolver, args=())

Print current state of simulation

time_integrator = Instance(TimeIntegrator, args=())

Print current state of simulation

calculate_user_solution_times(end_time, start_time=0.0)[source]

kromatography.model.study module

exception kromatography.model.study.SimulationNameCollisionError[source]

Bases: exceptions.ValueError

class kromatography.model.study.Study(**traits)[source]

Bases: kromatography.model.base_study.BaseStudy

Model for a complete analysis study.

This contains a list of simulations, a list of experiments, a set of core parameters used as center point for the study, and a study_datasource to store custom objects to be reused in the various simulations: solutions, custom binding models, custom transport models, ...

study_type = Str

Modeling Study Type (e.g. Parameter Estimation, Model Qualification, Monte Carlo)

study_purpose = Str

Modeling Study Purpose

exp_study_filepath = Unicode

Source file for the experimental study

product = Instance(Product)

Product studied.

experiments = List(Instance(Experiment))

Experiments

simulations = List(Instance(Simulation))

List of simulations exploring this setup

study_datasource = Instance(DataSource)

Local source of custom configured data: binding models, solutions, ...

analysis_tools = Instance(StudyAnalysisTools, ())

Container to analysis tools (simulation grids, optimizers, ...)

is_blank = Bool(True)

Has the study been modified by anyone?

sim_runner_manager = Instance(SimulationRunnerManager, ())

Object to collect all simulation runners, making sure they update sims

product_contains_strip = Property(Bool)

Is there a Strip component in the product set?

create_new_experiment()[source]
add_experiments(experiment_list)[source]

Add multiple experiments to the study, and update its product if

Parameters:experiment_list (iterable) – List (or other iterable) of experiments to add to the study.
add_simulations(simulation_list)[source]

Add sims provided if their names don’t collide with existing sims.

Parameters:simulation_list (iterable) – List (or other iterable) of simulations to add to the study.
Raises:SimulationNameCollisionError – If one of the simulations to be added has a name which collides with existing simulations.
update_datasource_from_experiment(experiment_list)[source]

Store in the study datasource all complex objects defined in the experiments.

update_from_experimental_study(experimental_study)[source]

Load experimental study data into current study.

request_new_simulations_from_experiments()[source]

Add new simulations mirroring experiment(s) in the current study.

request_new_simulation_group(sim=None)[source]

Create a new SimulationGroup around a center point simulation that already exists.

request_new_simulation_from_datasource(datasource)[source]

Add a new simulation selected from a standard object in datasource.

request_strip_fraction_tool()[source]
create_new_optimizer()[source]

Returns new optimizer to find optimized sim to fit a set of exps.

add_duplicate_simulation(simulation)[source]

Add duplicate of provided simulation to the current study.

run_simulations(job_manager, sims=None, wait=False)[source]

Runs simulations in Cadet and update them with results on success.

run_simulation_group(job_manager, sim_group=None, wait=False)[source]

Runs all sims of a SimulationGroup in Cadet, update with results

run_optimizer(job_manager, optimizer, wait=False)[source]

Launch the run of the provided optimizer, keeping track of created runners.

search_simulation_by_name(name, how='deep')[source]

Returns the Simulation matching the specified name, if any.

Regular simulations are searched first, then simulations inside all simulation grids, then simulations inside optimizers are searched if how is set to “deep”.

Parameters:
  • name (str) – Name of the Simulation to look for.
  • how (str) – Search strategy. Supported values are “deep” (default) and “shallow”. If how=”shallow”, only search inside the study’s simulations list. If how=”deep”, search first there, and, if not found, search within the study’s SimulationGroup and Optimizer objects.
Raises:

KeyError – Raised if no simulation is found with the provided name.

search_simulation_group_by_name(name, how='deep')[source]

Returns the SimulationGroup matching the specified name, if any.

Simulation grids are searched first, then simulation grids built by optimizers are searched.

Parameters:
  • name (str) – Name of the SimulationGroup to look for.
  • how (str) – Search strategy. Supported values are “deep” (default) and “shallow”. If “shallow”, only search inside the analysis_tools dedicated list of SimulationGroups. If “deep”, search first there, and, if not found, search within the Optimizer objects.
Raises:

KeyError – Raised if no simulation grid is found with the provided name.

update_blank()[source]
duplicate_simulation(obj, name, new)[source]
kromatography.model.study.make_blank_study(**traits)[source]

Make a new blank study.

Any trait can be passed, except is_blank that has to be True.

kromatography.model.study.add_sims_from_exp_to_study(study, experiment_names, first_simulated_step_name, last_simulated_step_name, initial_buffer_name=None)[source]

Create simulations from experiments and add them to study.

Parameters:
  • study (Study) – Study to which to add new simulations.
  • experiment_names (list(str)) – List of experiment names to create the simulations from.
  • first_simulated_step_name (str) – Name of the method step to start the simulation’s method.
  • last_simulated_step_name (str) – Name of the method step to end the simulation’s method.
  • initial_buffer_name (str [OPTIONAL]) – Name of the buffer to use for initial condition. If not set, it will be derived from first_simulated_step_name.

kromatography.model.study_analysis_tools module

class kromatography.model.study_analysis_tools.StudyAnalysisTools[source]

Bases: app_common.model_tools.data_element.DataElement

Small container object to store simulation grids and optimizers done in a study.

simulation_grids = List()

List of regular simulation grids created to analyze the study

monte_carlo_explorations = List()

List of randomly sampled simulation groups created to analyze the study

optimizations = List()

List of optimizations created to analyze the study

request_strip_fraction_tool(experiments)[source]

kromatography.model.system module

Systems classes (type and specific implementation) to describe the machine implementing and recording the measurements during the Chromatography process.

class kromatography.model.system.SystemType(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents a particular type of chromatography system, as provided by manufacturers.

manufacturer = Key()

The name of the manufacturer

manufacturer_name = Str()

The name the manufacturer uses.

flow_range = Instance(UnitArray)

The (min, max) flow rates for the system.

num_inlets = Int

The number of inlets

num_channels = Int

The number of channels

type_id = Constant(SYSTEM_TYPE)

The user visible type-id for the class.

class kromatography.model.system.System(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Represents the actual physical chromatography system used in the study.

An actual system is setup with a specific system type, and a specific set of holdup volume and absorbance path length based on the setup.

system_number = Str()

The id for the chromatography system.

abs_path_length = Instance(UnitScalar)

Calibration factor for the UV absorbance results, usually in centimeter.

holdup_volume = Instance(UnitScalar)

The amount of hold-up volume.

system_type = Instance(SystemType)

The type of the chromatography system.

type_id = Constant(SYSTEM_TYPE)

The user visible type-id for the class.

kromatography.model.time_integrator module

class kromatography.model.time_integrator.TimeIntegrator[source]

Bases: traits.has_traits.HasStrictTraits

Represents the properties associated with the time integrator.

abstol = PositiveFloat(1e-08, exclude_low=True)

Absolute tolerance in the solution of the original system

init_step_size = PositiveFloat(1e-06)

Factor which is multiplied by the section length to get initial integrator stepsize (0.0:IDAS default value), see IDAS guide 4.5, 36f.

max_steps = PositiveInt(10000)

Maximum number of timesteps taken by IDAS (0: IDAS default = 500), see IDAS guide 4.5, 36

reltol = PositiveFloat(0.0)

Relative tolerance in the solution of the original system

kromatography.model.transport_model module

class kromatography.model.transport_model.TransportModel(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.base_product_model.BaseProductModel

Base Transport model class.

model_type = Enum(TRANSPORT_MODEL_TYPES)

The type of transport model (e.g. GENERAL_RATE_MODEL) used for the chromatography simulation.

type_id = Constant(TRANSPORT_MODEL_TYPE)

The type of data being represented by this class

class kromatography.model.transport_model.GeneralRateModel(num_comp=None, num_prod_comp=None, **traits)[source]

Bases: kromatography.model.transport_model.TransportModel

General Rate Model transport model.

Note that this general implementation assumes that in addition to the product components, there is an additional cation component that may be modeled by CADET. In the case this is combined with a Langmuir type binding model, the transport parameters for that cation component will be ignored and striped out when passing to CADET since it is not modeled.

column_porosity = PositiveFloatParameter(0.3)

The column porosity

bead_porosity = PositiveFloatParameter(0.5)

The bead/resin porosity

axial_dispersion = PositiveFloatParameter(6e-08)

Axial dispersion coefficient (m2/s)

film_mass_transfer = ParameterArray

A vector with film diffusion coefficients

pore_diffusion = ParameterArray

A vector with particle diffusion coefficients

surface_diffusion = ParameterArray

A vector with particle surface diffusion coefficients

model_type = Constant(GRM_TRANSPORT_MODEL)

The type of transport model.

kromatography.model.weno module

class kromatography.model.weno.Weno[source]

Bases: traits.has_traits.HasStrictTraits

Weno discretization parameters.

boundary_model = Enum([0, 1, 2, 3])

Boundary model type: 0 = Lower WENO order (stable), 1 = Zero weights (unstable for small Dax), 2 = Zero weights for p != 0 (stable?), 3 = Large ghost points (Default: 0) [Range: 0, 1, 2, 3]

weno_eps = PositiveFloat(1e-06)

WENO epsilon (Default: 1.0e-6) [Range: >=0]

weno_order = Enum([1, 2, 3])

WENO Order: 1 = standard upwind scheme, 2, 3; also called WENO K (default: 3) [Range: 1, 2, 3]

kromatography.model.x_y_data module

Chromatography run results contain continuous XY data, performance information, collected into in a ChromatographyResults object.

class kromatography.model.x_y_data.XYData(**traits)[source]

Bases: kromatography.model.chromatography_data.ChromatographyData

Holds a collection of (x, y) data and their metadata.

An instance of this class typically represents a time series data, where x_data, y_data correspond to the time and value axes respectively.

FIXME: it is not clear if all the arrays should be unit arrays ?
  1. sometime we may not have units (log_book etc.)

perhaps just provide properties/methods that return UnitArrays while leaving the underlying data just be arrays ?

x_data = Array(dtype=float)

The data samples for the independant axis (typically time). This is always a float array.

y_data = Array()

The data samples for the dependant axis (e.g. uv280, temperature). This is often a float array but can be string array. For instance, the log_book data for an experiment contains comments from the user/instrument over the duration of the experiment.

x_metadata = Dict

Contains any metadata corresponding to x_data.

y_metadata = Dict

Contains any metadata corresponding to y_data.

type_id = Constant('X-Y Data')

The type-id for this class.

mpl_show(filepath='', **kwargs)[source]

Quick Matplotlib plot of the current data and show/save to file.

Parameters:
  • filepath (str) – Path to the file to export the plot to. Leave empty to show the plot live instead.
  • kwargs (dict) – Extra arguments for the savefig function. See documentation for matplotlib.pyplot.savefig().