PlasmaFactory

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

Bases: BasicRegistrationFactory

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

Attention

This feature is under development. Breaking changes may occur in the future.

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: bool = False)

Register a widget with the factory.

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

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

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

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

unregister(WidgetType) None

Remove a widget from the factory’s registry.