Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add get_bad_bpms #427

Merged
merged 13 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# OMC3 Changelog

#### 2024-11-14 - v0.20.0 - _jdilly_, _awegsche_

- Added:
- `bad_bpms_summary` script: Collect and summarize the bad BPMs from GUI runs.

#### 2024-11-13 - v0.19.0 - _fscarlier_, _jdilly_

- Added K-Modulation tools:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Other general utility scripts are in [`/omc3/scripts`](omc3/scripts):
- `kmod_average.py` to calculate the average of multiple K-modulation measurements.
- `kmod_import.py` to import a K-modulation measurement into an optics-measurement directory.
- `kmod_lumi_imbalace.py` to calculate the luminosity imbalance between two IPs from averaged K-modulation files.
- `bad_bpms_summary.py` to collect and summarize the bad BPMs from GUI runs.

Example use for these scripts can be found in the [`tests`](tests) files.
Documentation including relevant flags and parameters can be found at <https://pylhc.github.io/omc3/>.
Expand Down
4 changes: 4 additions & 0 deletions doc/entrypoints/scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ Scripts
:members:
:noindex:


.. automodule:: omc3.scripts.bad_bpms_summary
:members:
:noindex:
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.19.0"
__version__ = "0.20.0"
__author__ = "pylhc"
__author_email__ = "[email protected]"
__license__ = "MIT"
Expand Down
6 changes: 4 additions & 2 deletions omc3/optics_measurements/iforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
This module contains the isolation forest functionality of ``optics_measurements``.
It provides functions to detect and exclude BPMs with anomalies.
"""
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.ensemble import IsolationForest
import tfs

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


Expand Down
Loading