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

review names of constants

awegsche opened this issue · comments

The following constants need pre- (or suf-)fixes stating their intention (e.g. COL or COLUMN for column names, SUF or SUFFIX for a suffix etc):

# Column Names -----------------------------------------------------------------
# Pre- and Suffixe
ERR: str = "ERR" # Error of the measurement
RMS: str = "RMS" # Root-Mean-Square
RES: str = "RES" # Rescaled measurement
DELTA: str = "DELTA" # Delta between measurement and model (sometimes beating)
MDL: str = "MDL" # Model
REAL: str = "REAL"
IMAG: str = "IMAG"
# Names
S: str = "S"
NAME: str = "NAME"
NAME2: str = f"{NAME}2"
TUNE: str = "Q"
NAT_TUNE: str = "NATQ"
PEAK2PEAK: str = "PK2PK"
ALPHA: str = "ALF"
BETA: str = "BET"
DPP: str = "DPP"
DPPAMP: str = "DPPAMP"
AMPLITUDE: str = "AMP"
PHASE: str = "PHASE"
PHASE_ADV: str = "MU"
F1001: str = "F1001"
F1010: str = "F1010"
SECONDARY_AMPLITUDE_X: str = "AMP01_X" # amplitude of secondary line in horizontal spectrum
SECONDARY_AMPLITUDE_Y: str = "AMP10_Y" # amplitude of secondary line in vertical spectrum
SECONDARY_FREQUENCY_X: str = "PHASE01_X" # frequency of secondary line in horizontal spectrum
SECONDARY_FREQUENCY_Y: str = "PHASE10_Y" # frequency of secondary line in vertical spectrum

I am currently consolidating constants.

maybe we could combine this issue with #231 and #305 (and similar issues that I may have overlooked) to something á la restructure column naming, also in view of having one constants dir for all the const (correction, kmod, optics_meas)
the problem, for now, is still that the order of where to put these -fixes is still up to the implementer for the specific module.
Maybe some simple functions could be written to also define the order in the constants module, e.g. an err_column(var) fct which returns f"{ERR}{var}" .. or alternative, and a lot more type work, spell out every column as constant here

maybe we could combine this issue with #231 and #305 (and similar issues that I may have overlooked) to something á la restructure column naming, also in view of having one constants dir for all the const (correction, kmod, optics_meas) the problem, for now, is still that the order of where to put these -fixes is still up to the implementer for the specific module. Maybe some simple functions could be written to also define the order in the constants module, e.g. an err_column(var) fct which returns f"{ERR}{var}" .. or alternative, and a lot more type work, spell out every column as constant here

We shouldn't bundle together issues and pull requests. I deliberately opened this as separate issue to avoid discussions on this one blocking other, more important issues like #305.

I agree that we should go for atomic PRs. I am also not a fan of having functions in the constants modules.

Closing, as I also think this is part of #231