curepy.container.measurement_function module#

Container for Measurement Function

class curepy.container.measurement_function.MeasurementFunction(measurement_func: Callable, initial_guess: Any, multiple_guess_measurements: bool = False, measurement_name: str = None, input_quantities_names: str | List[str] = None)[source]#

Bases: object

make_x_tuple(theta: ndarray) tuple[source]#

Build the input-quantity tuple from the flattened state vector.

Fills a deep copy of initial_guess with values from theta in order, supporting up to three levels of nesting.

Parameters:

theta – Flattened state vector whose values are inserted into the initial-guess structure.

Returns:

Tuple of input quantities ready to be passed to the measurement function.

measurement_function_flattened_b(theta: ndarray, b_flat: ndarray, b_shape_list: List[tuple]) ndarray[source]#

Evaluate the measurement function with a flat ancillary-parameter vector.

Reconstructs the original ancillary parameter arrays from the flat vector b_flat using the shapes in b_shape_list, then calls the measurement function and returns a flattened result.

Parameters:
  • theta – Flattened retrieval state vector.

  • b_flat – Concatenated, flattened ancillary parameter values.

  • b_shape_list – Shapes used to reconstruct each ancillary parameter array.

Returns:

Flattened output of the measurement function.

measurement_function_flattened_output(theta: ndarray, b: ndarray | None) ndarray[source]#

Evaluate the measurement function and return a flattened output array.

Parameters:
  • theta – Flattened retrieval state vector.

  • b – Ancillary parameter values, or None if not used.

Returns:

Flattened output of the measurement function.

measurement_function_x(theta: ndarray, b: ndarray | None) ndarray[source]#

Evaluate the measurement function at state vector theta.

Unpacks theta into the input-quantity tuple expected by the underlying measurement function and calls it, optionally passing ancillary parameters b.

Parameters:
  • theta – Flattened retrieval state vector.

  • b – Ancillary parameter values, or None if not used.

Returns:

Output of the measurement function.