LION.utils.parameter

Classes

LIONParameter(**kwargs)

LION's parameters: a plain namespace of settings (p.n_iters = 10), used for every model's, solver's, experiment's and reconstructor's settings.

OperatorParameters(**kwargs)

The parameters of an operator, which make it again: one class per kind of operator.

Functions

resolve_reconstruction(value, op[, name])

value, a reconstruction f(y, op); for "default", the operator's (op.default_reconstruction_fn(), e.g. fdk for CT).

with_current_names(value)

A record read from a file, with the old names of the operator's parameters (OLD_OPERATOR_NAMES, at any depth) as operator_params.


class LION.utils.parameter.LIONParameter(**kwargs)[source]

Bases: object

LION’s parameters: a plain namespace of settings (p.n_iters = 10), used for every model’s, solver’s, experiment’s and reconstructor’s settings. Values can be other parameters (nested); save/load write and read them as JSON, and print shows them all.

The parameters given as keywords, LIONParameter(n_iters=10). A dict value becomes a LIONParameter, unless it is a spec (a dict with "_target_", see LION.utils.spec), which describes an object and stays a dict.

is_filled()[source]

Check if the values are not None

serialize()[source]

This only exists to allow LIONParameter() inside LIONParameter() otherwise, its equivalent to vars(self)

deserialize()[source]

Produces a dict of LIONParameter()

save(fname)[source]

Save LIONParameter into a JSON file

load(fname)[source]

Load LIONParameter from JSON file, and initialize instance

unpack()[source]

If the LIONParameter is made of other Parameters, unpack those.

class LION.utils.parameter.OperatorParameters(**kwargs)[source]

Bases: LIONParameter

The parameters of an operator, which make it again: one class per kind of operator. For CT, it’s the Geometry (LION.operators.ct.ct_geometry): wherever LION asks for operator_params, a CT user gives their geometry.

Components that need an operator take its parameters (operator_params) and call make_operator(), so they work with any kind of operator.

The parameters given as keywords, LIONParameter(n_iters=10). A dict value becomes a LIONParameter, unless it is a spec (a dict with "_target_", see LION.utils.spec), which describes an object and stays a dict.

make_operator()[source]

The operator these parameters describe.

property split_count

How many measurement units the operator can be split along (for CT, the angles).

split(indices)[source]

New parameters for the measurement units indices only (for CT, those angles). These parameters are not changed.

split_measurements(y, indices)[source]

The measurement units indices of y (batched or not): the measurements of the operator split(indices) makes.

LION.utils.parameter.resolve_reconstruction(value, op, name='reconstruction')[source]

value, a reconstruction f(y, op); for "default", the operator’s (op.default_reconstruction_fn(), e.g. fdk for CT).

LION.utils.parameter.with_current_names(value)[source]

A record read from a file, with the old names of the operator’s parameters (OLD_OPERATOR_NAMES, at any depth) as operator_params.