API Reference Manual

This is the main API for getting instrument descriptions from the instrument database

class instrumentdatabaseapi.instrumentdatabaseapi.Repository(url='https://github.com/PaNOSC-ViNYL/instrument_database.git', local_repo='/dev/shm/instrumentDBAPI/')[source]

Bases: object

Class Repository

The API to interact with the instrument database is offered by the Repository class

Initiate the repository from an URL or local repo

Parameters
  • url (str) – URL of the git repository storing the instrument database URL can be anything git can manage git will raise an error in case URL is not accepted

  • local_repo (str) – local directory where the instrument database is copied to

init(url='https://github.com/PaNOSC-ViNYL/instrument_database.git', local_repo='/tmp/instrumentDBAPI/', branch='shervin')[source]

Initiate the repository from an URL or local repo

Parameters
  • url (str) – URL of the git repository storing the instrument database

  • local_repo (str) – local directory where the instrument database is copied to

  • branch (str) – branch in the repository to checkout

Return type

None

get_institutes()[source]

Get the list of institutes

Return type

list

ls_institutes()[source]

Print the list of institutes

Return type

None

get_instruments(institute)[source]
Return type

List[str]

ls_instruments(institute)[source]

Print the names of the available instruments

Parameters

institute (str) – name of the institute as returned by ls_institutes()

Return type

None

get_versions(institute, instrument)[source]
Return type

List[str]

ls_versions(institute, instrument)[source]

Print all implemented versions for the given instrument

Parameters
Version formats:
  • HEAD is the most recent up-to-date version of the instrument and it is still currently in use

  • YYYY/MM/DD last day of validity of the instrument description. After that date, the instrument have been either modified (so more recent version should be available) or it not in service anymore

Return type

None

get_simulation_programs(institute, instrument, version)[source]
ls_simulation_programs(institute, instrument, version)[source]

Print the list of simulation programs for which an instrument is implemented

Return type

None

get_flavours(institute, instrument, version, simulation_program)[source]
Return type

List[str]

ls_flavours(institute, instrument, version, simulation_program)[source]

A given instrument might be technically implemented in different ways. Flavours are strings meant to distinguish these different implementations. By default an empty string should be used for an instrument.

Return type

None

validation_dir(institute, instrument, version='HEAD', simulation_program='', flavour='')[source]

Return the path where the test simulation results are stored. The simulation results are performed to validate the instrument.

Parameters
  • simulation_program (str) – name of the simulation program

  • institute (str) – name of the institute

  • instrument (str) – name of the instrument

  • version (str) – version name

  • flavour (str) – optional string that might identify two alternative implementations of the same instrument with the same version

Return type

str

load(institute, instrument, version='HEAD', simulation_program='', flavour='', dep=True)[source]

Load an intrument from the repository

Parameters
  • simulation_program (str) – name of the simulation program

  • institute (str) – name of the institute

  • instrument (str) – name of the instrument

  • version (str) – version name

  • flavour (str) – optional string that might identify two alternative implementations of the same instrument with the same version

  • dep (bool) – download python dependencies in requirements.txt for the instrument if dep == True

Return type

<module ‘libpyvinyl.Instrument’ from ‘/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/libpyvinyl/Instrument.py’>

Returns

the instrument object

Raise

NotImplementedError if the instrument module does not provide a def_instrument method