aghplctools package

aghplctools.batch module

aghplctools.config module

aghplctools.data_types module

class aghplctools.data_types.DADSignal(wavelength: Union[float, unithandler.base.UnitFloat], bandwidth: Union[float, unithandler.base.UnitFloat] = 1.0, reference: Union[DADSignal, aghplctools.data_types.DADSignalInfo, str] = None, name: str = None, spectrum: aghplctools.data_types.DADSpectrum = None)

Bases: aghplctools.data_types.DADSignalInfo

Class describing a DAD signal and its data.

Parameters:
  • wavelength – wavelength for the signal
  • bandwidth – band width for the wavelength (signal is centered on the wavelength with this width)
  • reference – reference information for the signal
  • name – convenience name for the signal
  • spectrum – a DADSpectrum object which will be referenced for retrieving data.
as_data_table() → list

Returns the signal as a list-style data table with appropriate headers and data

Returns:data table
as_iterable_data_table()

Returns an iterable which yields a data table with appropriate headers and data

Returns:data table as iterable
band_string

A string representation of the band specified (e.g. “210 (4) nm”)

bandwidth

band width for the signal band

classmethod create_from_DADSignalInfo(obj: aghplctools.data_types.DADSignalInfo, spectrum: aghplctools.data_types.DADSpectrum) → aghplctools.data_types.DADSignal

generates a DADSignal object from a DADSignalInfo object and a spectrum

mean_referenced_intensities

mean referenced band (mean unreferenced intensities minus the mean intensities of the reference)

mean_unreferenced_intensities

mean unreferenced intensities for the band

reference

reference band for the signal band

retention_times

retention times associated with the intensity array

unreferenced_intensities

unreferenced intensities for the band

wavelength

wavelength for the signal

write_signal_to_csv(filename: str) → str

Writes the signal intensities to the specified csv file.

Parameters:filename – file name to write to
Returns:file path that was written
class aghplctools.data_types.DADSignalInfo(wavelength: Union[float, unithandler.base.UnitFloat], bandwidth: Union[float, unithandler.base.UnitFloat] = 1.0, reference: Union[DADSignalInfo, str] = None, name: str = None)

Bases: object

Class describing a DAD signal and its parameters

Parameters:
  • wavelength – wavelength for the signal
  • bandwidth – band width for the wavelength (signal is centered on the wavelength with this width)
  • reference – reference information for the signal
  • name – convenience name for the signal
DEFAULT_TIME_UNIT = 'min'
DEFAULT_WAVELENGTH_UNIT = 'nm'
agilent_specification_string

the specification string describing this instance (can be passed to create_from_string to reinstantiate)

bandwidth

bandwidth for the signal band

classmethod create_from_agilent_string(string: str, name_override: str = None) → aghplctools.data_types.DADSignalInfo

Creates a class instance from a standard Agilent signal description string (e.g. ‘DAD1 A, Sig=210,4 Ref=360,100’)

Parameters:
  • string – signal description string
  • name_override – override for name specification
Returns:

DADSignal object

classmethod get_values_from_agilent_string(string: str) → dict

Parses a standard Agilent signal description string (e.g. ‘DAD1 A, Sig=210,4 Ref=360,100’) and returns a dictionary of parsed values (can be used to instantiate a DADSignalInfo instance).

Parameters:string – signal description string
Returns:dictionary of parameters
reference

Reference band for the signal band

wavelength

Wavelength for the signal

class aghplctools.data_types.DADSpectrum(filename=None, ftype=None, data=None)

Bases: aston.tracefile.agilent_uv.AgilentCSDAD2

An object describing an Agilent DAD spectrum for a sample. Inherits Aston AgilentCSDAD2 and has additional methods for retrieving band information.

Parameters:
  • filename – target filetype
  • ftype
  • data
classmethod create_from_D_file(file_path: Union[pathlib.Path, str]) → aghplctools.data_types.DADSpectrum

Creates a DADSpectrum instance from an Agilent .D file

Parameters:file_path – path to .D sample file
Returns:interpreted .D file with metadata and loaded UV data
get_band_intensities(wavelength: float, bandwidth: float = 1.0) → numpy.ndarray

Retrieve array of values described by the wavelength and band width described. The returned array will have shape [wavelength, retention time]. The corresponding wavelengths are given by DADSpectrum.get_band_wavelengths and the retention times by DADSpectrum.retention_times.

Parameters:
  • wavelength – wavelength
  • bandwidth – band width
Returns:

array of band intensities

get_band_mean_intensity(wavelength: float, bandwidth: float = 1.0) → numpy.ndarray

Retrieve the intensity array described by the wavelength and bandwidth described. The returned array will be the mean of the intensities in the band (wavelength - bandwidth / 2, wavelength + bandwidth / 2).

Parameters:
  • wavelength – wavelength
  • bandwidth – band width
Returns:

array of mean intensities

get_band_wavelengths(wavelength: float, bandwidth: float = 1.0) → list

Returns a list of wavelengths corresponding to the band specified.

Parameters:
  • wavelength – wavelength
  • bandwidth – band width
Returns:

get_intensities_from_signal(signal: aghplctools.data_types.DADSignalInfo) → numpy.ndarray

Retrieve the intensity array described by the DADSignalInfo object.

Parameters:signal – signal descriptor
Returns:array of mean intensities
maximum_wavelength_array

Array of the wavelengths for the maximum intensity at each retention time

retention_times

retention times corresponding to the data array (min)

total_absorbance_chromatogram

The total absorbance chromatogram for the spectrum (sum of all intensities for each retention time)

wavelengths

list of wavelengths for the DAD

write_to_allotrope(filename: str)
class aghplctools.data_types.HPLCSample(sample_name: str, datetimestamp: Union[str, datetime.datetime], method_name: str, signals: Union[List[aghplctools.data_types.DADSignalInfo], List[aghplctools.data_types.DADSignal], List[str]], spectrum: aghplctools.data_types.DADSpectrum = None, directory: str = None)

Bases: aghplctools.data_types.HPLCSampleInfo

Data class for describing an HPLC sample containing metadata and spectral data.

Parameters:
  • sample_name – name for sample
  • datetimestamp – date and time stamp for when the sample was run
  • method_name – name of method used to run the sample
  • signals – list of signals associated with the run
  • spectrum – DADSpectrum object with loaded data
  • directory – directory path where the sample may be found
add_signal(new_signal: Union[aghplctools.data_types.DADSignalInfo, dict, str]) → aghplctools.data_types.DADSignal

Adds a new signal to the HPLCSample instance.

Parameters:new_signal – new signal to add. Supported inputs are Agilent specification strings (e.g. ‘DAD1 A, Sig=210,4 Ref=360,100’) DADSignalInfo objects or a dictionary of keyword arguments for instantiating the same.
Returns:the created signal
classmethod create_from_D_file(file_path: Union[pathlib.Path, str]) → aghplctools.data_types.HPLCSample

Creates an HPLCSample instance from a .D file.

Parameters:file_path – file path to Agilent .D folder
Returns:instantiated HPLCSample with loaded data
classmethod create_from_acaml(acaml: Union[str, xml.etree.ElementTree.ElementTree]) → aghplctools.data_types.HPLCSampleInfo

not supported for HPLCSample class

write_signals_to_csv(directory: Union[str, pathlib.Path] = None) → List[str]

Writes the signals to csv in the directory specified. If no directory is specified, the csv files will be written to the directory path specified in the directory attribute of the instance.

Parameters:directory – directory path
write_signals_to_xlsx(output_file: str = None) → str

Writes the signals to a single excel file.

Parameters:output_file – target file. If this is not specified
Returns:path to the written file
class aghplctools.data_types.HPLCSampleInfo(sample_name: str, datetimestamp: Union[str, datetime.datetime], method_name: str, signals: Union[List[aghplctools.data_types.DADSignalInfo], List[str]])

Bases: object

Data class for describing an HPLC sample.

Parameters:
  • sample_name – name for sample
  • datetimestamp – date and time stamp for when the sample was run
  • method_name – name of method used to run the sample
  • signals – list of signals associated with the run
as_dict() → dict

Returns the sample data as a dictionary

classmethod create_from_acaml(acaml: Union[str, xml.etree.ElementTree.ElementTree]) → aghplctools.data_types.HPLCSampleInfo

Creates sample structure from an acaml file. (use sequence.acam_ in the desired .D folder)

Parameters:acaml – path to acaml file or parsed element tree root
Returns:parsed Sample instance
date

date which the sample was run on

classmethod get_values_from_acaml(acaml: Union[str, pathlib.Path, xml.etree.ElementTree.ElementTree]) → dict

Gets relevant values from an acaml file. (use sequence.acam_ in the desired .D folder)

Parameters:acaml – path to acaml file or parsed element tree root
Returns:dictionary of values of interest
timestamp

Time of the day when the sample was run

aghplctools.data_types.strptime_agilent_dt(dt_string: str) → datetime.datetime

Performs strptime on Agilent datetime string

Parameters:dt_string – agilent datetime strings
Returns:parsed datetime object

aghplctools.hplc module

aghplctools.indirect module