e15190.runlog.query.ElogQuery

class e15190.runlog.query.ElogQuery(load_run_batches=True, update_run_batches=False, save_run_batches=False)

Functions

__init__([load_run_batches, ...])

Query for the Elog database.

determine_run_batches([...])

Determine the run batches.

get_run_batches_summary()

Updates and returns the run batches summary.

load_run_batches([filepath])

Load the run batches from a CSV file.

save_run_batches([filepath])

Save the run batches to a CSV file.

Properties

df

The Elog database pandas dataframe.

batch_unified_properties

Properties that are unified across all runs in a single batch.

max_run_gap

Maximum allowed gap between runs in a single batch.

df_batches

A summary of batch properties rather than run properties.

__init__(load_run_batches=True, update_run_batches=False, save_run_batches=False)

Query for the Elog database.

Parameters
  • load_run_batches (bool, default True) – Invoke load_run_batches() upon initialization.

  • update_run_batches (bool, default False) – Invoke determine_run_batches(), then get_run_batches_summary() upon initialization. If True, load_run_batches will be ignored, and the run batches will be re-determined.

  • save_run_batches (bool, default False) – Invoke save_run_batches() upon initialization. This is useful when the run batches are re-determined and we want the new run batches to be saved into a CSV file.

df

The Elog database pandas dataframe.

batch_unified_properties

Properties that are unified across all runs in a single batch.

max_run_gap

Maximum allowed gap between runs in a single batch.

df_batches

A summary of batch properties rather than run properties.

determine_run_batches(batch_unified_properties=None, max_run_gap=None, additional_runs=None)

Determine the run batches.

A run batch or simply batch is a group of runs that share the same properties like beam energy and target, so that merging the events across runs within the same batch makes physical sense. Run batches are useful when analyzing quantities (e.g. PSD parameters) that require statistics from multiple runs.

This function tries to determine the run batches by comparing the properties of the runs. Additional batches can also be specified by the argument additional_runs. At the end, self.df will be updated to use a 2-level index, namely, ibatch and irun. The ibatch index is the enumeration of run batches; the irun index is a consecutive enumeration of all runs across all batches. Both indices start from 0.

While we might expect physical properties of the runs within one single batch to be comparable, there is no guarantee for that. As an example, consider a batch consists of run 12, 13, 14, 15. All the runs have the same reaction systems, Ca40 + Ni58 at 140 MeV/u, without shadow bars. However, there is no guarantee that, say, the position calibration parameters are similar for all four runs. Some hardware differences or DAQ settings might cause one of the runs to be very different from the rest. Further analysis is required to study those differences across runs.

Parameters
  • batch_unified_properties (list of str, default None) – A list of properties that are unified across all runs in a single batch. This means that whenever one of these properties changes, a breakpoint will be set to separate the runs into different batches. Any column in self.df can be used. If None, the function uses batch_unified_properties.

  • max_run_gap (np.timedelta64, default None) – Maximum allowed gap between runs in a single batch. If None, the function uses max_run_gap.

  • additional_runs (list of int, default None) – A list of run numbers that will be used to create additional batches. The runs should specify the first run of a batch.

get_run_batches_summary()

Updates and returns the run batches summary.

This function updates the dataframe df_batches, which contains the following columns:

  • ibatch (int): the enumeration of run batches (starting from 0)

  • run_min (int): first run number

  • run_max (int): last run number

  • n_runs (int): number of runs

  • n_skipped_runs (int): number of runs that are skipped

  • begin_time (Timestamp): begin time of the first run

  • end_time (Timestamp): end time of the last run

  • total_elapse (Timedelta): total elapsed time of all the runs

  • total_gap_time (Timedelta): total gap time between all the runs

  • target (str): e.g. Ni58, Ni64, Sn112, Sn124.

  • beam (str): e.g. Ca40, Ca48

  • beam_energy (float): beam energy in MeV/u

  • shadow_bar (str): shadow bar configuration, i.e. “in” or “out”

  • trigger_rate_min (float): minimum trigger rate

  • trigger_rate_max (float): maximum trigger rate

  • trigger_rate_mean (float): mean trigger rate

Returns

df_batches – A dataframe that lists the batch properties.

Return type

pandas.DataFrame

save_run_batches(filepath=None)

Save the run batches to a CSV file.

Parameters

filepath (str or pathlib.Path, default None) – The path to the CSV file. If None, the function uses run_batches_path.

load_run_batches(filepath=None)

Load the run batches from a CSV file.

Parameters

filepath (str or pathlib.Path, default None) – The path to the CSV file. If None, the function uses run_batches_path.