|
| 1 | + |
| 2 | + |
| 3 | +The content of this page has been converted from the presenation given as ["OMC3 bad BPM detection" on the 31.03.2025](https://indico.cern.ch/event/1531923/) . |
| 4 | + |
| 5 | + |
| 6 | +## OMC-Analysis |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +* To get <span class="omc-emph">reliable</span> and <span class="omc-emph">reproducible</span> optics measurements, we cannot trust all BPM data that we are getting. |
| 11 | +* At <span class="omc-emph">different stages</span> of the code, we try to determine the ``trustworthyness''. |
| 12 | +* Some BPMs are fully <span class="omc-emph">excluded</span>, others are getting <span class="omc-emph">errorbars</span> based on their <span class="omc-emph">noise-level</span> (which are often used as *weights*, e.g. for correction calculations). |
| 13 | + |
| 14 | + |
| 15 | +## Automatic |
| 16 | + |
| 17 | +* First the <span class="tbt-related">Turn-by-Turn Data</span> is checked for ``obvious'' signs. |
| 18 | + * <span class="tbt-related">EXACT_ZERO</span>: Any value has an <span class="tbt-related">exact zero</span> (might lead to false positives, but unlikely if happens in multiple datasets). |
| 19 | + * <span class="tbt-related">NANS</span>: Data contains <span class="tbt-related">NaN-values</span> (happens in SPS BPMs). |
| 20 | + * <span class="tbt-related">FLAT</span>: <span class="tbt-related">Peak-to-Peak</span> value was <span class="tbt-related">below</span> a given threshold (10nm). |
| 21 | + * <span class="tbt-related">SPIKY</span>: A <span class="tbt-related">spike</span> in the data, <span class="tbt-related">above</span> a given threshold (2cm). |
| 22 | +* To reduce <span class="svd-related">noise</span> we perform an SVD-decomposition and keep only the <span class="svd-related">strongest modes</span>. |
| 23 | + * <span class="svd-related">SVD_PEAK</span>: The BPM had a <span class="svd-related">mode</span> in the U-Matrix above a given threshold (0.925). |
| 24 | +* Most information about the optics come from a <span class="spec-related">spectral analysis</span>. |
| 25 | + * <span class="spec-related">NO_TUNE</span>: Tune line could <span class="spec-related">not be found</span> in the spectrum. |
| 26 | + * <span class="spec-related">TUNE_CLEAN</span>: Tune line found was <span class="spec-related">too far from the average</span> of the other BPMs. |
| 27 | + |
| 28 | +## Manual |
| 29 | + |
| 30 | + |
| 31 | +* <span class="manual-related">KNOWN</span>: Identified <span class="manual-related">manually</span>; sticking out spectrum/optics <span class="manual-related">regularly</span>. |
| 32 | + * <span class="manual-related">Large error bars</span>. |
| 33 | + * <span class="manual-related">Non-sensical</span> data points. |
| 34 | + * Cause <span class="manual-related">analysis issues</span> (e.g. phase-offsets, negative $\beta$, NaNs). |
| 35 | + * <span class="manual-related">Calibration</span> issues: |
| 36 | + * $\beta$-form-phase looks normal, peak in $\beta$-from-amplitude |
| 37 | + * $\beta$-ratios large. |
| 38 | + * Measure in <span class="manual-related">different optics</span> to <span class="manual-related">confirm BPM issue</span>. |
| 39 | +* **Good hint:** <span class="manual-related">Filtering them solves observed issues</span>. |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +## Isolation Forest |
| 44 | + |
| 45 | +* Using <span class="iforest-related">machine learning techniques</span> to identify Bad-BPMs. |
| 46 | + * <span class="iforest-related">IFOREST</span>: Identified BPM, due to being an <span class="iforest-related">outlier in Tune, Noise and/or Amplitude</span> |
| 47 | + |
| 48 | +!!! warning "Under Re-evaluation" |
| 49 | + This functionality is currently under re-evaluation and has only been used on a small amount of data in 2021-2024! |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +[E. Fol - Machine Learning for BPM failure detection](https://indico.cern.ch/event/762124/contributions/3174751/attachments/1740028/2815322/hss_meeting_2410.pdf)<br> |
| 55 | +[E. Fol - Isolation Forest for bad BPMs: performance evaluation](https://indico.cern.ch/event/776442/contributions/3228674/attachments/1759222/2853627/omc_meeting_26nov.pdf) |
| 56 | + |
| 57 | +## Bad BPMs Summary Script |
| 58 | + |
| 59 | +* Bad-BPMs are written out in files <span class="omc-emph">per analysed TbT-Data</span>. |
| 60 | +* Script available to <span class="omc-emph">gather, summarize and make statistics</span>. |
| 61 | + |
| 62 | +```bash |
| 63 | +usage: bad_bpms_summary.py [-h] --dates DATES [DATES ...] [--root ROOT] [--outfile OUTFILE] |
| 64 | + [--print_percentage PRINT_PERCENTAGE] [--accel_glob ACCEL_GLOB] |
| 65 | + |
| 66 | +options: |
| 67 | + --dates DATES [DATES ...] |
| 68 | + Dates to include in analysis. This should be either subfolders in |
| 69 | + `root` or glob-patterns for those. |
| 70 | + --root ROOT Path to the root directory, containing the dates. |
| 71 | + Default: `/user/slops/data/LHC_DATA/OP_DATA/BetaBeat/` |
| 72 | + --outfile OUTFILE Path to the file to write out. |
| 73 | + --print_percentage PRINT_PERCENTAGE |
| 74 | + Print out BPMs that appear in more than this percentage of measurements. |
| 75 | + --accel_glob ACCEL_GLOB |
| 76 | + Accelerator name (glob for the sub-directories). |
| 77 | +``` |
| 78 | + |
| 79 | +Example: All bad BPMs from 2025, written into file and all > 50% in terminal |
| 80 | + |
| 81 | +``` |
| 82 | +python -m omc3.scripts.bad_bpms_summary --dates 2025-* \ |
| 83 | + --accel_glob LHCB* \ |
| 84 | + --outfile bad_bpms_2025.txt \ |
| 85 | + --print_percentage 50 |
| 86 | +``` |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +*[BPM]: Beam Position Monitor |
0 commit comments