clophfit.prtecan.parsers ======================== .. py:module:: clophfit.prtecan.parsers .. autoapi-nested-parse:: Prtecan/prtecan.py. Classes ------- .. autoapisummary:: clophfit.prtecan.parsers.Metadata Functions --------- .. autoapisummary:: clophfit.prtecan.parsers.extract_metadata clophfit.prtecan.parsers.merge_md clophfit.prtecan.parsers.calculate_conc clophfit.prtecan.parsers.dilution_correction Module Contents --------------- .. py:class:: Metadata Represents the value of a metadata dictionary. :param value: The value for the dictionary key. :type value: int | str | float | None .. py:attribute:: unit :type: collections.abc.Sequence[str | float | int] | None :value: None The first element represents the unit, while the following elements are only listed. .. py:function:: 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]). :param lines: Lines (list_of_lines) that are a list of fields, typically from a csv/xls file. :type lines: list[list[str | int | float]] :returns: Metadata for Tecanfile or Labelblock. :rtype: dict[str, Metadata] .. rubric:: 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' .. py:function:: merge_md(mds) Merge a list of metadata dict if the key value is the same in the list. .. py:function:: calculate_conc(additions, conc_stock, conc_ini = 0.0) Calculate concentration values. additions[0]=vol_ini; Stock concentration is a parameter. :param additions: Initial volume and all subsequent additions. :type additions: Sequence[float] :param conc_stock: Concentration of the stock used for additions. :type conc_stock: float :param conc_ini: Initial concentration (default=0). :type conc_ini: float :returns: Concentrations as vector. :rtype: ArrayF .. py:function:: dilution_correction(additions) Apply dilution correction. :param additions: List of initial volume (index=0) followed by all additions. :type additions: list[float] :returns: Dilution correction vector. :rtype: ArrayF :raises ValueError: If additions list is empty or if initial volume is zero.