Online Model Tools

Online Model Extractor

Module online_model.extractor_wrapper

Python wrapper to use the online model extractor with some conversion functionality.

Warning

Needs to be run from the technical network or using a cwd with server and local access.

online_model.extractor_wrapper.extract_all_knob_names(time=None, only_active=True, cwd='./', server=None)[source]

DOES NOT WORK BECAUSE OF ONLINE-MODEL-EXTRACTOR BUGS…. Extract all knobs present at given time.

Args:
time: UTC time in ISO format (default: now) only_active (bool): If set, returns only knobs with non-zero value. cwd: output directory for results and log (default: current directory) server: server to run on (default: runs local)
online_model.extractor_wrapper.extract_knob_value_and_definition(knob_names, time, cwd='./', server=None)[source]

Extract knob values from online model using the knob name and the time.

Example Call:

extract_knob_values("LHCBEAM/2018_global_ats_flat_b1_for_ip5_waist",
                    "2018-10-30 15:00:00.0",
                    cwd="/afs/cern.ch/user/j/jdilly/extractor/",
                    server="cs-ccr-dev3")
Parameters:
  • knob_names (list) -- List of knob names to extract
  • time -- UTC time in ISOformat to extract
  • cwd -- output directory for results and log (default: current directory)
  • server -- server to run on (default: runs local)
online_model.extractor_wrapper.extract_overview(knob_names, time=None, cwd='./', server=None, show_plot=False)[source]

Extract overview-data consisting of - beamprocess - optics used - values of given Knobs - orbit plot

Parameters:
  • knob_names (list) -- List of knob names to extract
  • time -- UTC time in ISO format (default: now)
  • cwd -- output directory for results and log (default: current directory)
  • server -- server to run on (default: runs local)

Helper Modules

Module online_model.data_converter

Functions to convert the online model output files.

online_model.data_converter.convert_local_time_to_utc(time)[source]

Converts local time in isoformat to UTC time

online_model.data_converter.convert_utc_time_to_local(time)[source]

Converts UTC time in isoformat to local time

online_model.data_converter.get_fill_from_orbitfile(orbit_file)[source]

Extracts the fill number from orbit file (-oe switch in online model extractor).

Parameters:orbit_file -- Path to orbit file.
online_model.data_converter.get_knobs_and_trims_from_log(log_file)[source]

Extract the knobs line from the log file.

Parameters:log_file -- Path to log file.
online_model.data_converter.get_optics(optics_file)[source]

Extracts Optics from optics file (-e switch in online model extractor).

online_model.data_converter.get_utc_now()[source]

Returns current utc time as timeformat

online_model.data_converter.knobs_k_to_tfs(knob_file='knobs.madx', trim=None)[source]

Convert from knobs.madx output file to a proper tfs file.

Assumes no one changes the output order. See global variables is this file.

Parameters:
  • knob_file -- path to online model extractor K-Type output file.
  • trim -- trim value if available.
Returns:

List of TfsDataFrames, one for each knob.

online_model.data_converter.knobs_kvalues_to_tfs(knob_file='knobs.madx')[source]

Convert data from KNOBVALUES extraction to tfs file.

Parameters:knob_file -- path to online model extractor KNOBVALUE-Type output file.
Returns:TfsDataFrame with trimvalues and additional time an beamprocess in headers.
online_model.data_converter.post_trim_extract(change_file)[source]

Extract trim value and move file to better filename

Module online_model.constants

Functions to retrieve constants in online model extractor.

online_model.constants.get_change_filename_out()[source]

Default changeparameters filename

online_model.constants.get_default_knob_summary_filename(idx)[source]

Default knob summary filename (output of extractor)

online_model.constants.get_default_orbit_filename(beam)[source]

Default orbit filename (output of extractor

online_model.constants.get_experiment_timezone()[source]

Get time zone for measurement data.

online_model.constants.get_extractor_knobs_filename()[source]

Default knob filename (output of extractor)

online_model.constants.get_extractor_log_filename()[source]

Default log filename (output of extractor)

online_model.constants.get_extractor_output_filename()[source]

Default output filename of extractor

online_model.constants.get_knob_tfs_filename(knob)[source]

Default changeparameters filename

online_model.constants.get_ktype(ktype)[source]

Maps from more understandable names to modelextractor names.

online_model.constants.get_om_extractor()[source]

AFS-path to online model extractor

online_model.constants.get_overview_filename()[source]

Default changeparameters filename

online_model.constants.get_time_format()[source]

Default time format