lstautorta.plot_line_delay
Script plotting event_ids differences and r0dl1 rates for all observations of a night.
Functions:
| Name | Description |
|---|---|
find_nigth_run_dirs |
Find the observation folders in a night's directory. |
log_uncaught_exceptions |
Makes all uncaught exception to be logged by the default logger. |
parse_line_subrun_dl1_events |
Read a DL1 file, to load the timestamps and event id information. |
parse_run_dl1_events |
Parse an observation DL1 files to load event ids and timestamps in a dataframe |
parse_run_log_files |
Parse the log files of the R0->DL1 process of a run to read the processing rates. |
parse_run_worker_nodes |
Parse the worker nodes of the R0->DL1 jobs during in an observation from hiperta_stream_start log file. |
process_night |
Parses DL1 and log files of an entire night to plot the event ids and processing rates wrt time |
save_line_delays_plot |
Plot and save the event id and the R0->DL1 processing rates wrt to time for an entire night |
find_nigth_run_dirs
Find the observation folders in a night's directory.
In LST, a night directory contains folders for each observation, plus a calibration and a logs folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
night_path
|
Path
|
Path to the night's data folder containing all subruns. |
required |
Returns:
| Type | Description |
|---|---|
List of Paths to all the obersvation folders in the night's directory.
|
|
Source code in src/lstautorta/plot_line_delay.py
log_uncaught_exceptions
Makes all uncaught exception to be logged by the default logger.
Keyboard exceptions and children classes are not logged so one can kill the program with ctr+C.
Source code in src/lstautorta/plot_line_delay.py
parse_line_subrun_dl1_events
parse_line_subrun_dl1_events(line_subrun_dl1_filename, run_id, line_idx, worker_node, nb_retries, re_try_wait_time)
Read a DL1 file, to load the timestamps and event id information.
The separated timestamps_s and timestamp_qns are put back together to single datetime object (ns precision). The event_id diffs is also computed here, as the difference between the event id of an event with respect to the previous one. The first event is set to have an event_id_diff of 0. The "events from the future" are set a event_id_diff of 0, as well as the first event following an event from the future (because event ids of the event from the future are weird).
This function returns None if the file could not be read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line_subrun_dl1_filename
|
Path
|
Path to the dl1 file. |
required |
run_id
|
int
|
Run ID of the events in the file. Written as field in the df. |
required |
line_idx
|
int
|
Line number of the process that wrote this file. Written as field in the df. |
required |
worker_node
|
str
|
Name of the worker node that processed the DL1 file to treat. |
required |
nb_retries
|
int
|
Number of times to re-try opening a file in case of error. |
required |
re_try_wait_time
|
float
|
Amount of time, in seconds, to wait before attempting to open a file again. |
required |
Returns:
| Type | Description |
|---|---|
Pandas dataframe with the subrun event ids and timestamps (and line index, worker node).
|
|
Source code in src/lstautorta/plot_line_delay.py
parse_run_dl1_events
Parse an observation DL1 files to load event ids and timestamps in a dataframe
Paramters
dl1_dir_path : pathlib.Path Path to the folder containing the night's DL1 files. (all runs are in the same folder) run_id : int Run id of the run to analyse worker_nodes : list of str List of the worker nodes names of the R0->DL1 jobs of this run nb_process : int Number of processs to use to parse the runs files. nb_retries : int Number of times to re-try reading a DL1 file. re_try_wait_time : float Amount of time, in seconds, to wait before re-trying to open a file.
Returns:
| Type | Description |
|---|---|
List of pandas dataframe with the events id and timestamps data per subrun.
|
|
Source code in src/lstautorta/plot_line_delay.py
parse_run_log_files
Parse the log files of the R0->DL1 process of a run to read the processing rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs_dir
|
Path
|
Path to the folder containing the R0->DL1 jobs logs. |
required |
run_id
|
int
|
Run id of the run to parse |
required |
worker_nodes
|
list of str
|
List of the worker nodes names of the R0->DL1 jobs of this run |
required |
Returns:
| Type | Description |
|---|---|
List of pandas dataframe with the R0->DL1 processing rates per line during the run.
|
|
Source code in src/lstautorta/plot_line_delay.py
parse_run_worker_nodes
Parse the worker nodes of the R0->DL1 jobs during in an observation from hiperta_stream_start log file.
hiperta_stream_start log file is parsed to read the slurm job ids of the R0->DL1 jobs. Then the worker nodes names are found by interogating sacct.
Paramters
run_data_path : pathlib.Path Path to the observation folder, containing the dl1, dl2 and dl3 directories and the hiperta_stream_start logs.
Returns:
| Type | Description |
|---|---|
List of string: the names of the worker nodes, in the order of the lines.
|
|
Source code in src/lstautorta/plot_line_delay.py
process_night
process_night(night, nb_process, force_reload, data_base_path, obs_relative_dl1_folder, obs_relative_data_folder, relative_logs_folder, output_file_prefix, rate_aggregation_str, nb_retries, re_try_wait_time)
Parses DL1 and log files of an entire night to plot the event ids and processing rates wrt time
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
night
|
str
|
Night data in format "YYYYMMDD" |
required |
nb_process
|
int
|
Number of process to use to parse the files |
required |
force_reload
|
bool
|
If true, the data and logs files are re-processed even if the dataframe is already saved at the output location. |
required |
data_base_path
|
Path
|
Path to the the folder containing the nights directories |
required |
obs_relative_dl1_folder
|
Path
|
Relative path to the folder containing dl1 files from the night directory |
required |
obs_relative_data_folder
|
Path
|
Relative path to the folder containing the data (dl1, dl2, dl3) subfolder from the night directory. |
required |
relative_logs_folder
|
Path
|
Relative path to the folder containing the night's logs from the night repository |
required |
output_file_prefix
|
str
|
Prefix to prepend to the DataFrame and Figure to save. The night str will be appended to make the full output file names. |
required |
rate_aggregation_str
|
str
|
Aggregation string in pandas time grouper syntax. For example for 10 seconds: "10S" |
required |
nb_retries
|
int
|
Number of times to re-try reading a DL1 file. |
required |
re_try_wait_time
|
float
|
Amount of time, in seconds, to wait before re-trying to open a file. |
required |
Source code in src/lstautorta/plot_line_delay.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
save_line_delays_plot
Plot and save the event id and the R0->DL1 processing rates wrt to time for an entire night
Paramters
event_df : pd.DataFrame DataFrame with events data. log_df : pd.DataFrame DataFrame with log files data (processing rate) fig_pickle_path : pathlib.Path Path to where the plot figure should be pickled. rate_aggregation_str : str Aggregation string in pandas time grouper syntax. For example for 10 seconds: "10S"