interface
interface¶
import tensorwaves.interface
Defines top-level interface of tensorwaves.
- class DataGenerator[source]¶
Bases:
abc.ABC
Abstract class for generating a
DataSample
.
- DataSample¶
Mapping of variable names to a sequence of data points, used by
Function
.alias of
Dict
[str
,numpy.ndarray
]
- class DataTransformer(*args, **kwds)[source]¶
Bases:
tensorwaves.interface.Function
[Dict
[str
,numpy.ndarray
],Dict
[str
,numpy.ndarray
]]Transform one
DataSample
into anotherDataSample
.This changes the keys and values of the input
DataSample
to a specific outputDataSample
structure.
- class Estimator(*args, **kwds)[source]¶
Bases:
tensorwaves.interface.Function
[Mapping
[str
,Union
[complex
,float
]],float
]Estimator for discrepancy model and data.
See the
estimator
module for different implementations of this interface.
- class FitResult(minimum_valid: bool, execution_time: float, function_calls: int, estimator_value: float, parameter_values: Optional[Dict[str, Union[complex, float]]] = None, parameter_errors: Optional[Dict[str, Union[complex, float]]] = None, iterations: Optional[int] = None, specifics: Optional[Any] = None)[source]¶
Bases:
object
- __eq__(other)¶
Method generated by attrs for class FitResult.
- count_number_of_parameters(complex_twice: bool = False) int [source]¶
Compute the number of free parameters in a
FitResult
.- Parameters
complex_twice (bool) – Count complex-valued parameters twice.
- specifics: Optional[Any]¶
Any additional info provided by the specific optimizer.
An instance returned by one of the implemented optimizers under the
optimizer
module. Currently one of:This way, you can for instance get the
covariance
matrix. See also Covariance matrix.
- class Function(*args, **kwds)[source]¶
Bases:
abc.ABC
,Generic
[tensorwaves.interface.InputType
,tensorwaves.interface.OutputType
]Generic representation of a mathematical function.
Representation of a mathematical function that computes
OutputType
values (co-domain) for a given set ofInputType
values (domain). Examples ofFunction
areParametrizedFunction
,Estimator
andDataTransformer
.- abstract __call__(data: InputType) OutputType [source]¶
Call self as a function.
- InputType¶
The argument type of a
Function.__call__()
.alias of TypeVar(‘InputType’)
- class Optimizer[source]¶
Bases:
abc.ABC
Optimize a fit model to a data set.
See the
optimizer
module for different implementations of this interface.
- OutputType¶
The return type of a
Function.__call__()
.alias of TypeVar(‘OutputType’)
- class ParametrizedFunction(*args, **kwds)[source]¶
Bases:
tensorwaves.interface.Function
[Dict
[str
,numpy.ndarray
],numpy.ndarray
]Interface of a callable function.
A
ParametrizedFunction
identifies certain variables in a mathematical expression as parameters. Remaining variables are considered domain variables. Domain variables are the argument of the evaluation (see__call__()
), while the parameters are controlled viaparameters
(getter) andupdate_parameters()
(setter). This mechanism is especially important for anEstimator
.
- class RealNumberGenerator[source]¶
Bases:
abc.ABC
Abstract class for generating real numbers within a certain range.
Implementations can be found in the
tensorwaves.data
module.
- class WeightedDataGenerator[source]¶
Bases:
abc.ABC
Abstract class for generating a
DataSample
with weights.- abstract generate(size: int, rng: RealNumberGenerator) Tuple[Dict[str, ndarray], ndarray] [source]¶
Generate
DataSample
with weights.- Returns
A
tuple
of aDataSample
with an array of weights.