Analysis Tools

BSRT Analysis

Top-level script to query BRST data, then perform an analysis and output the generated plots. The script runs through the following steps: - Processes the output files of BSRT_logger.py for a given timeframe, returns them in as a TfsDataFrame for further processing. - Additionally, plots for quick checks of fit parameters, auxiliary variables and beam evolution are generated. - If provided a TfsDataFrame file with timestamps, plots of the 2D distribution and comparison of fit parameters to cross sections are added.

Forced DA Analysis

Top-level script to run the forced DA analysis, following the procedure described in CarlierForcedDA2019.

Arguments:

--Required--

  • beam (int): Beam to use.

    Flags: [‘-b’, ‘--beam’] Choices: [1, 2]

  • energy (MultiClass): Beam energy in GeV.

    Flags: [‘-e’, ‘--energy’]

  • kick_directory (MultiClass): Analysis kick_directory containing kick files.

    Flags: [‘-k’, ‘--kickdir’]

  • plane (str): Plane of the kicks.

    Flags: [‘-p’, ‘--plane’] Choices: ['X', 'Y']

--Optional--

  • emittance_outlier_limit (float): Limit, i.e. cut from mean, on emittance outliers in meter.

    Default: 5e-07

  • emittance_tfs (MultiClass): Dataframe or Path of pre-saved emittance tfs.

  • emittance_type (str): Which BSRT data to use (from database).

    Choices: ['fit_sigma', 'average'] Default: average

  • emittance_window_length (int): Length of the moving average window. (# data points)

    Default: 100

  • fill (int): Fill that was used. If not given, check out time_around_kicks.

    Flags: [‘-f’, ‘--fill’]

  • fit (str): Fitting function to use (rearranges parameters to make sense).

    Choices: ['exponential', 'linear'] Default: exponential

  • intensity_tfs (MultiClass): Dataframe or Path of pre-saved intensity tfs.

  • intensity_time_after_kick (int): Defines the times after the kicks (in seconds) which is used for intensity averaging to calculate the losses.

    Default: [5, 30]

  • intensity_time_before_kick (int): Defines the times before the kicks (in seconds) which is used for intensity averaging to calculate the losses.

    Default: [30, 5]

  • normalized_emittance (float): Assumed NORMALIZED nominal emittance for the machine.

    Default: 3.7499999999999997e-06

  • output_directory (MultiClass): Output kick_directory, if not given subfolder in kick kick_directory

    Flags: [‘-o’, ‘--outdir’]

  • pagestore_db (MultiClass): (Path to-) presaved timber database

  • show: Show plots.

    Action: store_true

  • show_wirescan_emittance (BoolOrPathOrDataFrame): Flag if the emittance from wirescan should also be shown, can also be a Dataframe or Path of pre-saved emittance bws tfs.

    Default: False

  • timber_db (str): Which timber database to use.

    Choices: ['all', 'mdb', 'ldb', 'nxcals'] Default: all

  • time_around_kicks (int): If no fill is given, this defines the time (in minutes) when data before the first and after the last kick is extracted.

    Default: 10

  • plot_styles (str): Which plotting styles to use, either from omc3 styles or default mpl.

    Default: ['standard']

  • manual_style (DictAsString): Additional style rcParameters which update the set of predefined ones.

    Default: {}

author:

jdilly

class pylhc.forced_da_analysis.BoolOrPathOrDataFrame(value)[source]

A class that behaves like a boolean when possible, otherwise like a Path, string or Dataframe.

pylhc.forced_da_analysis.PathOrDataframe

alias of SomethingOrPath

pylhc.forced_da_analysis.PathOrPagestore

alias of SomethingOrPath

pylhc.forced_da_analysis.PathOrString

alias of SomethingOrPath

pylhc.forced_da_analysis.fun_exp_decay(p, x)[source]

sp = DA_J, x[0] = action (2J res), x[1] = emittance

pylhc.forced_da_analysis.fun_exp_sigma(p, x)[source]

p = DA_sigma, x = action (J_sigma)

pylhc.forced_da_analysis.fun_linear(p, x)[source]

p = DA_J, x = action (2J res)

pylhc.forced_da_analysis.get_approximate_index(df, item, method='nearest')[source]

Emulates the get_loc from pandas<2.0, i.e. single index input and output.

pylhc.forced_da_analysis.swap_fun_parameters(fun)[source]

Parameter swapped for Curvefit.