Machine Information Tools

class pylhc.machine_settings_info.AccDatetimeOrStr(value)[source]

A class that accepts AccDateTime and strings.

pylhc.machine_settings_info.get_info(opt) Dict[str, object][source]

Get info about Beamprocess, Optics and Knobs at given time.

Keyword Args:

--Optional--

  • accel (str):

    Accelerator name.

    default: lhc

  • beamprocess (str):

    Manual override for the Beamprocess (otherwise taken at the given time)

    default: None

  • knob_definitions:

    Set to extract knob definitions.

    action: store_true

  • knobs (str):

    List of knobnames. If None (or omitted) no knobs will be extracted. If it is just the string 'all', all knobs will be extracted (can be slow). Use the string 'default' for pre-defined knobs of interest. If this is called from python, the strings need to be put as single items into a list.

    default: None

  • log:

    Write summary into log (automatically done if no output path is given).

    action: store_true

  • output_dir (PathOrStr):

    Output directory.

    default: None

  • source (str):

    Source to extract data from.

    default: nxcals

  • start_time (AccDatetime, str):

    UTC Time as ‘Y-m-d H:M:S.f’ format or AccDatetime object. Defines the beginning of the time-range.

    default: None

  • time (AccDatetime, str):

    UTC Time as ‘Y-m-d H:M:S.f’ format or AccDatetime object. Acts as point in time or end time (if start_time is given).

    default: None

Returns:

dict: Dictionary containing the given time and start_time, the extracted beamprocess-info and optics-info, the trim_histories and current (i.e. at given time) trims and the knob_definitions, if extracted.

pylhc.machine_settings_info.log_summary(acc_time: AccDatetime, bp_info: DotDict, optics_info: DotDict | None = None, trims: Dict[str, float] | None = None)[source]

Log the summary.

Parameters:
  • acc_time (AccDatetime) -- User given Time

  • bp_info (DotDict) -- BeamProcess Info Dictionary

  • optics_info (DotDict) -- Optics Info Dictionary

  • trims (dict) -- Trims key-value dictionary

pylhc.machine_settings_info.write_knob_defitions(output_path: Path, definitions: dict)[source]

Write Knob definitions into a tfs file.

pylhc.machine_settings_info.write_summary(output_path: Path, accel: str, acc_time: AccDatetime, bp_info: DotDict, optics_info: DotDict | None = None, trims: Dict[str, float] | None = None)[source]

Write summary into a tfs file.

Parameters:
  • output_path (Path) -- Folder to write output file into

  • accel (str) -- Name of the accelerator

  • acc_time (AccDatetime) -- User given Time

  • bp_info (DotDict) -- BeamProcess Info Dictionary

  • optics_info (DotDict) -- Optics Info Dictionary

  • trims (dict) -- Trims key-value dictionary

pylhc.machine_settings_info.write_trim_histories(output_path: Path, trim_histories: Dict[str, namedtuple], accel: str, acc_time: AccDatetime | None = None, acc_start_time: AccDatetime | None = None, bp_info: DotDict | None = None, optics_info: DotDict | None = None)[source]

Write the trim histories into tfs files. There are two time columns, one with timestamps as they are usually easier to handle and one with the UTC-string, as they are more human-readable.

Parameters:
  • output_path (Path) -- Folder to write output file into

  • trim_histories (dict) -- trims histories as extracted via LSA.get_trim_history()

  • accel (str) -- Name of the accelerator

  • acc_time (AccDatetime) -- User given (End)Time

  • acc_start_time (AccDatetime) -- User given Start Time

  • bp_info (DotDict) -- BeamProcess Info Dictionary

  • optics_info (DotDict) -- Optics Info Dictionary

BSRT logger

Script used during Run II to log detailed BSRT data and save it for later analysis. Data from the BSRT for each timestep is put in a dictionary and append to a list. The list is then saved to disk through pickling. Proper testing requires communication with FESA s class, possible only from the Technical Network.

Original authors: E. H. Maclean, T. Persson and G. Trad.