accelmo.fitting.shared_reference¶
Reference orbits computed once and shared with every closed-orbit worker through shared memory.
Every reference-subtracted closed-orbit series needs the orbit (and its knob Jacobian) of the reference machine state: all correctors at nominal, the current magnet knobs. That state is the same for every series, so a dedicated reference worker solves it once per iteration, in parallel with the other workers’ signal solves, and publishes it here. The signal workers map the block instead of each solving the same reference (and sending 90 MB through a pipe).
Block layout: float64 (len(reference_pts), len(coords), n_bpms, 1 + n_knobs); [..., 0] is the orbit and
[..., 1:] its Jacobian with respect to the knobs.
- class accelmo.fitting.shared_reference.SharedReference(name, reference_pts, coords, shape)[source]¶
Bases:
objectPicklable description of a published block (what the fitter relays to the signal workers).
- Parameters:
name (str)
reference_pts (tuple[float, ...])
coords (tuple[str, ...])
shape (tuple[int, int, int, int])
- name: str¶
- reference_pts: tuple[float, ...]¶
- coords: tuple[str, ...]¶
- shape: tuple[int, int, int, int]¶
- class accelmo.fitting.shared_reference.ReferencePublisher[source]¶
Bases:
objectWriter side: owns the shared-memory block and rewrites it every iteration.
- publish(states, reference_pts, coords)[source]¶
Write one
(orbit (n_coords, n_bpms), jacobian (n_coords, n_bpms, n_knobs))per reference momentum.- Return type:
- Parameters:
states (list[tuple[numpy.ndarray, numpy.ndarray]])
reference_pts (tuple[float, ...])
coords (tuple[str, ...])
- accelmo.fitting.shared_reference.attach_shared_block(name)[source]¶
Map an existing block without making this process responsible for deleting it.
Before Python 3.13 attaching registers the block with the resource tracker, which then warns about a “leaked” block when the reader exits although the publisher has already unlinked it.
- Return type:
SharedMemory- Parameters:
name (str)
- class accelmo.fitting.shared_reference.ReferenceReader[source]¶
Bases:
objectReader side: maps the block named by a
SharedReference(once) and returns views of it.- view(reference)[source]¶
Array view of the shared block named by
reference.- Return type:
ndarray- Parameters:
reference (SharedReference)