bletl Core API

Specifies the base types for parsing and representing BioLector CSV files.

bletl.core.get_parser(filepath: str | Path) BLDParser

Analyzes a raw BioLector file and selects an appropiate parser.

Parameters:
filepathstr or pathlib.Path

Path pointing to the file of interest.

Returns:
parserBLDParser

A parser that can be used for the provided file type.

Raises:
NotImlementedError

When the file contents do not match with a known BioLector refult file format.

bletl.core.parse(filepaths: str | Sequence[str], *, drop_incomplete_cycles: bool = True, lot_number: int | None = None, temp: int | None = None, cal_0: float | None = None, cal_100: float | None = None, phi_min: float | None = None, phi_max: float | None = None, pH_0: float | None = None, dpH: float | None = None) BLData

Parses a raw BioLector CSV file into a BLData object and applies calibration.

Parameters:
filepathsstr or pathlib.Path or iterable

Path pointing to the file(s) of interest. If an iterable is provided, files are concatenated.

drop_incomplete_cyclesbool

If True, incomplete cycles at the end are discarded IMPORTANT: if the file contains only one cycle, it will always be considered “completed”.

lot_numberint or None

Lot number of the microtiter plate used.

temp :int, optional

Temperature to be used for calibration.

cal_0float, optional

Calibration parameter cal_0 or k0 for oxygen saturation measurement.

cal_100float, optional

Calibration parameter cal_100 or k100 for oxygen saturation measurement.

phi_minfloat, optional

Calibration parameter phi_min or irmin for pH measurement.

phi_maxfloat, optional

Calibration parameter phi_max or irmax for pH measurement.

pH_0float, optional

Calibration parameter ph0 for pH measurement.

dpHfloat, optional

Calibration parameter dpH for pH measurement.

Returns:
bldataBLData

Parsed data object.

Raises:
TypeError

When either lot number or temperature, but not both, are None.

NotImplementedError

When the file contents do not match with a known BioLector result file format.

LotInformationError

When no information about the lot can be found.

LotInformationMismatch

When lot information given as parameters is not equal to lot information found in data file.

Specifies the base types for parsing and representing BioLector CSV files.

class bletl.types.BLDParser

Bases: object

Abstract type for parsers that read BioLector CSV files.

Methods

parse(filepath, *[, lot_number, temp, ...])

Parses the provided BioLector CSV file into a data object.

abstract parse(filepath: str | PathLike, *, lot_number: int | None = None, temp: int | None = None, cal_0: float | None = None, cal_100: float | None = None, phi_min: float | None = None, phi_max: float | None = None, pH_0: float | None = None, dpH: float | None = None) BLData

Parses the provided BioLector CSV file into a data object.

If any calibration parameters are passed, all of them must be passed.

Parameters:
filepathstr or pathlib.Path

Path pointing to the file of interest.

lot_numberint or None

Lot number of the microtiter plate used.

temp :int, optional

Temperature to be used for calibration.

cal_0float, optional

Calibration parameter cal_0 or k0 for oxygen saturation measurement.

cal_100float, optional

Calibration parameter cal_100 or k100 for oxygen saturation measurement.

phi_minfloat, optional

Calibration parameter phi_min or irmin for pH measurement.

phi_maxfloat, optional

Calibration parameter phi_max or irmax for pH measurement.

pH_0float, optional

Calibration parameter ph0 for pH measurement.

dpHfloat, optional

Calibration parameter dpH for pH measurement.

class bletl.types.BLData(model: BioLectorModel, environment: DataFrame, filtersets: DataFrame, references: DataFrame, measurements: DataFrame, comments: DataFrame)

Bases: dict

Standardized data type for BioLector data.

Attributes:
comments

User and system comments.

environment

Temperature, humidity etc.

filtersets

Filtersets that were used in this process.

measurements

Well-wise filterset measurements.

model

BioLector model that the dataset was acquired with.

references

Reference measurements that are used for calibration.

wells

Wells that were measured.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

get_narrow_data()

Retrieves data in a narrow format.

get_timeseries(filterset, well, *[, last_cycle])

Retrieves (time, value) for a specific well in a specified filterset.

get_unified_narrow_data([source_well, ...])

Retrieves data with unified time in a narrow format.

items()

keys()

pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

property comments: DataFrame

User and system comments.

property environment: DataFrame

Temperature, humidity etc. measurements.

property filtersets: DataFrame

Filtersets that were used in this process.

get_narrow_data() DataFrame

Retrieves data in a narrow format.

Returns:
narrowpandas.DataFrame

Data in a narrow format.

get_timeseries(filterset: str, well: str, *, last_cycle: int | None = None) Tuple[ndarray, ndarray]

Retrieves (time, value) for a specific well in a specified filterset.

Parameters:
filtersetstr

Name of the filterset to read from.

wellstr

Well id to retrieve.

last_cycleint

Cycle number of the last cycle to be included (defaults to all cycles).

Returns:
xnumpy.ndarray

Timepoints of measurements.

ynumpy.ndarray

Measured values.

get_unified_narrow_data(source_well: str = 'first', source_filterset: str = 'first', *, last_cycles: Dict[str, int] | None = None) DataFrame

Retrieves data with unified time in a narrow format. Each filterset forms a seperate column.

Parameters:
source_wellstr

Either “first”, or the ID of the well from which timestamps are taken.

source_filtersetstr

Either “first”, or the ID of the filterset from which timestamps are taken.

last_cyclesdict, optional

Dictionary of well-wise maximum cycle numbers to retrieve. The cycle numbers in this dictionary will be included.

Returns:
u_narrowpandas.DataFrame

Data with unified time in a narrow format.

Raises:
KeyError

If specified source filterset or well cannot be found.

property measurements: DataFrame

Well-wise filterset measurements.

property model: BioLectorModel

BioLector model that the dataset was acquired with.

property references: DataFrame

Reference measurements that are used for calibration.

property wells: Tuple[str, ...]

Wells that were measured.

class bletl.types.BioLectorModel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enumeration of BioLector Models.

BL1 = 'bl1'
BL2 = 'bl2'
BLPro = 'blpro'
XT = 'blXT'
class bletl.types.FilterTimeSeries(time_df: DataFrame, value_df: DataFrame)

Bases: object

Generalizable data type for calibrated timeseries.

Attributes:
wells

Well IDs that were measured.

Methods

get_timeseries(well, *[, last_cycle])

Retrieves (time, value) for a specific well.

get_unified_dataframe([well])

Retrieves a DataFrame with unified time on index.

get_timeseries(well: str, *, last_cycle: int | None = None) Tuple[ndarray, ndarray]

Retrieves (time, value) for a specific well.

Parameters:
wellstr

Well id to retrieve.

last_cycleint, optional

Cycle number of the last cycle to be included (defaults to all cycles).

Returns:
xnumpy.ndarray

Timepoints of measurements.

ynumpy.ndarray

Measured values.

get_unified_dataframe(well: str | None = None) DataFrame

Retrieves a DataFrame with unified time on index.

Parameters:
wellstr, optional

Well id from which time is taken. If None, the first well is used.

Returns:
unified_dfpandas.DataFrame

Dataframe with unified time on index.

property wells: Tuple[str, ...]

Well IDs that were measured.

class bletl.types.FluidicsSource(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Number that identifies the source of volume changes.

Attributes:
denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

as_integer_ratio(/)

Return integer ratio.

bit_count(/)

Number of ones in the binary representation of the absolute value of self.

bit_length(/)

Number of bits necessary to represent self in binary.

conjugate

Returns self, the complex conjugate of any int.

from_bytes(/, bytes[, byteorder, signed])

Return the integer represented by the given array of bytes.

to_bytes(/[, length, byteorder, signed])

Return an array of bytes representing an integer.

Pipetting = -1

Additions from pipetting.

ReservoirA = 1

Additions from reservoir A.

ReservoirB = 2

Additions from reservoir B.

exception bletl.types.IncompatibleFileError

Bases: Exception

exception bletl.types.InvalidLotNumberError

Bases: Exception

exception bletl.types.LotInformationError

Bases: Exception

exception bletl.types.LotInformationMismatch

Bases: UserWarning

exception bletl.types.LotInformationNotFound

Bases: UserWarning

exception bletl.types.NoMeasurementData

Bases: UserWarning