paraqeet.measurement.weighted_sum_goal.WeightedSumGoal#

class paraqeet.measurement.weighted_sum_goal.WeightedSumGoal(measurements, weights, sum_of_squares_options=None)[source]#

Bases: NormalizableMeasurement, Differentiable

Combine multiple measurements into a single goal function.

Parameters:
  • measurements (list[Measurement]) – List of measurements.

  • weights (Array) – List of weights.

  • sum_of_squares_options (dict | None) –

    A dictionary that contains information about how to include the sum of square differences in the cost function. If not None then it must contain the following keys:

    • weightfloat

      The weight of the sum of square differences

    • meas_boollist[bool]

      A list of boolean of the same length as measurements. If an element is True then the corresponding measurement is included in the sum of square difference the goal function.

  • measurement_in_sum_of_squares (list[Measurement] | None) – The list of measurements included in the sum of square difference cost function. It is None if sum_of_squares_options is None

Raises:
  • ConfigurationException – If number of measurements and weights are incompatible.

  • UserWarning – If the given weights are not normalized.

__init__(measurements, weights, sum_of_squares_options=None)[source]#
Parameters:

Methods

__init__(measurements, weights[, ...])

calculate_normalized_scalar(times)

Sum of weighted measurements from normalized measurements.

get_value_and_gradient(times)

Sum of weighted measurements from gradient-ized measurements.

measure(times)

Sum of plain weighted measurements.

Attributes

measurements

Returns the list of measurement

measurements_in_sum_of_squares

Returns the list of measurement included in the sum of square difference cost function

sum_of_square_options

Returns the dictionary with the options about the sum of square differences goal function

weights

Returns the weights used in the weighted goal function

calculate_normalized_scalar(times)[source]#

Sum of weighted measurements from normalized measurements.

Returns:

Returns the normalized weighted sum.

Return type:

Array

Parameters:

times (Array | float)

get_value_and_gradient(times)[source]#

Sum of weighted measurements from gradient-ized measurements.

Returns:

  • Array – Returns the weighted sum wrt to gradients.

  • Array – Returns the sum of gradients.

Parameters:

times (Array)

Return type:

tuple[Array, Array] | tuple[float, Array]

measure(times)[source]#

Sum of plain weighted measurements.

Returns:

Returns the plain weighted sum.

Return type:

Array

Parameters:

times (Array)

property measurements: list[NormalizableMeasurement]#

Returns the list of measurement

property measurements_in_sum_of_squares: list[NormalizableMeasurement]#

Returns the list of measurement included in the sum of square difference cost function

property sum_of_square_options: dict | None#

Returns the dictionary with the options about the sum of square differences goal function

property weights: Array#

Returns the weights used in the weighted goal function