mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-26 12:41:09 +02:00
refactor: add script to export info on blocks from panda to yaml
This commit is contained in:
2469
ophyd_devices/devices/block_info.yaml
Normal file
2469
ophyd_devices/devices/block_info.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,32 @@
|
|||||||
|
""" Field Types
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Each field type determines the set of attributes available for the field. The
|
||||||
|
types and their attributes are documented below.
|
||||||
|
|
||||||
|
=================== ============================================================
|
||||||
|
Field type Description
|
||||||
|
=================== ============================================================
|
||||||
|
``param`` subtype Configurable parameter. The `subtype` determines the
|
||||||
|
precise behaviour and the available attributes.
|
||||||
|
``read`` subtype A read only hardware field, used for monitoring status.
|
||||||
|
Again, `subtype` determines available attributes.
|
||||||
|
``write`` subtype A write only field, `subtype` determines possible values
|
||||||
|
and attributes.
|
||||||
|
``time`` Configurable timer parameter.
|
||||||
|
``bit_out`` Bit output, can be configured as bit input for ``bit_mux``
|
||||||
|
fields.
|
||||||
|
``pos_out`` Position output, can be configured for data capture and as
|
||||||
|
position input for ``pos_mux`` fields.
|
||||||
|
``ext_out`` extra Extended output values, can be configured for data capture,
|
||||||
|
but not available on position bus.
|
||||||
|
``bit_mux`` Bit input with configurable delay.
|
||||||
|
``pos_mux`` Position input multiplexer selection.
|
||||||
|
``table`` Table data with special access methods.
|
||||||
|
=================== ============================================================
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class BitMuxField(FieldBase):
|
|||||||
max_delay: Optional[int]
|
max_delay: Optional[int]
|
||||||
|
|
||||||
|
|
||||||
available_fields = {
|
PANDA_FIELDS = {
|
||||||
"uint": UIntField,
|
"uint": UIntField,
|
||||||
"int": IntField,
|
"int": IntField,
|
||||||
"scalar": ScalarField,
|
"scalar": ScalarField,
|
||||||
|
33
ophyd_devices/devices/parse_block_info_from_panda.py
Normal file
33
ophyd_devices/devices/parse_block_info_from_panda.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
def main():
|
||||||
|
from ophyd_devices.devices.panda_box import PandaController
|
||||||
|
from ophyd_devices.devices.panda_blocks import PANDA_TYPES
|
||||||
|
from ophyd_devices.devices.panda_fields import PANDA_FIELDS
|
||||||
|
|
||||||
|
from pandablocks.commands import Raw
|
||||||
|
controller = PandaController(name="redpanda", socket_host="x02da-panda-2.psi.ch")
|
||||||
|
# Get info about fields for all blocks
|
||||||
|
block_info = {}
|
||||||
|
# loop over name of all blocks
|
||||||
|
for name in PANDA_TYPES:
|
||||||
|
block_info[name] = {}
|
||||||
|
field_info = controller.send_command(Raw(f"{name}.*?"))
|
||||||
|
for field in sorted(field_info):
|
||||||
|
if not field.strip("."):
|
||||||
|
continue
|
||||||
|
field_name = field.split(" ")[0].strip("!")
|
||||||
|
field_type = field.split(" ")[2:]
|
||||||
|
block_info[name][field_name] = {"type" : field_type}
|
||||||
|
|
||||||
|
print(block_info)
|
||||||
|
import yaml
|
||||||
|
import os
|
||||||
|
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
output_file = os.path.join(cur_dir, "block_info.yaml")
|
||||||
|
with open(output_file, "w") as file:
|
||||||
|
yaml.dump(block_info, file, default_flow_style=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Reference in New Issue
Block a user