Skip to content

Add convenience methods to extract ORM plane blocks - #489

Open
HarshRajSinghania wants to merge 2 commits into
python-accelerator-middle-layer:mainfrom
HarshRajSinghania:add-orm-matrix-block-getters
Open

HarshRajSinghania wants to merge 2 commits into
python-accelerator-middle-layer:mainfrom
HarshRajSinghania:add-orm-matrix-block-getters

Conversation

@HarshRajSinghania

Copy link
Copy Markdown

Summary

Adds four convenience methods on OrbitResponseMatrix to extract the plane-specific blocks of the latest orbit response matrix measurement:

  • get_h2h_matrix()
  • get_v2v_matrix()
  • get_h2v_matrix()
  • get_v2h_matrix()

Motivation

Addresses #486. The ORM measurement stores the full matrix and plane metadata in latest_measurement (returned by get()). Users currently need to manually slice this matrix using the plane lists. These methods provide a direct, readable way to obtain the four standard blocks (horizontal-to-horizontal, vertical-to-vertical, and the two cross terms).

Implementation

A private _get_submatrix helper selects rows and columns according to the observable and variable plane labels stored with the measurement. The public methods simply call it with the appropriate plane pairs. If no measurement is available the methods return an empty list.

Testing

  • Added test_orm_block_getters in tests/tuning_tools/test_tuning_orm.py that performs a small ORM measurement and asserts the expected shapes of each block.
  • Ran pytest tests/tuning_tools/test_tuning_orm.py::test_orm_block_getters — passed.
  • Ran ruff check and ruff format on the changed files — clean.

Fixes #486

Implements get_h2h_matrix, get_v2v_matrix, get_h2v_matrix, and get_v2h_matrix on OrbitResponseMatrix to provide easy access to the four plane blocks of the latest measurement without requiring users to slice the matrix themselves.

Fixes python-accelerator-middle-layer#486
Implements get_h2h_matrix, get_v2v_matrix, get_h2v_matrix, and get_v2h_matrix on OrbitResponseMatrix to provide easy access to the four plane blocks of the latest measurement without requiring users to slice the matrix themselves.

Fixes python-accelerator-middle-layer#486

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: orm blocks from orm tool

1 participant