pylhc / omc3

Python 3 codes for beam optics measurements and corrections in circular particle accelerators

Home Page:https://pylhc.github.io/omc3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Beta from phase: Catch too few BPMs in 3BPM method early

JoschD opened this issue · comments

Feature Description

If there are too few BPMs left after cleaning (e.g. 2), beta-from-phase will crash with a nondescript index error in the 3 BPM method. Probably also N-BPM method (?). This should be caught early and the user informed properly.

Possible Implementation

check for number of BPMs left in input to beta-from-phase and raise error

any progress on that one, btw?

I can add a warning or error "Dear user, phase analysis yields less than 3 BPMs. This will probably lead to problems later on, especially in beta from phase. Please check your measurement. Common issues to check:
-did you pass the correct tunes to harpy
-did excitation trigger in both planes
-are cleaning settings (peak-to-peak, singular-value-cut) too agressive"

I would log this as a warning in phase.py and catch the error through which we noticed this issue (the IndexError that says Index out of bounds ) in beta from phase (or maybe before that error, once you know that you need more BPMs than are available) to read something shorter like "Method {xy} requires {n} BPMS, but only {n} BPMs were available".

yeah, that's what I wanted to do

first draft is ready at #370: warnings and errors are produced as appropriate.

I do not know what to return from the functions though. phase is fine, phase output always makes sense. beta_from_phase on the other hand should return some form of none but this isn't handled later on