gstlal 1.13.0
Loading...
Searching...
No Matches
python.utilities.element_registry Namespace Reference

Classes

class  ElementRegistry
class  RegisteredElement

Functions

str module_name (types.FunctionType func)
str generate_registered_method_source (List[RegisteredElement] elements=None)

Variables

 lloidparts = None
list PIPEPARTS_ELEMENTS
list CONDITION_ELEMENTS
list LLOIDPARTS_ELEMENTS
list ALL_ELEMENTS = PIPEPARTS_ELEMENTS + CONDITION_ELEMENTS + LLOIDPARTS_ELEMENTS

Detailed Description

Utilities for registering elements to a mixin class that can call elements as methods

Motivation:
    1. Inspectability
        By making each method statically as opposed to dynamically (from registry list), the full traceback is inspectable
        before runtime, allowing for easier development and clearer, more concise readability.
    1. Performance
        Dynamically setting methods on import is inefficient, though it is clever

Function Documentation

◆ generate_registered_method_source()

str generate_registered_method_source ( List[RegisteredElement] elements = None)
This function is only to be used when making changes to the element registry, though it is also
    allowed to edit the ElementRegistry class directly. This function helps automatically generate the method
    source code for the ElementRegistry class using the attributes of the registered elements.

    Args:
        elements:
            List[RegisteredElement], default None, if None use ALL_ELEMENTS registered below

    Returns:
        str

Definition at line 460 of file element_registry.py.

◆ module_name()

str module_name ( types.FunctionType func)
Get a functions module name

    Args:
        func:
            Function, the function for which to find module name

    Returns:
        str, the name of the module where the function is defined

Definition at line 413 of file element_registry.py.

Variable Documentation

◆ ALL_ELEMENTS

list python.utilities.element_registry.ALL_ELEMENTS = PIPEPARTS_ELEMENTS + CONDITION_ELEMENTS + LLOIDPARTS_ELEMENTS

Definition at line 575 of file element_registry.py.

◆ CONDITION_ELEMENTS

list python.utilities.element_registry.CONDITION_ELEMENTS
Initial value:
= [
# In the below, we have imported condition module as 'pipeparts_condition' to avoid
# a name collision with the element 'mkcondition', whose method-name will become 'condition'
RegisteredElement(pipeparts_condition.mkhtgate, mod_name='pipeparts_condition'),
RegisteredElement(pipeparts_condition.mkcondition, mod_name='pipeparts_condition'),
RegisteredElement(pipeparts_condition.mkmultiband, mod_name='pipeparts_condition'),
]

Definition at line 556 of file element_registry.py.

◆ lloidparts

python.utilities.element_registry.lloidparts = None

Definition at line 20 of file element_registry.py.

◆ LLOIDPARTS_ELEMENTS

list LLOIDPARTS_ELEMENTS
Initial value:
= [
RegisteredElement(lloidparts.mkcontrolsnksrc),
RegisteredElement(lloidparts.mkLLOIDbranch, base_name='mklloid_branch'),
RegisteredElement(lloidparts.mkLLOIDSnrSlicesToTimeSliceChisq, base_name='mklloid_snr_slices_to_timeslice_chisq'),
RegisteredElement(lloidparts.mkLLOIDSnrChisqToTriggers, base_name='mklloid_snrchisq_to_triggers'),
RegisteredElement(lloidparts.mkLLOIDhoftToSnrSlices, base_name='mklloid_hoft_to_snr_slices'),
]

Definition at line 565 of file element_registry.py.

◆ PIPEPARTS_ELEMENTS

list python.utilities.element_registry.PIPEPARTS_ELEMENTS

Definition at line 477 of file element_registry.py.