Skip to content

Commit 63948bc

Browse files
awegscheJoschD
andauthored
add bad_bpms_summary (#427)
* add bad_bpms_summary * doc, version * test --------- Co-authored-by: JoschD <[email protected]>
1 parent 19f7e86 commit 63948bc

File tree

12 files changed

+529
-23
lines changed

12 files changed

+529
-23
lines changed

.zenodo.json

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,66 @@
55
"affiliation": "CERN"
66
},
77
{
8-
"name": "Lukáš Malina",
8+
"name": "Felix Simon Carlier",
99
"affiliation": "CERN",
10-
"orcid": "0000-0002-4673-6035"
10+
"orcid": "0000-0002-7173-8833"
1111
},
1212
{
13-
"name": "Joschua Dilly",
13+
"name": "Jaime Maria Coello De Portugal - Martinez Vazquez",
1414
"affiliation": "CERN",
15-
"orcid": "0000-0001-7864-5448"
15+
"orcid": "0000-0002-6899-3809"
1616
},
1717
{
18-
"name": "Michael Hofer",
18+
"name": "Joschua Dilly",
1919
"affiliation": "CERN",
20-
"orcid": "0000-0001-6173-0232"
21-
},
22-
{
23-
"name": "Felix Soubelet",
24-
"affiliation": "University of Liverpool & CERN",
25-
"orcid": "0000-0001-8012-1440"
26-
},
27-
{
28-
"name": "Andreas Wegscheider",
29-
"affiliation": "CERN"
20+
"orcid": "0000-0001-7864-5448"
3021
},
3122
{
32-
"name": "Jaime Maria Coello De Portugal - Martinez Vazquez",
23+
"name": "Hector Garcia Morales",
3324
"affiliation": "CERN",
34-
"orcid": "0000-0002-6899-3809"
25+
"orcid": "0000-0001-5100-8975"
3526
},
3627
{
3728
"name": "Maël Le Garrec",
3829
"affiliation": "CERN",
3930
"orcid": "0000-0002-8146-2340"
4031
},
4132
{
42-
"name": "Tobias Persson",
33+
"name": "Joshua Mark Gray",
4334
"affiliation": "CERN"
4435
},
36+
{
37+
"name": "Michael Hofer",
38+
"affiliation": "CERN",
39+
"orcid": "0000-0001-6173-0232"
40+
},
4541
{
4642
"name": "Jacqueline Keintzel",
4743
"affiliation": "CERN",
4844
"orcid": "0000-0003-1396-8478"
4945
},
5046
{
51-
"name": "Hector Garcia Morales",
47+
"name": "Lukáš Malina",
5248
"affiliation": "CERN",
53-
"orcid": "0000-0001-5100-8975"
49+
"orcid": "0000-0002-4673-6035"
50+
},
51+
{
52+
"name": "Tobias Persson",
53+
"affiliation": "CERN"
54+
},
55+
{
56+
"name": "Felix Soubelet",
57+
"affiliation": "University of Liverpool & CERN",
58+
"orcid": "0000-0001-8012-1440"
5459
},
5560
{
5661
"name": "Rogelio Tomas Garcia",
5762
"affiliation": "CERN",
5863
"orcid": "0000-0002-9857-1703"
64+
},
65+
{
66+
"name": "Andreas Wegscheider",
67+
"affiliation": "CERN"
5968
}
6069
],
6170
"title": "OMC3",

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OMC3 Changelog
22

3+
#### 2024-11-14 - v0.20.0 - _jdilly_, _awegsche_
4+
5+
- Added:
6+
- `bad_bpms_summary` script: Collect and summarize the bad BPMs from GUI runs.
7+
38
#### 2024-11-13 - v0.19.0 - _fscarlier_, _jdilly_
49

510
- Added K-Modulation tools:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Other general utility scripts are in [`/omc3/scripts`](omc3/scripts):
7272
- `kmod_average.py` to calculate the average of multiple K-modulation measurements.
7373
- `kmod_import.py` to import a K-modulation measurement into an optics-measurement directory.
7474
- `kmod_lumi_imbalace.py` to calculate the luminosity imbalance between two IPs from averaged K-modulation files.
75+
- `bad_bpms_summary.py` to collect and summarize the bad BPMs from GUI runs.
7576

7677
Example use for these scripts can be found in the [`tests`](tests) files.
7778
Documentation including relevant flags and parameters can be found at <https://pylhc.github.io/omc3/>.

doc/entrypoints/scripts.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ Scripts
4040
:members:
4141
:noindex:
4242

43+
44+
.. automodule:: omc3.scripts.bad_bpms_summary
45+
:members:
46+
:noindex:

omc3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
__title__ = "omc3"
1212
__description__ = "An accelerator physics tools package for the OMC team at CERN."
1313
__url__ = "https://github.com/pylhc/omc3"
14-
__version__ = "0.19.0"
14+
__version__ = "0.20.0"
1515
__author__ = "pylhc"
1616
__author_email__ = "[email protected]"
1717
__license__ = "MIT"

omc3/optics_measurements/iforest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
This module contains the isolation forest functionality of ``optics_measurements``.
66
It provides functions to detect and exclude BPMs with anomalies.
77
"""
8+
from pathlib import Path
89
import numpy as np
910
import pandas as pd
1011
from sklearn.ensemble import IsolationForest
12+
import tfs
1113

1214
from omc3.definitions.constants import PLANE_TO_NUM
1315
from omc3.utils import logging_tools
@@ -21,8 +23,8 @@ def clean_with_isolation_forest(input_files, meas_input, plane):
2123
bad_bpms = identify_bad_bpms(meas_input, input_files, plane)
2224
input_files = remove_bad_bpms(input_files, list(set(bad_bpms.NAME)), plane)
2325
LOGGER.info(str(list(set(bad_bpms.NAME))))
24-
# TODO potentially write output files ... currently not unique indices!
25-
# tfs.write(os.path.join(meas_input.outputdir, f"bad_bpms_iforest_{plane.lower()}.tfs"), bad_bpms)
26+
if meas_input.outputdir is not None:
27+
tfs.write(Path(meas_input.outputdir)/ f"bad_bpms_iforest_{plane.lower()}.tfs", bad_bpms)
2628
return input_files
2729

2830

0 commit comments

Comments
 (0)