SpectrogramFactory#

class radiospectra.spectrogram.SpectrogramFactory(
default_widget_type=None,
additional_validation_functions=[],
registry=None,
)[source]#

Bases: BasicRegistrationFactory

A factory for generating spectrograms.

Parameters:

*inputsstr or pathlib.Path to the file.

Returns:

The spectrogram for the give file

Return type:

radiospectra.spectrogram.Spectrogram

Methods Summary

__call__(*args[, silence_errors])

Method for running the factory.

register(WidgetType[, validation_function, ...])

Register a widget with the factory.

unregister(WidgetType)

Remove a widget from the factory's registry.

Methods Documentation

__call__(*args, silence_errors=False, **kwargs)[source]#

Method for running the factory.

Takes arbitrary arguments and keyword arguments and passes them to a sequence of pre-registered types to determine which is the correct spectrogram- type to build. Arguments args and kwargs are passed through to the validation function and to the constructor for the final type. For spectrogram types, validation function must take a data-header pair as an argument.

Parameters:

silence_errors (bool, optional) – If set, ignore data-header pairs which cause an exception. Default is False.

Notes

Extra keyword arguments are passed through to sunpy.io.read_file such as memmap for FITS files.

register(
WidgetType,
validation_function=None,
is_default=False,
)#

Register a widget with the factory.

If validation_function is not specified, tests WidgetType for existence of any function in in the list self.validation_functions, which is a list of strings which must be callable class attribute.

Parameters:
  • WidgetType (type) – Widget to register.

  • validation_function (function, optional) – Function to validate against. Defaults to None, which indicates that a classmethod in validation_functions is used. Defaults to None.

  • is_default (bool, optional) – Sets WidgetType to be the default widget. Defaults to False.

unregister(WidgetType)#

Remove a widget from the factory’s registry.