SpectrogramFactory#
- class radiospectra.spectrogram.SpectrogramFactory(
- default_widget_type=None,
- additional_validation_functions=[],
- registry=None,
Bases:
BasicRegistrationFactoryA factory for generating spectrograms.
- Parameters:
*inputs –
strorpathlib.Pathto the file.- Returns:
The spectrogram for the give file
- Return type:
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 isFalse.
Notes
Extra keyword arguments are passed through to
sunpy.io.read_filesuch asmemmapfor FITS files.
- register(
- WidgetType,
- validation_function=None,
- is_default=False,
Register a widget with the factory.
If
validation_functionis not specified, testsWidgetTypefor existence of any function in in the listself.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 toNone.is_default (
bool, optional) – Sets WidgetType to be the default widget. Defaults toFalse.
- unregister(WidgetType)#
Remove a widget from the factory’s registry.