clophfit.prtecan.parsers#
Prtecan/prtecan.py.
Classes#
Represents the value of a metadata dictionary. |
Functions#
|
Extract metadata into both Tecanfile and Labelblock. |
|
Merge a list of metadata dict if the key value is the same in the list. |
|
Calculate concentration values. |
|
Apply dilution correction. |
Module Contents#
- class clophfit.prtecan.parsers.Metadata#
Represents the value of a metadata dictionary.
- Parameters:
value (int | str | float | None) – The value for the dictionary key.
- unit: collections.abc.Sequence[str | float | int] | None = None#
The first element represents the unit, while the following elements are only listed.
- clophfit.prtecan.parsers.extract_metadata(lines)#
Extract metadata into both Tecanfile and Labelblock.
From a list of stripped lines takes the first field as the key of the metadata dictionary, remaining fields goes into a list of values with the exception of Label ([str]) and Temperature ([float]).
- Parameters:
lines (list[list[str | int | float]]) – Lines (list_of_lines) that are a list of fields, typically from a csv/xls file.
- Returns:
Metadata for Tecanfile or Labelblock.
- Return type:
dict[str, Metadata]
Examples
>>> lines = [ ... ["Shaking (Linear) Amplitude:", "", "", "", 2, "mm", "", "", "", "", ""] ... ] >>> extract_metadata(lines) {'Shaking (Linear) Amplitude:': Metadata(value=2, unit=['mm'])}
>>> lines = [["", "Temperature: 26 °C", "", "", "", "", "", "", "", "", ""]] >>> extract_metadata(lines) {'Temperature': Metadata(value=26.0, unit=['°C'])}
>>> lines = [["Excitation Wavelength", "", "", "", 400, "nm", "", "", "", "", ""]] >>> extract_metadata(lines) {'Excitation Wavelength': Metadata(value=400, unit=['nm'])}
>>> lines = [["Label: Label1", "", "", "", "", "", "", "", "", "", "", "", ""]] >>> extract_metadata(lines) {'Label': Metadata(value='Label1', unit=None)}
>>> lines = [["Mode", "", "", "", "Fluorescence Top Reading", "", "", "", "", ""]] >>> extract_metadata(lines)["Mode"].value 'Fluorescence Top Reading'
- clophfit.prtecan.parsers.merge_md(mds)#
Merge a list of metadata dict if the key value is the same in the list.
- clophfit.prtecan.parsers.calculate_conc(additions, conc_stock, conc_ini=0.0)#
Calculate concentration values.
additions[0]=vol_ini; Stock concentration is a parameter.
- Parameters:
additions (Sequence[float]) – Initial volume and all subsequent additions.
conc_stock (float) – Concentration of the stock used for additions.
conc_ini (float) – Initial concentration (default=0).
- Returns:
Concentrations as vector.
- Return type:
ArrayF
- clophfit.prtecan.parsers.dilution_correction(additions)#
Apply dilution correction.
- Parameters:
additions (list[float]) – List of initial volume (index=0) followed by all additions.
- Returns:
Dilution correction vector.
- Return type:
ArrayF
- Raises:
ValueError – If additions list is empty or if initial volume is zero.