Skip to content

Commit

Permalink
slit_test
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhang234 committed Oct 16, 2024
1 parent 0ae10c6 commit 635bc54
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/instrument/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .meascomp_usb_ctr import mcs
from .qnw_device import qnw_env1, qnw_env2, qnw_env3
from .slit_base import sl4_base, sl5_base, sl7_base, sl8_base, sl9_base
from .slit import sl4, sl5, sl7, sl8, sl9
from .slit import sl5, sl9 #, sl7, sl8,sl4,
from .tetramm_picoammeter import tetramm1, tetramm2, tetramm3, tetramm4
from .transfocator_8idd import rl1
from .transfocator_8ide import rl2
Expand Down
86 changes: 79 additions & 7 deletions src/instrument/devices/slit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import logging

from apstools.devices.positioner_soft_done import PVPositionerSoftDone
from ophyd import EpicsMotor
from ophyd import FormattedComponent as FCpt
from apstools.synApps.db_2slit import Optics2Slit1D
from apstools.synApps.db_2slit import Optics2Slit2D_HV
from ophyd import Component as cpt
Expand All @@ -23,6 +25,17 @@


class ID8Optics2Slit1D(Optics2Slit1D):

def __init__(
self,
prefix: str,
secondary_prefix: str,
positive_motor: str,
negative_motor: str,
*args,
**kwargs,
):

xn = cpt(
PVPositionerSoftDone,
"xn",
Expand Down Expand Up @@ -53,14 +66,73 @@ class ID8Optics2Slit1D(Optics2Slit1D):
)
sync = cpt(EpicsSignal, "doSync", put_complete=True, kind="omitted")

p = FCpt(EpicsMotor, "{secondary_motor_prefix}:{positive_motor}", labels={"motors"})
n = FCpt(EpicsMotor, "{secondary_motor_prefix}:{negative_motor}", labels={"motors"})



# class ID8Optics2Slit2D_HV(Optics2Slit2D_HV):
# def __init__(
# self,
# prefix: str,
# secondary_prefix: str,
# h_positive_motor: str,
# h_negative_motor: str,
# v_positive_motor: str,
# v_negative_motor: str,
# *args,
# **kwargs,
# ):
# print("help me I'm stuck \n\n\n\n")
# h = FCpt(
# ID8Optics2Slit1D,
# prefix,
# secondary_prefix="{secondary_prefix}",
# positive_motor="{h_positive_motor}",
# negative_motor="{h_negative_motor}"
# )

class ID8Optics2Slit2D_HV(Optics2Slit2D_HV):
h = cpt(ID8Optics2Slit1D, "H")
v = cpt(ID8Optics2Slit1D, "V")
def __init__(
self,
prefix: str,
secondary_prefix: str,
h_positive_motor: str,
h_negative_motor: str,
v_positive_motor: str,
v_negative_motor: str,
*args,
**kwargs,
):
super().__init__(prefix, *args, **kwargs)

# Initialize class with provided motor arguments
self.h_positive_motor = h_positive_motor
self.h_negative_motor = h_negative_motor
self.v_positive_motor = v_positive_motor
self.v_negative_motor = v_negative_motor

# Horizontal and vertical slits components, passing motor names dynamically
h = FCpt(
ID8Optics2Slit1D,
"{prefix}",
secondary_prefix="{secondary_prefix}",
positive_motor="{h_positive_motor}",
negative_motor="{h_negative_motor}"
)

v = FCpt(
ID8Optics2Slit1D,
"{prefix}",
secondary_prefix="{secondary_prefix}",
positive_motor="{v_positive_motor}",
negative_motor="{v_negative_motor}"
)



sl4 = ID8Optics2Slit2D_HV("8iddSoft:Slit1", name="sl4")
sl5 = ID8Optics2Slit2D_HV("8ideSoft:Slit1", name="sl5")
sl7 = ID8Optics2Slit2D_HV("8ideSoft:Slit2", name="sl7")
sl8 = ID8Optics2Slit2D_HV("8idiSoft:Slit1", name="sl8")
sl9 = ID8Optics2Slit2D_HV("8idiSoft:Slit2", name="sl9")
# sl4 = ID8Optics2Slit2D_HV("8iddSoft:Slit1", name="sl4")
sl5 = ID8Optics2Slit2D_HV(prefix = "8ideSoft:Slit1", secondary_prefix = "8idiSoft:CR8-E2", h_positive_motor = "m4", h_negative_motor = "m3", v_positive_motor = "m2", v_negative_motor = "m1", ,name="sl5")
# sl7 = ID8Optics2Slit2D_HV("8ideSoft:Slit2", name="sl7")
# sl8 = ID8Optics2Slit2D_HV("8idiSoft:Slit1", name="sl8")
sl9 = ID8Optics2Slit2D_HV(prefix = "8idiSoft:Slit2", secondary_prefix = "8ideSoft:CR8-I2", h_positive_motor = "m12", h_negative_motor = "m11", v_positive_motor = "m10", v_negative_motor = "m9", name="sl9")

0 comments on commit 635bc54

Please sign in to comment.