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]: Structured Data

awegsche opened this issue · comments

Feature Description

As mentionned in one previous pull request, the code could benefit from more structured data. Where it might be overkill to create and entire struct just to get rid of one replace(':', '/'), there are places in omc3 where it would actually make sense and improve usability of the code.

One important place to start would be InputFiles .

Possible Implementation

First of all, InputFiles should go into a separate file (right now it's even used before it's defined in measure_optics.py).

Then, the data should not be stored as dict for 'X' and 'Y', but have members .x_files/.y_files. If access to those members is desired from the outside, for convenience and to keep compatibility, the [] operator can be overriden.

And the output of the phase calculation could also benfit from a struct.

Comments:

  • InputFiles is not used before it is defined, in the sense that this is a bug. It is used after it's definition Runtime wise, i.e. a readability problem, not an operational one.

  • There are no structs in Python, at least none that IMHO make sense here. I guess you mean dataclass?