get_class_for

sofia_redux.scan.utilities.class_provider.get_class_for(instrument, module_path_name, other_module=None)[source]

Return an instrument specific class for a given module.

The SOFSCAN custom classes for any instrument should be placed in the package in the following format:

scan.custom.<instrument>.<…>

For example, a custom channel data class for the HAWC_PLUS instrument should be placed at:

scan.custom.hawc_plus.channels.channel_data.channel_data

and contain a class called ChannelData. Class names must always match the module_path_name final path, begin with an upper case character, and mark new words with an upper-case character. For example, the class AbcDefGhi should be in the abc_def_ghi module.

Parameters:
instrumentstr

The name of the instrument.

module_path_namestr

The dot-separated module path for the required class excluding the custom instrument path. For example, ‘channels.channel_data’.

other_modulestr, optional

Usually, the class will be retrieved from a module matching the last path level in module_path_name. For example, ChannelData will usually be retrieved from <instrument_path>.channels.channel_data.channel_data. Set this to an empty string (‘’) to retrieve from <instrument_path>.channels.channel_data or <other> to retrieve from <instrument_path>.channels.channel_data.<other>.

Returns:
class

Examples

>>> print(get_class_for('sofia', 'frames'))
<class 'sofia_redux.scan.custom.sofia.frames.frames.SofiaFrames'>