dodal.devices.util.lookup_tables_apple2#
Classes
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Handles lookup tables for Apple2 ID, converting energy and polarisation to gap and phase. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
Apple2 lookup table utilities and CSV converter.
This module provides helpers to read, validate and convert Apple2 insertion-device lookup tables (energy -> gap/phase polynomials) from CSV sources into an in-memory dictionary format used by the Apple2 controllers.
Data format produced The lookup-table dictionary created by convert_csv_to_lookup() follows this structure:
- {
- “POL_MODE”: {
- “energies”: {
- “<min_energy>”: {
“low”: <float>, “high”: <float>, “poly”: <numpy.poly1d>
}, “limit”: {
“minimum”: <float>, “maximum”: <float>
}
},
}
Functions
|
Convert CSV content into the Apple2 lookup-table dictionary. |
|
|
|
|
|
Return the numpy.poly1d polynomial applicable for the given energy and polarisation. |
|
Generate a dictionary containing multiple lookuptable entries for provided polarisations. |
|
Yield non-comment lines from the CSV content string. |
- dodal.devices.util.lookup_tables_apple2.convert_csv_to_lookup(file_contents: str, lut_config: LookupTableConfig, skip_line_start_with: str = '#') LookupTable[source]#
Convert CSV content into the Apple2 lookup-table dictionary.
- Return type:
Parameters:#
- file_contents:
The CSV file contents as string.
- lut_config:
The configuration that how to process the file_contents into a LookupTable.
- skip_line_start_with
Lines beginning with this prefix are skipped (default “#”).
Returns:#
: LookupTable
- param file_contents:
- type file_contents:
- param lut_config:
- type lut_config:
- param skip_line_start_with:
- type skip_line_start_with:
str, default:"#"
- dodal.devices.util.lookup_tables_apple2.read_file_and_skip(file: str, skip_line_start_with: str = '#') Generator[str][source]#
Yield non-comment lines from the CSV content string.
- dodal.devices.util.lookup_tables_apple2.get_poly(energy: float, pol: Pol, lookup_table: LookupTable) poly1d[source]#
Return the numpy.poly1d polynomial applicable for the given energy and polarisation.
- Return type:
poly1d
Parameters:#
- energy:
Energy value in the same units used to create the lookup table.
- pol:
Polarisation mode (Pol enum).
- lookup_table:
The converted lookup table dictionary for either ‘gap’ or ‘phase’.
- param energy:
- type energy:
- param pol:
- type pol:
- param lookup_table:
- type lookup_table:
- dodal.devices.util.lookup_tables_apple2.generate_lookup_table_entry(min_energy: float, max_energy: float, poly1d_param: list[float]) LookupTableEntries[source]#
- Parameters:
- Return type:
- dodal.devices.util.lookup_tables_apple2.generate_lookup_table(pol: Pol, min_energy: float, max_energy: float, poly1d_param: list[float]) LookupTable[source]#