scheme_utils
This class is used to inspect and compute some properties of the filling scheme.
get_worst_bunch(filling_scheme_path, number_of_LR_to_consider=26, beam='beam_1')
Adapted from https://github.com/PyCOMPLETE/FillingPatterns/blob/5f28d1a99e9a2ef7cc5c171d0cab6679946309e8/fillingpatterns/bbFunctions.py#L233
Given a filling scheme, containing two arrays of booleans representing the trains of bunches for the two beams, this function returns the worst bunch for each beam, according to their collision schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filling_scheme_path
|
str
|
Path to the filling scheme file. |
required |
number_of_LR_to_consider
|
int
|
Number of long range collisions to consider. Defaults to 26. |
26
|
beam
|
str
|
Beam for which to compute the worst bunch. Defaults to "beam_1". |
'beam_1'
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The worst bunch for the specified beam. |
Source code in study_da/generate/master_classes/scheme_utils.py
load_and_check_filling_scheme(filling_scheme_path)
Load and check the filling scheme from a JSON file. Convert the filling scheme to the correct format if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filling_scheme_path
|
str
|
Path to the filling scheme file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Path to the converted filling scheme file. |
Source code in study_da/generate/master_classes/scheme_utils.py
reformat_filling_scheme_from_lpc(filling_scheme_path, filling_scheme_path_converted)
This function is used to convert the filling scheme from the LPC to the format used in the xtrack library. The filling scheme from the LPC is a list of bunches for each beam, where each bunch is represented by a 1 in the list. The function converts this list to a list of indices of the filled bunches. The function also returns the indices of the filled bunches for each beam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filling_scheme_path
|
str
|
Path to the filling scheme file. |
required |
filling_scheme_path_converted
|
str
|
Path to the converted filling scheme file. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: Indices of the filled bunches for each beam. |