astrophot.param package#

Submodules#

astrophot.param.module module#

class astrophot.param.module.Module(name: str | None = None, **kwargs)[source]#

Bases: Module

build_params_array_identities()[source]#
build_params_array_names()[source]#
build_params_array_uncertainty()[source]#
build_params_array_units()[source]#

astrophot.param.param module#

class astrophot.param.param.Param(*args, uncertainty=None, prof=None, **kwargs)[source]#

Bases: Param

A class that extends the Caskade Param class to include additional functionality. This class is used to define parameters for models in the AstroPhot package.

property full_shape#
property initialized#

Check if the parameter is initialized.

property name_array#
property prof#
soft_valid(value)[source]#
property uncertainty#

Module contents#

class astrophot.param.Module(name: str | None = None, **kwargs)[source]#

Bases: Module

build_params_array_identities()[source]#
build_params_array_names()[source]#
build_params_array_uncertainty()[source]#
build_params_array_units()[source]#
class astrophot.param.OverrideParam(param: Param, value)[source]#

Bases: object

Context manager to override a parameter value. Only inside an OverrideParam will the parameter be set to the new value.

class astrophot.param.Param(*args, uncertainty=None, prof=None, **kwargs)[source]#

Bases: Param

A class that extends the Caskade Param class to include additional functionality. This class is used to define parameters for models in the AstroPhot package.

property full_shape#
property initialized#

Check if the parameter is initialized.

property name_array#
property prof#
soft_valid(value)[source]#
property uncertainty#
class astrophot.param.ValidContext(module: Module)[source]#

Bases: object

Context manager to set valid values for parameters. Only inside a ValidContext will parameters automatically be assumed valid.

astrophot.param.forward(method)[source]#

Decorator to define a forward method for a module.

Parameters#

method: (Callable)

The forward method to be decorated.

Examples#

Standard usage of the forward decorator:

class ExampleSim(Module):
    def __init__(self, a, b, c):
        super().__init__("example_sim")
        self.a = a
        self.b = Param("b", b)
        self.c = Param("c", c)

    @forward
    def example_func(self, x, b=None):
        return x + self.a + b

E = ExampleSim(a=1, b=None, c=3)
print(E.example_func(4, params=[5]))
# Output: 10

Returns#

Callable

The decorated forward method.