Skip to content

Commit

Permalink
Bugfix MQSORG knob naming in beam 2 (#440)
Browse files Browse the repository at this point in the history
* fix bug
* version
* fix hdf5 on macos
* dropped python 3.8 in CI
  • Loading branch information
JoschD authored Jun 5, 2024
1 parent 2cf93e1 commit ac2f489
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ jobs:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest]
# Make sure to escape 3.10 with quotes so it doesn't get interpreted as float 3.1 by GA's parser
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v3

- if: matrix.os == 'macos-latest'
name: Set up hdf5
run: brew install hdf5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -48,7 +52,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# OMC3 Changelog

#### 2024-06-05 - v0.14.1 - _jdilly_

- Fixed:
- LHC Knobs: Fixed typo "MQSOR" to "MQSORG" in LHC Beam 2 coupling knobs.

- CI: Dropped python 3.8

#### 2024-03-18 - v0.14.0 - _jdilly_

- Added:
Expand Down
2 changes: 1 addition & 1 deletion omc3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
__title__ = "omc3"
__description__ = "An accelerator physics tools package for the OMC team at CERN."
__url__ = "https://github.com/pylhc/omc3"
__version__ = "0.14.0"
__version__ = "0.14.1"
__author__ = "pylhc"
__author_email__ = "[email protected]"
__license__ = "MIT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"kqs.l1b2",
"kqs.r8l1b2"
],
"MQSOR": [
"MQSORG": [
"kqs.a12b2",
"kqs.r2b2",
"kqs.l3b2",
Expand Down
39 changes: 39 additions & 0 deletions tests/unit/test_global_correction_knobs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
Tests for the definition files of the global correction knobs.
"""
import json

from omc3.model.accelerators.lhc import LHC_DIR

CORRECTORS_DIR = LHC_DIR / "2012" / "correctors"


class TestLHCKnobs:
@staticmethod
def load_knobs_file(name: str, beam: int = None):
correctors_dir = CORRECTORS_DIR
if beam is not None:
correctors_dir = correctors_dir / f"correctors_b{beam}"

with open(correctors_dir / f"{name}_correctors.json", "r") as f:
knobs = json.load(f)
return knobs

def test_all_json_files_are_readable(self):
""" Check if all json files are readable. """
for file in ["beta", "coupling"]:
for beam in [1, 2]:
knobs = self.load_knobs_file(file, beam=beam)
assert knobs

for file in ["triplet"]:
knobs = self.load_knobs_file(file)
assert knobs


def test_both_beams_have_all_knobs(self):
""" Check if all knobs are present in both beams. """
for file in ["beta", "coupling"]:
knobs_b1 = self.load_knobs_file(file, beam=1)
knobs_b2 = self.load_knobs_file(file, beam=2)
assert set(knobs_b1.keys()) == set(knobs_b2.keys())

0 comments on commit ac2f489

Please sign in to comment.