accelmo.tracking.dispatch.payloads

Worker payload construction.

Turns FileTracks grids and worker configs into the immutable arrays a tracking worker receives.

accelmo.tracking.dispatch.payloads.observation_turn_offsets(cols, sdir)[source]

Return the per-point turn offset implied by a range’s column order.

Markers are stored in ring order cycled to the file’s turn boundary, so a contiguous tracking range is a monotonic column sequence. Each place the sequence jumps backwards (forwards, when tracking in reverse) is the ring wrap, i.e. the point where the track moves into the next (previous) turn.

Return type:

ndarray

Parameters:
  • cols (numpy.ndarray)

  • sdir (int)

class accelmo.tracking.dispatch.payloads.WorkerPayloadBuilder(accelerator, gain_bpms=())[source]

Bases: object

Build tracking payload arrays and shared weights for workers.

Parameters:
  • accelerator (Accelerator)

  • gain_bpms (tuple[str, ...])

compute_pt(file_idx, machine_deltaps)[source]

Return the reference pt for a measurement file’s energy offset.

Return type:

float

Parameters:
  • file_idx (int)

  • machine_deltaps (list[float])

make_tracking_data(turn_batch, file_turn_map, config, machine_deltaps, tracks)[source]

Build the serialisable tracking payload for one worker.

Both transverse planes are always allocated; the ones the file does not excite keep their infinite variance and so contribute nothing to the loss.

Return type:

TrackingData

Parameters:
static attach_weights(payloads, *, optimise_momenta=True)[source]

Attach inverse-variance weights to every payload; returns the number of weighted points.

Return type:

int

Parameters:
  • payloads (list[WorkerPayload])

  • optimise_momenta (bool)