Machine Information Tools
Print Machine Settings Overview
Prints an overview over the machine settings at a provided given time, or the current settings if no time is given. If an output path is given, all info will be written into tfs files, otherwise a summary is logged into console.
Knob values can be extracted and the knob definition gathered. For brevity reasons, this data is not logged into the summary in the console. If a start time is given, the trim history for the given knobs can be written out as well. This data is also not logged.
Can be run from command line, parameters as given in pylhc.machine_settings_info.get_info()
.
All gathered data is returned, if this function is called from python.
usage: machine_settings_info.py [-h] [--time TIME] [--start_time START_TIME]
[--knobs KNOBS [KNOBS ...]] [--accel ACCEL]
[--beamprocess BEAMPROCESS] [--output_dir OUTPUT_DIR]
[--knob_definitions] [--source SOURCE] [--log]
optional arguments:
-h, --help show this help message and exit
--time TIME UTC Time as 'Y-m-d H:M:S.f' or ISO format or AccDatetime object.
Acts as point in time or end time (if ``start_time`` is given).
--start_time START_TIME
UTC Time as 'Y-m-d H:M:S.f' or ISO format or AccDatetime object.
Defines the beginning of the time-range.
--knobs KNOBS [KNOBS ...]
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.
--accel ACCEL Accelerator name.
--beamprocess BEAMPROCESS
Manual override for the Beamprocess
(otherwise taken at the given ``time``)
--output_dir OUTPUT_DIR
Output directory.
--knob_definitions Set to extract knob definitions.
--source SOURCE Source to extract data from.
--log Write summary into log (automatically done if no output path is given).
- author:
jdilly
- 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
andstart_time
, the extractedbeamprocess
-info andoptics
-info, thetrim_histories
and current (i.e. at giventime
)trims
and theknob_definitions
, if extracted.
- pylhc.machine_settings_info.log_summary(acc_time: AccDatetime, bp_info: DotDict, optics_info: DotDict = None, trims: Dict[str, float] = None)[source]
Log the summary.
- Parameters:
acc_time (
AccDatetime
) -- User given Timebp_info (
DotDict
) -- BeamProcess Info Dictionaryoptics_info (
DotDict
) -- Optics Info Dictionarytrims (
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, trims: Dict[str, float] = None)[source]
Write summary into a
tfs
file.
- pylhc.machine_settings_info.write_trim_histories(output_path: Path, trim_histories: Dict[str, namedtuple], accel: str, acc_time: AccDatetime = None, acc_start_time: AccDatetime = None, bp_info: DotDict = None, optics_info: DotDict = 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 intotrim_histories (
dict
) -- trims histories as extracted via LSA.get_trim_history()accel (
str
) -- Name of the acceleratoracc_time (
AccDatetime
) -- User given (End)Timeacc_start_time (
AccDatetime
) -- User given Start Timebp_info (
DotDict
) -- BeamProcess Info Dictionaryoptics_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.