CatalogListInstruments v1

../_images/CatalogListInstruments-v1_dlg.png

CatalogListInstruments dialog.

Summary

Lists the name of instruments from all catalogs or a specific catalog based on session information.

Properties

Name Direction Type Default Description
Session Input string   The session information of the catalog to use.
InstrumentList Output str list   A list containing instrument names.

Description

Obtains a list of all instruments for active (logged in) catalogs by default. If a session is specified, then the instruments for that session will be returned.

Usage

Example - obtaining instrument names from current active catalogs.

# Assuming you have previously logged into the ISIS catalog.
instruments = CatalogListInstruments()

# How many instruments are at ISIS?
print("The number of instruments at ISIS is: {}".format(len(instruments)))

for instrument in instruments:
    print("Instrument name is: {}".format(instrument))

# Verify that the instrument belongs to ISIS.
instrument = instruments[0]
print("The facility of instrument {} is: {}".format(instrument, ConfigService.getInstrument(instrument).facility()))

Output:

The number of instruments at ISIS is: 38

Instrument name is: ALF
...
Instrument name is: WISH

The facility of instrument ALF is: ISIS

Categories: Algorithms | DataHandling\Catalog

Source

C++ source: CatalogListInstruments.cpp (last modified: 2016-02-22)

C++ header: CatalogListInstruments.h (last modified: 2016-02-12)