accelmo.fitting.reduction

Summing the workers’ replies to one evaluation.

class accelmo.fitting.reduction.Reduced(loss, grad, normal, n_valid, particle_lost, extra_sum=None)[source]

Bases: object

The sum over the workers that returned a valid loss.

normal is None when the workers send none (no curvature asked for). particle_lost is set when any worker lost its particles or closed orbit; those workers are left out of every sum and of n_valid.

Parameters:
  • loss (float)

  • grad (np.ndarray)

  • normal (np.ndarray | None)

  • n_valid (int)

  • particle_lost (bool)

  • extra_sum (np.ndarray | None)

loss: float
grad: ndarray
normal: Optional[ndarray]
n_valid: int
particle_lost: bool
extra_sum: Optional[ndarray] = None

the BPM-gain sums), else None.

Type:

Sum of the replies’ array extra (tracking

accelmo.fitting.reduction.reduce_replies(replies, n_knobs)[source]

Sum the GradReply of every worker.

A NaN loss marks a worker that lost its particles or closed orbit; an infinite one a worker error, which is raised.

Return type:

Reduced

Parameters:
  • replies (Sequence[object])

  • n_knobs (int)