PlasmaFactory

class plasmapy.plasma.plasma_factory.PlasmaFactory(default_widget_type=None, additional_validation_functions=None, registry=None)

Bases: plasmapy.utils.datatype_factory_base.BasicRegistrationFactory

Plasma factory class. Used to create a variety of Plasma objects. Valid plasma structures are specified by registering them with the factory.

Methods Summary

__call__(*args, **kwargs)

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, **kwargs)

Method for running the factory.

Arguments args and kwargs are passed through to the validation function and to the constructor for the final type.

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.

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

unregister(WidgetType)

Remove a widget from the factory’s registry.