|
def harpy_params(): |
|
params = EntryPointParameters() |
|
params.add_parameter(flags="--files", name="files", required=True, nargs='+', |
|
help="TbT files to analyse") |
|
params.add_parameter(flags="--outputdir", name="outputdir", required=True, |
|
help="Output directory.") |
|
params.add_parameter(flags="--model", name="model", help="Model for BPM locations") |
|
params.add_parameter(flags="--unit", name="unit", type=str, choices=("m", "cm", "mm", "um"), |
|
default=HARPY_DEFAULTS["unit"], |
|
help=f"A unit of TbT BPM orbit data. All cuts and output are in 'mm'.") |
|
params.add_parameter(flags="--turns", name="turns", type=int, nargs=2, |
|
default=HARPY_DEFAULTS["turns"], |
|
help="Turn index to start and first turn index to be ignored.") |
|
params.add_parameter(flags="--to_write", name="to_write", nargs='+', |
|
default=HARPY_DEFAULTS["to_write"], |
|
choices=('lin', 'spectra', 'full_spectra', 'bpm_summary'), |
|
help="Choose the type of output. ") |
|
|
|
# Cleaning parameters |
|
params.add_parameter(flags="--clean", name="clean", action="store_true", |
|
help="If present, the data are first cleaned.") |
|
params.add_parameter(flags="--sing_val", name="sing_val", type=int, |
|
default=HARPY_DEFAULTS["sing_val"], |
|
help="Keep this amount of largest singular values.") |
|
params.add_parameter(flags="--peak_to_peak", name="peak_to_peak", type=float, |
|
default=HARPY_DEFAULTS["peak_to_peak"], |
|
help="Peak to peak amplitude cut. This removes BPMs, " |
|
"where abs(max(turn values) - min(turn values)) <= threshold.") |
|
params.add_parameter(flags="--max_peak", name="max_peak", type=float, |
|
default=HARPY_DEFAULTS["max_peak"], |
|
help="Removes BPMs where the maximum orbit > limit.") |
|
params.add_parameter(flags="--svd_dominance_limit", name="svd_dominance_limit", |
|
type=float, default=HARPY_DEFAULTS["svd_dominance_limit"], |
|
help="Limit for single BPM dominating a mode.") |
|
params.add_parameter(flags="--bad_bpms", name="bad_bpms", nargs='*', help="Bad BPMs to clean.") |
|
params.add_parameter(flags="--wrong_polarity_bpms", name="wrong_polarity_bpms", nargs='*', |
|
help="BPMs with swapped polarity in both planes.") |
|
params.add_parameter(flags="--keep_exact_zeros", name="keep_exact_zeros", action="store_true", |
|
help="If present, will not remove BPMs with exact zeros in TbT data.") |
|
params.add_parameter(flags="--first_bpm", name="first_bpm", type=str, |
|
help="First BPM in the measurement. " |
|
"Used to resynchronise the TbT data with model.") |
|
params.add_parameter(flags="--opposite_direction", name="opposite_direction", |
|
action="store_true", |
|
help="If present, beam in the opposite direction to model" |
|
" is assumed for resynchronisation of BPMs.") |
|
|
|
# Harmonic analysis parameters |
|
params.add_parameter(flags="--tunes", name="tunes", type=float, nargs=3, |
|
help="Guess for the main tunes [x, y, z]. Tunez is disabled when set to 0") |
|
params.add_parameter(flags="--nattunes", name="nattunes", type=float, nargs=3, |
|
help="Guess for the natural tunes (x, y, z). Disabled when set to 0.") |
|
params.add_parameter(flags="--natdeltas", name="natdeltas", type=float, nargs=3, |
|
help="Guess for the offsets of natural tunes from the driven tunes" |
|
" (x, y, z). Disabled when set to 0.") |
|
params.add_parameter(flags="--autotunes", name="autotunes", type=str, |
|
choices=("all", "transverse"), |
|
help="The main tunes are guessed as " |
|
"the strongest line in SV^T matrix frequency spectrum: " |
|
"Synchrotron tune below ~0.03, betatron tunes above ~0.03.") |
|
params.add_parameter(flags="--tune_clean_limit", name="tune_clean_limit", type=float, |
|
default=HARPY_DEFAULTS["tune_clean_limit"], |
|
help="The tune cleaning wont remove BPMs because of measured tune outliers" |
|
" closer to the average tune than this limit.") |
|
params.add_parameter(flags="--tolerance", name="tolerance", type=float, |
|
default=HARPY_DEFAULTS["tolerance"], |
|
help="Tolerance specifying an interval in frequency domain, where to look " |
|
"for the tunes.") |
|
params.add_parameter(flags="--free_kick", name="is_free_kick", action="store_true", |
|
help="If present, it will perform the free kick phase correction") |
|
params.add_parameter(flags="--window", name="window", type=str, |
|
choices=("rectangle", "hann", "triangle", "welch", "hamming", "nuttal3", |
|
"nuttal4"), default=HARPY_DEFAULTS["window"], |
|
help="Windowing function to be used for frequency analysis.") |
|
params.add_parameter(flags="--turn_bits", name="turn_bits", type=int, |
|
default=HARPY_DEFAULTS["turn_bits"], |
|
help="Number (frequency, complex coefficient) pairs in the calculation" |
|
" is 2 ** turn_bits, i.e. the difference between " |
|
"two neighbouring frequencies is 2 ** (- turn_bits - 1).") |
|
params.add_parameter(flags="--output_bits", name="output_bits", type=int, |
|
default=HARPY_DEFAULTS["output_bits"], |
|
help="Number (frequency, complex coefficient) pairs in the output " |
|
"is up to 2 ** output_bits (maximal in case full spectra is output). " |
|
"There is one pair (with maximal amplitude of complex coefficient) " |
|
"per interval of size 2 ** (- output_bits - 1).") |
|
return params |