nexusLIMS.instruments#

Methods and representations for instruments in a NexusLIMS system.

ivar instrument_db:

A dictionary of Instrument objects.

Each object in this dictionary represents an instrument detected in the NexusLIMS remote database.

vartype instrument_db:

dict

Module Contents#

Functions#

get_instr_from_filepath

Get an instrument object by a given path Using the NexusLIMS database.

get_instr_from_calendar_name

Get an instrument object from the NexusLIMS database by its calendar name.

get_instr_from_api_url

Get an instrument object from the NexusLIMS database by its api_url.

Data#

API#

nexusLIMS.instruments.instrument_db#

Type: dict

nexusLIMS.instruments.get_instr_from_filepath(path: Path) Instrument | None[source]#

Get an instrument object by a given path Using the NexusLIMS database.

Parameters:

path – A path (relative or absolute) to a file saved in the central filestore that will be used to search for a matching instrument

Returns:

instrument – An Instrument instance matching the path, or None if no match was found

Return type:

Instrument or None

Examples:

>>> inst = get_instr_from_filepath('/path/to/file.dm3')
>>> str(inst)
'FEI-Titan-TEM-012345 in Bldg 1/Room A'
nexusLIMS.instruments.get_instr_from_calendar_name(cal_name)[source]#

Get an instrument object from the NexusLIMS database by its calendar name.

Parameters:

cal_name (str) – A calendar name (e.g. “FEITitanTEMEvents”) that will be used to search for a matching instrument in the api_url values

Returns:

instrument – An Instrument instance matching the path, or None if no match was found

Return type:

Instrument or None

Examples:

>>> inst = get_instr_from_calendar_name('FEITitanTEMEvents')
>>> str(inst)
'FEI-Titan-TEM-012345 in Bldg 1/Room A'
nexusLIMS.instruments.get_instr_from_api_url(api_url: str) Instrument | None[source]#

Get an instrument object from the NexusLIMS database by its api_url.

Parameters:

api_url – An api_url (e.g. “FEITitanTEMEvents”) that will be used to search for a matching instrument in the api_url values

Returns:

An Instrument instance matching the api_url, or None if no match was found

Return type:

Instrument

Examples:

>>> inst = get_instr_from_api_url('https://nemo.example.com/api/tools/?id=1')
>>> str(inst)
'FEI-Titan-STEM-012345 in Bldg 1/Room A'