kromatography.io package

Subpackages

Submodules

kromatography.io.akta_reader module

AKTAReader class and all utilities and entry points to read AKTA files.

These files contain the recorded time series of various quantities like UV (a proxy for concentration), pH, conductivity, .... These timeseries are not necessarily aligned, and each measurement is therefore stored together with the times it was recorded at.

exception kromatography.io.akta_reader.AktaReadError[source]

Bases: exceptions.ValueError

kromatography.io.akta_reader.read_akta(akta_fname, data_type, **header_row_info)[source]

Read the content of an AKTA file (pure ascci or CSV) into an ndarray.

Parameters:
  • akta_fname (str) – File path to the ASCII file to read.
  • data_type (str) – Column type requested (uv, conductivity, ...). Must be present in the reader’s list of available column types.
  • header_info (dict) – Optional arguments about where to find the headers and the data. The following entries can be present:
  • header_row_index (None or int) – Row index at which to read the column types (UV, conductivity, ...). If None, the number will be guessed.
  • unit_row_index (None or int) – Row index at which to read the units for the data. (min, sec, ...). If None, the number will be guessed.
  • data_row_index (None or int) – Row index at which to start reading the data. If None, the number will be guessed.
Returns:

output_data – Dictionary containing numpy arrays with a set of x values and y values. These arrays are assumed to be mapped to keys of the form ‘time_NAME’ and NAME where NAME describes the type of data stored.

Return type:

dict

class kromatography.io.akta_reader.AKTAReader(file_path=None, **traits)[source]

Bases: traits.has_traits.HasStrictTraits

Reader for the AKTA file format.

The reader is a lazy loader and only loads metadata on initialization. The actual data can be requested using the get_data() API method.

Examples

>>> from kromatography.io.akta_reader import AKTAReader
>>> reader = AKTAReader("path/to/file.asc")
>>> reader.header_info
OrderedDict([('uv', {'units': u'mAU', 'dtype': 'float', 'column_index': 3,
              'header_name': u'***', 'name': 'uv'}),
             ('time_uv', {'units': u'min', 'dtype': 'float',
              'column_index': 2, 'header_name': u'**:10_UV2_280nm',
              'name': 'time_uv'}),...])
>>> # No data yet:
>>> reader.data
{}
>>> # Collect all data and return the UV column
>>> reader.get_data("uv")
{'uv': array([  9.50000000e-02,   1.76000000e-01,   ...}
>>> reader.data.keys()
[u'time_concentration',
 u'time_uv',
 u'time_pH',
 u'uv',
 u'time_conductivity',
 u'flow',
 u'time_flow',
 u'concentration',
 u'pH',
 u'conductivity',
 ...]
file_path = Str

The path to the AKTA file.

header_row_index = Either(None, Int(0))

Row index containing column names. If None, value is inferred

header_delimiter = Either(None, Str)

Delimiter for data name fields in file. If None then, fields split on whitespace.

unit_row_index = Either(None, Int(1))

Row index containing units header. If None, value is inferred

unit_delimiter = Either(None, Str)

Delimiter for unit fields in file. If None, fields split on whitespace

data_row_index = Either(None, Int(2))

Row index of first data entry. If None, value is inferred.

data_delimiter = Either(None, Str)

Delimiter for the data fields in the AKTA file. If None, fields split on whitespace

header_info = Instance(OrderedDict)

Map of data types to the metadata associated with column in file.

col_name_patterns = Dict(DATA_NAME_SEARCH_PATTERNS)

Dict mapping expected data types to regex patterns to find them.

data = Dict

The complete and cached dictionary containing all data

time_of_origin = Float(0.0)

Recorded time that should be set as the time origin. Ignored by default.

available_column_types = Property

A list of all columns available in the AKTA file

available_dataset_types = Property

A list of the dataset available (1 col for data and 1 col for time axis)

raise_on_collision = Bool(True)

Raise an exception when 2 column are found to be of the same data type?

get_data(column_names=None)[source]

Extract the data columns specified as a dict of NumPy array.

Note that the dictionary cannot as-is be fed into pd.DataFrame to analyze it because arrays are typically of different length. So a manual merge of this data is required.

Parameters:column_names (str or list(str) [OPTIONAL]) – Name of list of names of columns requested. Leave unset to get all data.
Returns:Returns a dict mapping column names to the corresponding numpy array containing the data found.
Return type:dict
Raises:KeyError – If being request a column that isn’t found in the AKTA file.
collect_all_data()[source]

Collect all available data as described by the file header.

Resulting content is stored as the data attribute.

remove_nan_from_data()[source]

Remove all missing values from datasets found.

reset_akta_data_time_origin()[source]

Reset the time origin to a certain time recoded by the AKTA.

Every data entry that ends up before the new origin is thrown away. Useful to modify the AKTA data when the file contains values before the load step.

kromatography.io.akta_reader.validate_time_of_origin(reader, time)[source]

Returns whether the time provided is listed in logbook’s time array.

Note: if there is no logbook found, the value is always considered valid.

Parameters:
  • reader (AKTAReader) – AKTA reader around the log data to instrospect.
  • time (float or UnitScalar) – Time to search in the log.

kromatography.io.api module

API functions and classes for the Reveal Chromatography IO sub-package.

kromatography.io.base_excel_reader module

Base ExcelReader class - provides API for the data contained in the Excel input file (for a given study) for all versions.

exception kromatography.io.base_excel_reader.ExcelReadError[source]

Bases: exceptions.ValueError

exception kromatography.io.base_excel_reader.StepNotFoundError[source]

Bases: exceptions.ValueError

class kromatography.io.base_excel_reader.BaseExcelReader(file_path=None, **traits)[source]

Bases: traits.has_traits.HasStrictTraits

Base reader for the Reveal input Excel file to build an Experimental study.

file_path = Str

path to excel file

data_source = Instance(DataSource)

Datasource to validate Excel entries against

product = Property(Dict)

Product data, loaded from Datasource

section_labels = Dict

List of labels to search a value for in each section.

general_section_name = Str(GENERAL_SECTION_NAME)

List of labels to search a value for in each section

get_all_data()[source]
print_all_data()[source]

Pretty prints all the data

get_general_data()[source]

Returns dictionary of General Experiment Information data

get_system_data()[source]

Returns dictionary of Chromatography System Information data

get_column_data()[source]

Returns dictionary of Chromatography Column Information data

get_experiment_data()[source]

Returns dictionary of runs with key as their name from the excel.

Includes sections Method Information, Performance Parameters, Fraction Data, and Continuous data from excel file.

kromatography.io.deserializer module

Module containing the deserializer api function and supporting classes.

The deserializers are versioned and the ones in this module correspond to the latest protocol. Because the software’s goal is to be able to run any past file created by users, old versions of deserializers that were updated are stored in the legacy_deserializers.py module.

kromatography.io.deserializer.deserialize(serial_data, array_collection=None)[source]

Functional entry point to deserialize any serial data.

See app_common implementation for details.

class kromatography.io.deserializer.chromatographyDataDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

Base class for deserializing all chromatographyData objects.

get_instance(constructor_data)[source]
class kromatography.io.deserializer.kromatographyTaskDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.kromatographyProjectDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

get_instance(constructor_data)[source]
post_creation_instance_updates(instance)[source]
class kromatography.io.deserializer.bindingModelDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.stericMassActionDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelDeSerializer

class kromatography.io.deserializer.phDependentStericMassActionDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelDeSerializer

class kromatography.io.deserializer.langmuirDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelDeSerializer

class kromatography.io.deserializer.externalLangmuirDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelDeSerializer

class kromatography.io.deserializer.bufferDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.chemicalDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.collectionCriteriaDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.columnDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 2
get_instance(constructor_data)[source]
class kromatography.io.deserializer.columnTypeDeSerializer[source]

Bases: kromatography.io.deserializer.columnDeSerializer

protocol_version = 0
class kromatography.io.deserializer.componentDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.dataSourceDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.inMemoryDataSourceDeSerializer[source]

Bases: kromatography.io.deserializer.dataSourceDeSerializer

protocol_version = 1
class kromatography.io.deserializer.simpleDataSourceDeSerializer[source]

Bases: kromatography.io.deserializer.inMemoryDataSourceDeSerializer

class kromatography.io.deserializer.inStudyDataSourceDeSerializer[source]

Bases: kromatography.io.deserializer.inMemoryDataSourceDeSerializer

class kromatography.io.deserializer.discretizationDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.experimentDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.methodDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.methodStepDeSerializer[source]

Bases: kromatography.io.deserializer.methodDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.deserializer.performanceDataDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.productDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.productComponentDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.resinDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.resultsDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.experimentResultsDeSerializer[source]

Bases: kromatography.io.deserializer.resultsDeSerializer

protocol_version = 2
class kromatography.io.deserializer.simulationResultsDeSerializer[source]

Bases: kromatography.io.deserializer.resultsDeSerializer

class kromatography.io.deserializer.schurSolverDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

instance_collection = {}
get_instance(constructor_data)[source]
class kromatography.io.deserializer.sensitivityDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.simulationDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 2
get_instance(constructor_data)[source]
class kromatography.io.deserializer.lazyLoadingSimulationDeSerializer[source]

Bases: kromatography.io.deserializer.simulationDeSerializer

protocol_version = 1
class kromatography.io.deserializer.simulationGroupDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.deserializer.solutionDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.solutionWithProductDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.solverDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.deserializer.studyDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 2
get_instance(constructor_data)[source]
class kromatography.io.deserializer.studyAnalysisToolsDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.bruteForceOptimizerDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

protocol_version = 2
get_instance(constructor_data)[source]
post_creation_instance_updates(instance)[source]

Once the optimizer is made, update its cost function and steps.

class kromatography.io.deserializer.bruteForce2StepBindingModelOptimizerDeSerializer[source]

Bases: kromatography.io.deserializer.bruteForceOptimizerDeSerializer

protocol_version = 3
get_instance(constructor_data)[source]
class kromatography.io.deserializer.costFunction0DeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.bruteForceOptimizerStepDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

protocol_version = 2
get_instance(constructor_data)[source]
class kromatography.io.deserializer.bindingModelOptimizerStepDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

protocol_version = 1
prepare_constructor_data(constructor_data)[source]
get_instance(constructor_data)[source]
class kromatography.io.deserializer.bruteForceBindingModelOptimizerStepDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelOptimizerStepDeSerializer

protocol_version = 2
class kromatography.io.deserializer.constantBruteForceBindingModelOptimizerStepDeSerializer[source]

Bases: kromatography.io.deserializer.bindingModelOptimizerStepDeSerializer

protocol_version = 1
class kromatography.io.deserializer.parameterScanDescriptionDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.systemDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.systemTypeDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.timeIntegratorDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.transportModelDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.deserializer.generalRateModelDeSerializer[source]

Bases: kromatography.io.deserializer.transportModelDeSerializer

class kromatography.io.deserializer.singleParamSimulationDiffDeSerializer[source]

Bases: app_common.apptools.io.deserializer.deSerializer

build_object(serial_data)[source]
class kromatography.io.deserializer.wenoDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]
class kromatography.io.deserializer.xYDataDeSerializer[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

get_instance(constructor_data)[source]

kromatography.io.excel_reader module

ExcelReader for current version to load data into dictionaries of strings and floats.

Assumptions on Excel file for this version:

Rule1: Major Sections (which are contained in the first column):

  • General Experiment Information
  • Chromatography System Information
  • Chromatography Column Information
  • Load Information
  • Buffer Information
  • Method Information
  • Performance Parameters
  • Fraction Data
  • Continuous Data

Rule2: 2nd column contains data names for given section, which are all assumed to be fixed (later will want to change this for flexibility for user).

Rule3: 4th-xth columns contain data values.

Rule4: Units are not attempted to be read in.

Rule5: If a cell expects a number, then reader fails if it doesn’t find one, but for all other cells, any input is accepted (including no input).

TODO: add unit support.

class kromatography.io.excel_reader.ExcelReader(file_path=None, **traits)[source]

Bases: kromatography.io.base_excel_reader.BaseExcelReader

Reader for the current version of the Excel input file format.

This is the most recent and recommended version of the Reveal input files.

Examples

>>> reader = ExcelReader(file_path="path/to/excel/file.xlsx")
>>> all_data = reader.get_all_data()
get_load_data()[source]

Returns dictionary of loads with key as their name from the excel.

get_buffer_prep_data()[source]

Returns dictionary of buffers with key as their name from the excel.

kromatography.io.excel_reader_selector module

Class to select and create the appropriate ExcelReader for an Excel input file for Reveal Chromatography.

class kromatography.io.excel_reader_selector.ExcelInputReaderSelector[source]

Bases: traits.has_traits.HasStrictTraits

Class to identify Excel input version & build appropriate ExcelReader.

filepath = Str

Path to the xls or xlsx file to analyze

build_excel_reader(**traits)[source]
select_excel_reader_klass()[source]

Pre-load an Excel input file to determine which ExcelReader to use to read the data.

get_excel_input_version()[source]

Returns the version number of an Excel input file to Reveal.

kromatography.io.excel_reader_v1 module

This module contains the DEPRECATED reader for the first version of the Excel input file for Reveal. Refer to excel_reader for the reader for the most recent format.

class kromatography.io.excel_reader_v1.ExcelReaderV1(file_path=None, **traits)[source]

Bases: kromatography.io.base_excel_reader.BaseExcelReader

Reader for version 1 of the Excel input file format (DEPRECATED).

get_load_data()[source]

Returns dictionary of loads with key as their name from the excel.

get_buffer_prep_data()[source]

Returns dictionary of buffers with key as their name from the excel.

kromatography.io.experiment_builder_utils module

kromatography.io.experiment_builder_utils.continuous_data_from_akta(import_settings, target_experiment)[source]

Utility to load/transform AKTA data from settings dict, and target exp.

Parameters:
  • import_settings (dict) – AKTA file import settings.
  • target_experiment (Experiment) – Target experiment for which AKTA file contains data. Used to shift the data by the hold up volume.
Returns:

Dict mapping data type to XYData storing traces.

Return type:

dict

kromatography.io.experiment_builder_utils.shift_continuous_data_by_holdup_vol(cont_data, target_experiment)[source]

Shift all continuous and fraction data to remove holdup_volume. This is necessary when trying to compare experiments and simulations, because simulations don’t assume any piping before and after the chromatography column.

kromatography.io.experiment_builder_utils.shift_fraction_data_by_holdup_vol(fraction_data, target_experiment)[source]

Shift all continuous and fraction data to remove holdup_volume. This is necessary when trying to compare experiments and simulations, because simulations don’t assume any piping before and after the chromatography column.

kromatography.io.experiment_builder_utils.compute_time_offset_from_holdup_volume(target_experiment, tgt_units='min')[source]

Compute the time offset to apply to result data from system and column info.

Returns:Time offset in tgt_units.
Return type:UnitScalar

kromatography.io.experimental_study_builder module

This class builds a Study model from user inputs (Excel file) and a catalog of standard/pre-configured data.

class kromatography.io.experimental_study_builder.ExperimentalStudyBuilder[source]

Bases: traits.has_traits.HasStrictTraits

Builds an ExperimentalStudy from an Excel file and a Datasource.

input_file = Str

Path to input file to build the study from

data_source = Instance(DataSource)

The object providing access to known/stored Chromatography data.

excel_reader = Instance(BaseExcelReader)

The object providing access to known/stored Chromatography data.

excel_data = Dict

The raw data loaded from the Excel file

product = Instance(Product)

The product studied in the experimental study

system = Instance(System)

The system found in the experimental study

column = Instance(Column)

The column found in the experimental study

buffers = Dict(Str, Instance(Solution))

All buffers found in the experimental study

loads = Dict(Str, Instance(Solution))

All loads found in the experimental study

solutions = Dict(Str, Instance(Solution))

All solutions found in the experimental study

experiments = Dict(Str, Experiment)

Dict of experiments loaded

study = Instance(ExperimentalStudy)

Output study generated

allow_akta_gui = Bool(True)

Prompt the user to control settings AKTA files must be parsed with?

read_excel_data()[source]
build_study()[source]

Returns a complete Study model from all the ExcelReader data.

Returns:If the load is successful, the returned value is the experimental study built from Excel file components.
Return type:ExperimentalStudy
Raises:ExcelReadError – Raised when any part of the study fails to load.

kromatography.io.i_solver module

class kromatography.io.i_solver.ISolver[source]

Bases: traits.has_traits.Interface

run()[source]

Returns a simulation object after a calling the solver and updating the simulation

kromatography.io.legacy_deserializers module

Storage of the legacy deserializers to guaranty that any old project created in the wild can be read in the future.

kromatography.io.legacy_deserializers.rename_cost_data_df(kwargs)[source]

Rename the ALL_COST cost_data column to the new name for optimizer steps created before version 0.10.2

class kromatography.io.legacy_deserializers.unitArrayDeSerializer0[source]

Bases: app_common.apptools.io.deserializer.unitScalarDeSerializer

protocol_version = 0
class kromatography.io.legacy_deserializers.ndarrayDeSerializer0[source]

Bases: app_common.apptools.io.deserializer.deSerializer

Deserializer for arrays when their id was stored with id_ and the result of the id operation instead of a unique uuid with no prefix.

protocol_version = 0
build_object(serial_data)[source]
class kromatography.io.legacy_deserializers.dataFrameDeSerializer0[source]

Bases: app_common.apptools.io.deserializer.deSerializer

protocol_version = 0
build_object(serial_data)[source]
class kromatography.io.legacy_deserializers.simulationDeSerializer1[source]

Bases: kromatography.io.deserializer.simulationDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.lazyLoadingSimulationDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.simulationDeSerializer1

protocol_version = 0
class kromatography.io.legacy_deserializers.simulationDeSerializer0[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
rebuild_method(sim)[source]

Return a fully formed method from source experiment.

class kromatography.io.legacy_deserializers.methodStepDeSerializer0[source]

Bases: kromatography.io.deserializer.methodDeSerializer

Method serializer before solutions defaulted to an empty list when not specified.

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.simulationGroupDeSerializer0[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

Deserializer at or before release 0.5.3, when simulation groups didn’t store the simulation diffs and stored its data with each simulation along a column.

protocol_version = 0
get_instance(constructor_data)[source]
transpose_group_data(constructor_data)[source]
class kromatography.io.legacy_deserializers.bindingModelCostFunction0DeSerializer0[source]

Bases: kromatography.io.deserializer.costFunction0DeSerializer

Deserializer needed for projects saved before Oct 1st 2016, when the cost function was called bindingModelCostFunction0. Therefore, this class has nothing to do other than exist with the correct name.

protocol_version = 0
class kromatography.io.legacy_deserializers.constantBruteForceBindingModelOptimizerStepDeSerializer0[source]

Bases: kromatography.io.deserializer.constantBruteForceBindingModelOptimizerStepDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.constantBindingModelOptimizerStepDeSerializer0[source]

Bases: app_common.apptools.io.deserializer.deSerializer

This is for binding model optimizer steps where the transport and binding models are stored instead of the full starting point simulation.

protocol_version = 0
prepare_constructor_data(constructor_data)[source]
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForceBindingModelOptimizerStepDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.constantBindingModelOptimizerStepDeSerializer0

class kromatography.io.legacy_deserializers.bruteForceBindingModelOptimizerStepDeSerializer1[source]

Bases: kromatography.io.deserializer.bruteForceBindingModelOptimizerStepDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForceOptimizerDeSerializer0[source]

Bases: kromatography.io.deserializer.bruteForceOptimizerDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForceOptimizerDeSerializer1[source]

Bases: kromatography.io.deserializer.bruteForceOptimizerDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForceOptimizerStepDeSerializer1[source]

Bases: kromatography.io.deserializer.bruteForceOptimizerStepDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForceOptimizerStepDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.bruteForceOptimizerStepDeSerializer1

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForce2StepBindingModelOptimizerDeSerializer2[source]

Bases: kromatography.io.deserializer.bruteForce2StepBindingModelOptimizerDeSerializer

protocol_version = 2
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForce2StepBindingModelOptimizerDeSerializer1[source]

Bases: kromatography.io.deserializer.bruteForce2StepBindingModelOptimizerDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.bruteForce2StepBindingModelOptimizerDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.bruteForce2StepBindingModelOptimizerDeSerializer1

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.experimentResultsDeSerializer0[source]

Bases: kromatography.io.deserializer.experimentResultsDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.experimentResultsDeSerializer1[source]

Bases: kromatography.io.deserializer.experimentResultsDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.simpleDataSourceDeSerializer0[source]

Bases: kromatography.io.deserializer.simpleDataSourceDeSerializer

This is only needed for deserializing the very first set of files v0, where the simpleDataSource was serialized with its data_catalog.

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.studyDeSerializer1[source]

Bases: kromatography.io.deserializer.studyDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.studyDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.studyDeSerializer1

protocol_version = 0
get_instance(constructor_data)[source]
update_target_products_in_datasource(instance)[source]

Until this version, the binding and transport models were not created with a binding and transport model. Since we will allow copying them into the user DS, their target_product attr need to be set.

class kromatography.io.legacy_deserializers.columnDeSerializer1[source]

Bases: kromatography.io.deserializer.columnDeSerializer

protocol_version = 1
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.columnDeSerializer0[source]

Bases: kromatography.io.legacy_deserializers.columnDeSerializer1

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.transportModelDeSerializer0[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.inStudyDataSourceDeSerializer0[source]

Bases: kromatography.io.deserializer.chromatographyDataDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]
class kromatography.io.legacy_deserializers.solverDeSerializer0[source]

Bases: kromatography.io.deserializer.solverDeSerializer

protocol_version = 0
get_instance(constructor_data)[source]

kromatography.io.reader_writer module

kromatography.io.reader_writer.save_object(filepath, object_to_save)[source]

Stores any object into a project file (.chrom).

Parameters:
  • filepath (str) – Absolute or relative path to the file to load.
  • object_to_save (any) – Object to save. It is expected to be a subclass of HasTraits.
kromatography.io.reader_writer.load_object(filepath)[source]

Load object from project file (.chrom).

Parameters:filepath (str) – Absolute or relative path to the file to load.
Returns:The object found in the file, and whether or not at least 1 legacy deserializer was used.
Return type:any, bool

kromatography.io.serializer module

Module with the serialization api function and supporting classes. The goal is to store a REVEAL project. The implementation relies on a recursive class which selects the serializer needed based on the type of the object and splits the object content into a dictionary of data and a dictionary of numpy arrays. The first data can be dumped into a json file. The dictionary of data can be dumped into an HDF5 file.

These serializers are versioned: as soon as the content of either dictionary gets modified for an object type, the serializer’s protocol gets bumped up 1 unit and that defines the new standard. The software will (try to) guaranty that any file can be loaded, but a project can only be written into the latest protocol.

FIXME: Move all specific implementations of the Serializer class to other modules.

kromatography.io.serializer.serialize(obj, array_collection=None)[source]

Serialization functional entry point.

Parameters:
  • obj (any) – Object to serialize
  • array_collection (dict) – Dictionary mapping all numpy arrays stored to an id in the serial data.
class kromatography.io.serializer.ChromatographyData_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

get_serial_data(obj)[source]
class kromatography.io.serializer.KromatographyTask_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

get_serial_data(obj)[source]
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.KromatographyProject_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

get_serial_data(obj)[source]
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.BindingModel_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.StericMassAction_Serializer[source]

Bases: kromatography.io.serializer.BindingModel_Serializer

class kromatography.io.serializer.PhDependentStericMassAction_Serializer[source]

Bases: kromatography.io.serializer.BindingModel_Serializer

class kromatography.io.serializer.Langmuir_Serializer[source]

Bases: kromatography.io.serializer.BindingModel_Serializer

class kromatography.io.serializer.ExternalLangmuir_Serializer[source]

Bases: kromatography.io.serializer.BindingModel_Serializer

class kromatography.io.serializer.Buffer_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Chemical_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.CollectionCriteria_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Column_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

protocol_version = 2
class kromatography.io.serializer.ColumnType_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Component_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.DataSource_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.InMemoryDatasource_Serializer[source]

Bases: kromatography.io.serializer.DataSource_Serializer

protocol_version = 1
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.InStudyDataSource_Serializer[source]

Bases: kromatography.io.serializer.InMemoryDatasource_Serializer

class kromatography.io.serializer.SimpleDataSource_Serializer[source]

Bases: kromatography.io.serializer.InMemoryDatasource_Serializer

class kromatography.io.serializer.Discretization_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Experiment_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Method_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.MethodStep_Serializer[source]

Bases: kromatography.io.serializer.Method_Serializer

protocol_version = 1
class kromatography.io.serializer.PerformanceData_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Product_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.ProductComponent_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Resin_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Results_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.ExperimentResults_Serializer[source]

Bases: kromatography.io.serializer.Results_Serializer

protocol_version = 2
class kromatography.io.serializer.SimulationResults_Serializer[source]

Bases: kromatography.io.serializer.Results_Serializer

class kromatography.io.serializer.SchurSolver_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Sensitivity_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Simulation_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

protocol_version = 2
class kromatography.io.serializer.LazyLoadingSimulation_Serializer[source]

Bases: kromatography.io.serializer.Simulation_Serializer

Lazy sims don’t store their outputs.

protocol_version = 1
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.SimulationGroup_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

protocol_version = 1
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.Solution_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.SolutionWithProduct_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.Solver_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

protocol_version = 1
class kromatography.io.serializer.Study_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

protocol_version = 2
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.StudyAnalysisTools_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.BruteForceOptimizer_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

protocol_version = 2
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.BruteForce2StepBindingModelOptimizer_Serializer[source]

Bases: kromatography.io.serializer.BruteForceOptimizer_Serializer

protocol_version = 3
attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.BruteForceOptimizerStep_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

protocol_version = 2
attr_names_to_serialize(obj)[source]

Attributes to store.

Skipping properties that can be reconstructed, simulations and attributes that are common to all steps and that are stored on the optimizer (cost_function_type, transport_model, target_experiments).

class kromatography.io.serializer.ParameterScanDescription_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.ConstantBruteForceBindingModelOptimizerStep_Serializer[source]

Bases: kromatography.io.serializer.BruteForceOptimizerStep_Serializer

protocol_version = 1
class kromatography.io.serializer.BruteForceBindingModelOptimizerStep_Serializer[source]

Bases: kromatography.io.serializer.BruteForceOptimizerStep_Serializer

protocol_version = 2
class kromatography.io.serializer.CostFunction0_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

attr_names_to_serialize(obj)[source]
class kromatography.io.serializer.System_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.SystemType_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.TimeIntegrator_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.TransportModel_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

protocol_version = 1
get_serial_data(obj)[source]
class kromatography.io.serializer.GeneralRateModel_Serializer[source]

Bases: kromatography.io.serializer.TransportModel_Serializer

class kromatography.io.serializer.SingleParamSimulationDiff_Serializer[source]

Bases: app_common.apptools.io.serializer.Serializer

get_serial_data(obj)[source]
get_data(obj)[source]
class kromatography.io.serializer.Weno_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

class kromatography.io.serializer.XYData_Serializer[source]

Bases: kromatography.io.serializer.ChromatographyData_Serializer

kromatography.io.simulation_updater module

kromatography.io.simulation_updater.update_simulation_results(simulation, output_fname=None)[source]

Load simulation results from output_fname and update simulation.

Parameters:
  • simulation (Simulation) – The simulation object to update.
  • output_fname (str [OPTIONAL]) – The CADET output h5 file path to update the simulation from. If not provided, the filepath is retrieved from the simulation object.
kromatography.io.simulation_updater.build_simulation_results(simulation, output_fname)[source]

Load simulation results from output_fname and update simulation.

Parameters:
  • simulation (Instance(Simulation)) – The simulation object.
  • output_fname (str (file path)) – The CADET output h5 file path.
kromatography.io.simulation_updater.read_continuous_data_from_cadet_h5(output_fname, product, step_names)[source]

Returns a dictionary of output data found in the provided.

Parameters:
  • output_fname (str) – Path to the HDF5 file produced by CADET.
  • product (Product) – Product this file is modeling.
  • step_names (list(str)) – List of the step/section names.

kromatography.io.study module

IO interfaces to load datasets and objects.

kromatography.io.study.load_exp_study_from_excel(filepath, datasource=None, allow_gui=True)[source]

Returns an ExperimentalStudy from an Excel file.

Parameters:
  • filepath (str) – Path to the Excel file where the study data is stored.
  • datasource (Instance(DataSource) [OPTIONAL]) – Database-like object to pull standard values for all parameters based on selection from Excel file. If not provided, the default datasource will be loaded.
  • allow_gui (bool) – Whether AKTA reader can prompt user for settings. Set to False when running tests.
kromatography.io.study.load_study_from_excel(filepath, datasource=None, allow_gui=True)[source]

Returns an Study from an Excel file.

Parameters:
  • filepath (str) – Path to the Excel file where the study data is stored.
  • datasource (Instance(DataSource) [OPTIONAL]) – Database-like object to pull standard values for all parameters based on selection from Excel file. If not provided, the default datasource will be loaded.
  • allow_gui (bool) – Whether AKTA reader can prompt user for settings. Set to False when running tests.
kromatography.io.study.load_sim_from_study(study_filepath, sim_name)[source]

Load a simulation from a project file.

Parameters:
  • study_filepath (str) – Path to the study file (containing a KromatographyTask).
  • sim_name (str) – Name of the simulation to extract.
kromatography.io.study.load_study_from_project_file(filepath, with_user_data=True)[source]

Returns the study contained in a project file (.chrom).

Parameters:
  • filepath (str) – Absolute or relative path to the file to load.
  • with_user_data (bool [OPTIONAL]) – Set the loaded study’s user data from default user data? Defaults to True.
kromatography.io.study.save_study_to_project_file(filepath, study)[source]

Returns the study contained in a project file (.chrom).

Parameters:
  • filepath (str) – Absolute or relative path to the file to save the project to.
  • study (Study) – Study to save.

kromatography.io.task module

kromatography.io.task.load_project(filepath)[source]

Load a project (KromatographyTask to be precise) from a project file.

Parameters:filepath (str) – Path to the file to load the object from.

Examples

>>> task = load_project(r"path      o       est.chrom")
>>> study = task.project.study
<WORK WITH THE STUDY...>
kromatography.io.task.save_project(filepath, task)[source]

Store a project (KromatographyTask to be precise) into a project file.

Examples

>>> task = load_project(r"path      o       est.chrom")
>>> study = task.project.study
<MODIFY THE TASK OR STUDY...>
>>> save_project("new_project.chrom", task)