diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..986c233 Binary files /dev/null and b/.DS_Store differ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/ARI_SXN_SimBeamline.iml b/.idea/ARI_SXN_SimBeamline.iml new file mode 100644 index 0000000..8b8c395 --- /dev/null +++ b/.idea/ARI_SXN_SimBeamline.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..db8786c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e965678 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store index f1d3399..306b313 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/ari_sxn_simbeamline/.DS_Store b/src/ari_sxn_simbeamline/.DS_Store new file mode 100644 index 0000000..eb246b1 Binary files /dev/null and b/src/ari_sxn_simbeamline/.DS_Store differ diff --git a/src/ari_sxn_simbeamline/Caproto_servers/Mirror_section.py b/src/ari_sxn_simbeamline/Caproto_servers/Mirror_section.py index d8e3d29..9fb6f0b 100644 --- a/src/ari_sxn_simbeamline/Caproto_servers/Mirror_section.py +++ b/src/ari_sxn_simbeamline/Caproto_servers/Mirror_section.py @@ -3,10 +3,66 @@ Caproto IOC servers """ from caproto.ioc_examples.fake_motor_record import FakeMotor -from caproto.server import PVGroup, SubGroup, ioc_arg_parser, run +from caproto.server import PVGroup, SubGroup, pvproperty, ioc_arg_parser, run from textwrap import dedent +class FourBladeCurrent(PVGroup): + """ + A PVGroup that generates the PVs associated with the 4 blade electrometer. + + This class should be used to define the PVs for the 4 blade electrometers used + in the ARI and SXN beamlines for the Baffle slits. + + TODO: + 1. Work out how we want to update the returned current values based on the position + of the blades and the upstream mirrors. + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # call the PVGroup __init__ function + + # Add the current PVs + top = pvproperty(value=3E-6, name=':top', read_only=True) + bottom = pvproperty(value=3E-6, name=':bottom', read_only=True) + inboard = pvproperty(value=3E-6, name=':inboard', read_only=True) + outboard = pvproperty(value=3E-6, name=':outboard', read_only=True) + + +class BaffleSlit(PVGroup): + """ + A PVGroup that generates the PVs associated with the ARI M1 mirror system. + + This class should be used to define the Baffle Slit system PVs for the baffle slits + used in the ARI and SXN beamlines. It will consist of PVs for each of the associated + motors for each baffle as well as the photo-current PVs from each of the blades. + + TODO: + 1. Work out how we want to define the area detector PVs, including how we 'update' + the photo-current PVs based from each of the blades when the mirror and/or baffles + are moved. + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # call the PVGroup __init__ function + + # Add the baffle motor PVs. + top = SubGroup(FakeMotor, velocity=0.1, precision=6E-3, acceleration=1.0, + resolution=6E-3, user_limits=(-1, 20), tick_rate_hz=10., + prefix=':top') + bottom = SubGroup(FakeMotor, velocity=0.1, precision=6E-3, acceleration=1.0, + resolution=6E-3, user_limits=(-20, 1), tick_rate_hz=10., + prefix=':bottom') + inboard = SubGroup(FakeMotor, velocity=0.1, precision=6E-3, acceleration=1.0, + resolution=6E-3, user_limits=(-20, 1), tick_rate_hz=10., + prefix=':inboard') + outboard = SubGroup(FakeMotor, velocity=0.1, precision=6E-3, acceleration=1.0, + resolution=6E-3, user_limits=(-1, 20), tick_rate_hz=10., + prefix=':outboard') + + current = SubGroup(FourBladeCurrent, prefix=':current') + + class AriM1Mirror(PVGroup): """ A PVGroup that generates the PVs associated with the ARI M1 mirror system. @@ -21,40 +77,50 @@ class AriM1Mirror(PVGroup): - This may help create a cohesive connection between them but also blurs the lines between vacuum sections and physical devices. 2. Add the vacuum component (gauges, pumps, valves, ....). - - This may require defining vacuum component PVGroups. + - Temporary read only PVs have been created but I need to see what other PVs + are associated with this hardware that we may want to simulate. Parameters ---------- *args : list - The arguments passed to the PVGroup parent class + The arguments passed to the PVGroup parent class. **kwargs : list, optional - The Keyword arguments passed to the PVGroup parent class + The Keyword arguments passed to the PVGroup parent class. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # call the PVGroup __init__ function + # Add the mirror motor PVs. Ry_coarse = SubGroup(FakeMotor, velocity=0.1, precision=6E-5, acceleration=1.0, resolution=6E-5, user_limits=(-3.15, -1.15), tick_rate_hz=10., - prefix='Ry_coarse') + prefix=':Ry_coarse') Ry_fine = SubGroup(FakeMotor, velocity=0.1, precision=6E-7, acceleration=1.0, resolution=6E-7, user_limits=(-0.03, 0.03), tick_rate_hz=10., - prefix='Ry_fine') + prefix=':Ry_fine') Rz = SubGroup(FakeMotor, velocity=0.1, precision=6E-5, acceleration=1.0, resolution=6E-5, user_limits=(-2.3, 2.3), tick_rate_hz=10., - prefix='Rz') + prefix=':Rz') x = SubGroup(FakeMotor, velocity=0.0001, precision=5., acceleration=1.0, resolution=5., user_limits=(-10000., 10000.), tick_rate_hz=1E-3, - prefix='x') + prefix=':x') y = SubGroup(FakeMotor, velocity=0.1, precision=5., acceleration=1.0, resolution=5., user_limits=(-10000., 10000.), tick_rate_hz=10., - prefix='y') + prefix=':y') + + # Add the mirror chamber vacuum PVs. + ccg = pvproperty(value=3E-10, name=':ccg', read_only=True) + tcg = pvproperty(value=1E-4, name=':tcg', read_only=True) + ip = pvproperty(value=4E-10, name=':ip', read_only=True) + + # Add the baffle slit PVs. + baffle = SubGroup(BaffleSlit, prefix=':baffle') # Add some code to start a version of the server if this file is 'run'. if __name__ == "__main__": ioc_options, run_options = ioc_arg_parser( - default_prefix="ARI:M1:", + default_prefix="ARI_M1", desc=dedent(AriM1Mirror.__doc__)) ioc = AriM1Mirror(**ioc_options) run(ioc.pvdb, **run_options) diff --git a/src/ari_sxn_simbeamline/Caproto_servers/__pycache__/Mirror_section.cpython-312.pyc b/src/ari_sxn_simbeamline/Caproto_servers/__pycache__/Mirror_section.cpython-312.pyc new file mode 100644 index 0000000..f84d0a0 Binary files /dev/null and b/src/ari_sxn_simbeamline/Caproto_servers/__pycache__/Mirror_section.cpython-312.pyc differ diff --git a/src/ari_sxn_simbeamline/__pycache__/__init__.cpython-312.pyc b/src/ari_sxn_simbeamline/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..a99f945 Binary files /dev/null and b/src/ari_sxn_simbeamline/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/ari_sxn_simbeamline/__pycache__/_version.cpython-312.pyc b/src/ari_sxn_simbeamline/__pycache__/_version.cpython-312.pyc new file mode 100644 index 0000000..8d4dd99 Binary files /dev/null and b/src/ari_sxn_simbeamline/__pycache__/_version.cpython-312.pyc differ diff --git a/src/ari_sxn_simbeamline/_version.py b/src/ari_sxn_simbeamline/_version.py index 27ed970..dc5710b 100644 --- a/src/ari_sxn_simbeamline/_version.py +++ b/src/ari_sxn_simbeamline/_version.py @@ -12,5 +12,5 @@ __version_tuple__: VERSION_TUPLE version_tuple: VERSION_TUPLE -__version__ = version = '0.1.dev3+gddc9ce4' -__version_tuple__ = version_tuple = (0, 1, 'dev3', 'gddc9ce4') +__version__ = version = '0.1.dev4+g5b78bf3' +__version_tuple__ = version_tuple = (0, 1, 'dev4', 'g5b78bf3')