clophfit.prenspire#

Parse EnSpire files and optionally build titrations using a note file.

Exceptions:

CsvLineError

Exception raised when the lines list has issues.

ManyLinesFoundError

Raised when there are multiple lines containing a specified search string.

Classes:

EnspireFile(file[, verbose])

Read an EnSpire-generated csv file.

Note(fpath[, verbose])

Read and processes a Note csv file.

Functions:

verbose_print(verbose)

Return print function when verbose output is True.

exception clophfit.prenspire.CsvLineError#

Exception raised when the lines list has issues.

class clophfit.prenspire.EnspireFile(file, verbose=0)#

Read an EnSpire-generated csv file.

Read the files and check the formats. extract_measurements(): create the measurements dictionary structure storing all data and metadata (description of measurement).

Parameters:
  • file (Path) – Path to the EnSpire csv file

  • verbose (int) – Level of verbosity; 0 is silent, higher values are more verbose (default=0).

Raises:

Exception – If unexpected format is found.

Examples

>>> from clophfit.prenspire import EnspireFile
>>> from pathlib import Path
>>> ef = EnspireFile(Path("tests/EnSpire/h148g-spettroC.csv"), verbose=0)
>>> ef.measurements["A"]["lambda"][2]
274.0

Attributes:

file

verbose

metadata

General metadata.

measurements

Spectra and metadata for each label, such as "MeasB".

wells

List of exported wells.

Methods:

export_measurements([out_dir])

Save measurements, metadata and plots into out_dir.

file: Path#
verbose: int = 0#
metadata: dict[str, str | list[str]]#

General metadata.

measurements: dict[str, Any]#

Spectra and metadata for each label, such as “MeasB”.

wells: list[str]#

List of exported wells.

export_measurements(out_dir=PosixPath('Meas-0.12.0'))#

Save measurements, metadata and plots into out_dir.

Return type:

None

Parameters:

out_dir (Path)

exception clophfit.prenspire.ManyLinesFoundError#

Raised when there are multiple lines containing a specified search string.

class clophfit.prenspire.Note(fpath, verbose=0)#

Read and processes a Note csv file.

This class is responsible for handling Experimental Note files that describe an EnSpire experiment collecting spectrum.

Parameters:
  • fpath (Path) – The path to the Experimental Note file to be processed.

  • verbose (int) – Level of verbosity; 0 is silent, higher values are more verbose (default=0).

Example

>>> from clophfit.prenspire import Note
>>> n = Note("tests/EnSpire/h148g-spettroC-nota.csv")
>>> n.wells[2]
'A03'

Attributes:

fpath

verbose

wells

A list of wells generated from the note file.

titrations

A list of titrations extracted from the note file.

Methods:

build_titrations(ef)

Extract titrations from the given ef (_note file like: <well, pH, Cl>).

fpath: Path#
verbose: int = 0#
wells: list[str]#

A list of wells generated from the note file.

titrations: dict[Any, Any]#

A list of titrations extracted from the note file.

build_titrations(ef)#

Extract titrations from the given ef (_note file like: <well, pH, Cl>).

Return type:

None

Parameters:

ef (EnspireFile)

clophfit.prenspire.verbose_print(verbose)#

Return print function when verbose output is True.

Return type:

BuiltinMethodType | Callable[..., None]

Parameters:

verbose (int)