GetLLM

Entry Points GetLLM

Module GetLLM.GetLLM

class GetLLM.GetLLM.DepInjector[source]

Small “kind of” dependency injector to handle GetLLM operations.

This class provides a shared namespace of dependencies between GetLLM operations.

exception MissingRequirementError[source]
initial(provides, value)[source]

Defines a value in the dependency injector namespace.

Parameters:
  • provides -- Name of the value to define.
  • value -- Value of the value to define.
trigger(funct=None, requires=None, provides=None, critical=False)[source]

Resolves dependecies and runs the function given in “funct”.

Launches the function given in “funct” defining the return variables given in “provides”. This function will check that all the names given in “requires” are already defined in the injector namespace with a result values, otherwise a KeyError will be thrown. If at least one of the requieres is marked as unavailable (because its defining computation failed), this computation will mark its own “provides” as unavailable as well.

Parameters:
  • funct -- Callable to run.
  • requires -- Iterable of names that must be availabe for this to run.
  • provides -- Iterable of names that “funct” defines. It must have the same length as the values “funct” returns.
  • critical -- If true, if for some reason this function cannot run, an exception will be raised.
Returns:

The same instance of DepInjector to allow method chaining.

GetLLM.GetLLM.main(outputpath, files_to_analyse, model_filename, dict_file='0', accel='LHCB1', lhcphase='0', bpmu='um', cocut=4000, nbcpl=2, nonlinear=False, tbtana='SUSSIX', bbthreshold='0.15', errthreshold='0.15', use_only_three_bpms_for_beta_from_phase=0, number_of_bpms=10, range_of_bpms=11, use_average=0, calibration_dir_path=None, errordefspath=None, nprocesses=16, onlycoupling=0, use_error_of_mean=0)[source]

GetLLM main function.

Parameters:
  • outputpath (string) -- The output path to store results
  • files_to_analyse (string) -- List of files, comma separated string.
  • model_filename (string) -- Path and filename of model to be used
  • dict_file (string) -- Name of the script which will be executed. Should store dictionary with mappings of BPM names.
  • accel (string) -- Type of accelerator. LHCB1, LHCB2, LHCB4, RHIC, SPS
  • lhcphase (string) -- “0” or “1” -- Compensate phase shifts by tunes for the LHC experiment data, off=0(default)/on=1
  • BPMU (string) -- BPMunit: “um”, “mm”, “cm”, “m” (default “um”)
  • COcut (int) -- Cut for closed orbit measurement [um]
  • NBcpl (int) -- For selecting the coupling measurement method 1 bpm or 2 bpms
  • TBTana (string) -- Turn-by-turn data analysis algorithm: SUSSIX, SVD or HA
  • bbthreshold (string) -- Threshold for _calculate_kick for (beta_d-beta_m)/beta_m
  • errthreshold (string) -- Threshold for calculate_kick for sigma(beta_d)/beta_d
  • use_only_three_bpms_for_beta_from_phase (int) --
  • number_of_bpms (int) -- Number of BPM-combos for beta from phase
  • range_of_bpms (int) -- Range of BPMs for beta from phase
  • use_average (int) -- Uses AVG_MUX and AVG_MUY in _analyse_src_files if 1
Returns:

int -- 0 if the function run successfully otherwise !=0.

Module GetLLM.getsuper

Created sometime 2009-2011

maintainer:Yngve Inntjore Levinsen
author:Glenn Vanbavinckhove, Yngve Inntjore Levinsen
version:3.1.3

Getsuper calculates with the help of GetLLM chromatic beta functions. The Montague W and Phi functions are output.

What getsuper essentially does is run GetLLM on files with different dp/p and then afterwards interpolate the results to see how the functions vary with dp/p.

To run getsuper.py you need several source files(sdds files) with different DPP(delta_p/p). At least one of the source files must have DPP=0.0 . Hint: You can change DPP in the GUI application in the Analysis panel. Change the entries in the column ‘dp/d’ in the table at the top.

Further you need AC dipole in your model. If your twissfile is ‘Twiss.dat’ you need to provide the file ‘Twiss_ac.dat’ in the same directory.

Usage cmd line:

Usage: getsuper.py [options] sdds-file1 [sdds-file2 ...]

Options:
  -h, --help            show this help message and exit
  -f TwissFile, --files=TwissFile
                        Files from analysis, separated by comma
  --twissfile=/path/to/twiss.dat
                        Twiss file to use
  -o <path>, --output=<path>
                        Output path, where to store the results
  -b <path>, --beta=<path>
                        Path to Beat-Beat.src folder
  -t ALGORITHM, --algorithm=ALGORITHM
                        Which algorithm to use (SUSSIX/SVD)
  -a ACCEL, --accel=ACCEL
                        Which accelerator: LHCB1 LHCB2 SPS RHIC
  -d <deltapScalingFactor>, --deltapScalingFactor=<deltapScalingFactor>
                        Scaling factor for deltap, remember final value must
                        be in MAD units

Usage in another Python module:

import GetLLM.getsuper
...
GetLLM.getsuper.main(my_src_files_list, path_to_twiss_file)
GetLLM.getsuper.check_input(opt)[source]

Approves the input and sets default

GetLLM.getsuper.linreg(X, Y)[source]

Returns coefficients to the regression line “y=ax+b” from x[] and y[], and R^2 Value

Summary:
Linear regression of y = ax + b
Usage:
real, real, real = linreg(list, list)
GetLLM.getsuper.main(**kwargs)[source]

getsuper main function

Keyword Arguments:
 
  • source_files (list) -- list of strings with file_paths to TFS files
  • twissfile (str) -- path to TFS model file
  • output_path (str) -- Path to store created files
  • algorithm (str) -- Used Turn-by-turn data analysis algorithm: ‘SUSSIX’, ‘SVD’ or ‘HA’
  • accel_cls (accelerator) -- Accelerator class object
  • deltap_scaling_factor (float) -- Scaling factor for deltap, remember final value must be in MAD units