virtac.create_csv
#
This script does cagets from the live machine to get control limits and then uses this data in combination with hardcoded data in this file to generate csv files. These are used by the Virtac to create softioc records. This script should be manually run using CA port 5064 whenever the csv files need updating.
Members
Data to be written is stored as a list of tuples each with structure: element index (int), field (str), pv (str), value (int), record_type (str). |
|
Get feedback pvs. |
|
Structure of data: |
|
Loop through each element in the lattice and spawn a cothread which will then do a caget to get pv data for the element. |
|
Get the PVs associated with the tune feedback system, the structure of data is: |
|
Get the control limits and precision values from the live machine for all normal PVS. |
|
|
|
The arguments passed to this script to configure how the csv is to be created |
|
Write the collected data to a .csv file with the given name. |
- virtac.create_csv.generate_feedback_pvs(all_elements, lattice: EpicsLattice) list[tuple[str | int, ...]] [source]#
Get feedback pvs. Also get families for tune feedback.
- Parameters:
all_elements – a list of elements
lattice – The pytac lattice being used by the virtual machine.
- Returns:
Data to be written to csv.
- virtac.create_csv.generate_bba_pvs(all_elements, symmetry: int) list[tuple[str | int, ...]] [source]#
Data to be written is stored as a list of tuples each with structure: element index (int), field (str), pv (str), value (int), record_type (str).
- Parameters:
all_elements – a list of elements
symmetry – The number of cells in the lattice.
- Returns:
Data to be written to csv.
- virtac.create_csv.get_element_pv_data(pytac_item: Lattice | Element, pvs: list[str], data: list[tuple[str | int, ...]]) None [source]#
Get the control limits and precision values from the live machine for all normal PVS.
- Parameters:
pytac_item – An element of the pytac lattice or the lattice itself
pvs – A list of pv names which we have already found
data – A list of tuples, with each tuple being a collection of data about one pv.
- virtac.create_csv.generate_pv_limits(lattice: Lattice) list[tuple[str | int, ...]] [source]#
Loop through each element in the lattice and spawn a cothread which will then do a caget to get pv data for the element.
- Parameters:
lattice – The pytac lattice being used by the virtual machine.
- Returns:
Data to be written to csv.
- virtac.create_csv.generate_mirrored_pvs(lattice: Lattice) list[tuple[str | int, ...]] [source]#
Structure of data:
- output_type:
The type of output record to create, only ‘ai’, ‘longIn’, ‘Waveform’ types are currently supported; if ‘’ then output to an existing in record already created in VirtacServer, ‘caput’ is also a special case it creates a mask for cothread.catools.caput calling set(value) on this mask will call caput with the output PV and the passed value.
- mirror_type (The type of mirroring to apply):
basic: set the value of the input record to the output record.
- summate: sum the values of the input records and set the result to
the output record.
collate: create a Waveform record from the values of the input PVs.
- transform: apply the specified transformation function to the value
of the input record and set the result to the output record. N.B. the only transformation type currently supported is ‘inverse’.
- in_pv:
The PV(s) to be monitored, on change mirror is updated, if multiple then the PVs should be separated by a comma and one space.
- out_pv:
The single PV to output to, if a ‘record type’ is spcified then a new record will be created and so must not exist already.
- value:
The inital value of the output record.
- refresh:
Whether the out_pv should have its softioc record’s SCAN field set to ‘1 second’ which will cause it to process every second.
- Parameters:
lattice – The pytac lattice being used by the virtual machine.
- Returns:
Data to be written to csv.
- virtac.create_csv.generate_tune_pvs(lattice: Lattice) list[tuple[str | int, ...]] [source]#
Get the PVs associated with the tune feedback system, the structure of data is:
- set_pv:
The PV to set the offset to.
- offset_pv:
The PV which the set pv reads the offset from.
- delta_pv:
The PV to get the offset from.
- Parameters:
lattice – The pytac lattice being used by the virtual machine.
- Returns:
Data to be written to csv.
- virtac.create_csv.write_data_to_file(data: list[tuple[str | int, ...]], filename: str, ring_mode: str) None [source]#
Write the collected data to a .csv file with the given name. If the file already exists it will be overwritten.
- Parameters:
data – A list of tuples, the data to write to the .csv file.
filename – The name of the .csv file to write the data to.