Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

724 create an ophyd device for apple 2 undulator and add i10 as a beamline #744

Merged
merged 95 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
2ed93ab
first hack
Relm-Arrowny Aug 6, 2024
8f5970d
completed gap motor
Relm-Arrowny Aug 7, 2024
76d3ae6
added test
Relm-Arrowny Aug 8, 2024
3c5cb22
added phase
Relm-Arrowny Aug 9, 2024
7d9778d
phase axes and test
Relm-Arrowny Aug 12, 2024
e7df2b4
grouping the gap and phase
Relm-Arrowny Aug 12, 2024
1bc7c38
added PGM
Relm-Arrowny Aug 13, 2024
71ec4c1
added convert csv to look up
Relm-Arrowny Aug 15, 2024
2edfa09
added energy control
Relm-Arrowny Aug 15, 2024
1ef43ea
added i10_id and test
Relm-Arrowny Aug 16, 2024
d816724
remove pandas dependence
Relm-Arrowny Aug 16, 2024
3c583ed
added inverse poly for energy
Relm-Arrowny Aug 16, 2024
849f94f
fixing ruff
Relm-Arrowny Aug 19, 2024
11269c0
added test
Relm-Arrowny Aug 19, 2024
f80d8a8
Separated, pgm and id make componded device I10Apple2PGM and I10Apple…
Relm-Arrowny Aug 20, 2024
2862bde
added more test
Relm-Arrowny Aug 20, 2024
bf0db55
fix energy setting bug and more tests
Relm-Arrowny Aug 21, 2024
252ec65
added idd and idu to i10.py
Relm-Arrowny Aug 21, 2024
1e5cd23
added idd and idu to i10.py
Relm-Arrowny Aug 21, 2024
61c88a7
added docString and test on gap
Relm-Arrowny Aug 21, 2024
53fc609
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Aug 22, 2024
ed14fa2
correct test
Relm-Arrowny Aug 22, 2024
793d8b4
corrected undlatorPhase axes mistake and added docstrings
Relm-Arrowny Aug 22, 2024
4f7fd39
correct test
Relm-Arrowny Aug 22, 2024
dcf9305
fixing i10.py
Relm-Arrowny Aug 22, 2024
694bb4d
fix super call that rename devices in i10.py
Relm-Arrowny Aug 22, 2024
c15a18f
fix the log time out issue
Relm-Arrowny Aug 22, 2024
caf69c7
change look up table back to live rather than test
Relm-Arrowny Aug 22, 2024
d61dbe8
Update src/dodal/devices/i10/id_apple2.py
Relm-Arrowny Aug 23, 2024
4d7f172
added docsting
Relm-Arrowny Aug 23, 2024
d0a0d0d
Merge branch '724-create-an-ophyd-device-for-applet2-undulator' of gi…
Relm-Arrowny Aug 23, 2024
254f02e
Added docstring for i10Apple 2 and change file name for pgm
Relm-Arrowny Aug 23, 2024
03ab4c1
typos
Relm-Arrowny Aug 23, 2024
94dacda
first hack
Relm-Arrowny Aug 6, 2024
069ae75
completed gap motor
Relm-Arrowny Aug 7, 2024
09e7cc0
added test
Relm-Arrowny Aug 8, 2024
3898483
added phase
Relm-Arrowny Aug 9, 2024
694161b
phase axes and test
Relm-Arrowny Aug 12, 2024
e5bef30
grouping the gap and phase
Relm-Arrowny Aug 12, 2024
f43de7a
added PGM
Relm-Arrowny Aug 13, 2024
eaf8cfc
added convert csv to look up
Relm-Arrowny Aug 15, 2024
a54be1c
added energy control
Relm-Arrowny Aug 15, 2024
db38730
added i10_id and test
Relm-Arrowny Aug 16, 2024
5afd73c
remove pandas dependence
Relm-Arrowny Aug 16, 2024
075097a
added inverse poly for energy
Relm-Arrowny Aug 16, 2024
93a5fd6
fixing ruff
Relm-Arrowny Aug 19, 2024
8353e3a
added test
Relm-Arrowny Aug 19, 2024
cc617ab
Separated, pgm and id make componded device I10Apple2PGM and I10Apple…
Relm-Arrowny Aug 20, 2024
f08a01e
added more test
Relm-Arrowny Aug 20, 2024
b09c39d
fix energy setting bug and more tests
Relm-Arrowny Aug 21, 2024
ec45df2
added idd and idu to i10.py
Relm-Arrowny Aug 21, 2024
188484c
added idd and idu to i10.py
Relm-Arrowny Aug 21, 2024
d31a65d
added docString and test on gap
Relm-Arrowny Aug 21, 2024
56e1f53
correct test
Relm-Arrowny Aug 22, 2024
d93db62
corrected undlatorPhase axes mistake and added docstrings
Relm-Arrowny Aug 22, 2024
08a9afc
correct test
Relm-Arrowny Aug 22, 2024
b76b21a
fixing i10.py
Relm-Arrowny Aug 22, 2024
a94b612
fix super call that rename devices in i10.py
Relm-Arrowny Aug 22, 2024
ca7263f
fix the log time out issue
Relm-Arrowny Aug 22, 2024
f3c1cfd
change look up table back to live rather than test
Relm-Arrowny Aug 22, 2024
dd9f511
Update src/dodal/devices/i10/id_apple2.py
Relm-Arrowny Aug 23, 2024
102e38a
added docsting
Relm-Arrowny Aug 23, 2024
d7704cd
Added docstring for i10Apple 2 and change file name for pgm
Relm-Arrowny Aug 23, 2024
a1710ce
typos
Relm-Arrowny Aug 23, 2024
1f1646b
Merge branch '724-create-an-ophyd-device-for-applet2-undulator' of gi…
Relm-Arrowny Aug 27, 2024
b73a765
make apple2 abstract class
Relm-Arrowny Aug 27, 2024
14267da
rename i10_pgm and correct some docstring
Relm-Arrowny Aug 27, 2024
9bc5826
rename i10_pgm and correct some docstring
Relm-Arrowny Aug 27, 2024
2290aa7
rename i10_pgm and correct some docstring
Relm-Arrowny Aug 27, 2024
f0fb9c0
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Aug 27, 2024
68a942d
corrected missing pv
Relm-Arrowny Aug 27, 2024
7fc780b
Merge branch '724-create-an-ophyd-device-for-applet2-undulator' of gi…
Relm-Arrowny Aug 27, 2024
2d9a694
correct fat finger deletion
Relm-Arrowny Aug 27, 2024
fee2e13
corrected timeout and added jawphase for i10 la
Relm-Arrowny Sep 3, 2024
b18daf6
Add linear Arbitrary angle
Relm-Arrowny Sep 4, 2024
eb07a0c
added docstring and test
Relm-Arrowny Sep 4, 2024
170cc67
improved test and remove redundancy
Relm-Arrowny Sep 4, 2024
5224908
correct beamline pv
Relm-Arrowny Sep 4, 2024
3f9a7b6
correct beamline prefix
Relm-Arrowny Sep 4, 2024
f0ad4f8
more corrections
Relm-Arrowny Sep 4, 2024
454f9f5
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Sep 4, 2024
a7e0ada
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Sep 6, 2024
2247c59
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Sep 10, 2024
e91c2bb
pydanic 2
Relm-Arrowny Sep 10, 2024
de164fc
more pydanic fixes
Relm-Arrowny Sep 10, 2024
ca3fa3a
Change diction to dataclass
Relm-Arrowny Sep 10, 2024
33a52a7
typos and type
Relm-Arrowny Sep 10, 2024
ed84252
added wait=ture to stop racing condition in test
Relm-Arrowny Sep 10, 2024
8d4196e
move docstring into their rightful place
Relm-Arrowny Sep 27, 2024
c02b9a7
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Sep 27, 2024
24bebd8
try to fix 3.10 timeouterror
Relm-Arrowny Sep 27, 2024
af7f82a
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Oct 23, 2024
7b839e2
implement pr feedback
Relm-Arrowny Oct 23, 2024
9897172
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
Relm-Arrowny Oct 23, 2024
6a56151
Merge branch 'main' into 724-create-an-ophyd-device-for-applet2-undul…
stan-dot Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 257 additions & 0 deletions src/dodal/beamlines/i10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
from pathlib import Path

from dodal.common.beamlines.beamline_utils import device_instantiation
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
from dodal.devices.apple2_undulator import (
UndulatorGap,
UndulatorJawPhase,
UndulatorPhaseAxes,
)
from dodal.devices.i10.i10_apple2 import (
I10Apple2,
I10Apple2PGM,
I10Apple2Pol,
LinearArbitraryAngle,
)
from dodal.devices.i10.i10_setting_data import I10Grating
from dodal.devices.pgm import PGM
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import BeamlinePrefix, get_beamline_name

BL = get_beamline_name("i10")
set_log_beamline(BL)
set_utils_beamline(BL)

LOOK_UPTABLE_DIR = "/dls_sw/i10/software/gda/workspace_git/gda-diamond.git/configurations/i10-shared/lookupTables/"
"""
I10 has two insertion devices one up(idu) and one down stream(idd).
It is worth noting that the down stream device is slightly longer,
so it can reach Mn edge for linear arbitrary.
idd == id1
and
idu == id2.
"""


def idd_gap(
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorGap:
return device_instantiation(
device_factory=UndulatorGap,
name="idd_gap",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def idd_phase_axes(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorPhaseAxes:
return device_instantiation(
device_factory=UndulatorPhaseAxes,
name="idd_phase_axes",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
top_outer="RPQ1",
top_inner="RPQ2",
btm_inner="RPQ3",
btm_outer="RPQ4",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def idd_jaw(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorJawPhase:
return device_instantiation(
device_factory=UndulatorJawPhase,
name="idd_jaw",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
move_pv="RPQ1",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def idu_gap(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorGap:
return device_instantiation(
device_factory=UndulatorGap,
name="idu_gap",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def idu_phase_axes(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorPhaseAxes:
return device_instantiation(
device_factory=UndulatorPhaseAxes,
name="idu_phase_axes",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
top_outer="RPQ1",
top_inner="RPQ2",
btm_inner="RPQ3",
btm_outer="RPQ4",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def idu_jaw(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> UndulatorJawPhase:
return device_instantiation(
device_factory=UndulatorJawPhase,
name="idu_jaw",
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
move_pv="RPQ1",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
bl_prefix=False,
)


def pgm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> PGM:
return device_instantiation(
device_factory=PGM,
name="pgm",
prefix="-OP-PGM-01:",
grating=I10Grating,
gratingPv="NLINES2",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idu_gap_phase(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2:
return device_instantiation(
device_factory=I10Apple2,
id_gap=idu_gap(wait_for_connection, fake_with_ophyd_sim),
id_phase=idu_phase_axes(wait_for_connection, fake_with_ophyd_sim),
id_jaw_phase=idu_jaw(wait_for_connection, fake_with_ophyd_sim),
energy_gap_table_path=Path(
LOOK_UPTABLE_DIR + "IDEnergy2GapCalibrations.csv",
),
energy_phase_table_path=Path(
LOOK_UPTABLE_DIR + "IDEnergy2PhaseCalibrations.csv",
),
source=("Source", "idu"),
name="idu_gap_phase",
prefix="",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idd_gap_phase(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2:
return device_instantiation(
device_factory=I10Apple2,
id_gap=idd_gap(wait_for_connection, fake_with_ophyd_sim),
id_phase=idd_phase_axes(wait_for_connection, fake_with_ophyd_sim),
id_jaw_phase=idd_jaw(wait_for_connection, fake_with_ophyd_sim),
energy_gap_table_path=Path(
LOOK_UPTABLE_DIR + "IDEnergy2GapCalibrations.csv",
),
energy_phase_table_path=Path(
LOOK_UPTABLE_DIR + "IDEnergy2PhaseCalibrations.csv",
),
source=("Source", "idd"),
name="idd_gap_phase",
prefix="",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idu_pol(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2Pol:
return device_instantiation(
device_factory=I10Apple2Pol,
prefix="",
id=idu_gap_phase(wait_for_connection, fake_with_ophyd_sim),
name="idu_pol",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idd_pol(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2Pol:
return device_instantiation(
device_factory=I10Apple2Pol,
prefix="",
id=idd_gap_phase(wait_for_connection, fake_with_ophyd_sim),
name="idd_pol",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idu(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2PGM:
return device_instantiation(
device_factory=I10Apple2PGM,
prefix="",
id=idu_gap_phase(wait_for_connection, fake_with_ophyd_sim),
pgm=pgm(wait_for_connection, fake_with_ophyd_sim),
name="idu",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idd(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> I10Apple2PGM:
return device_instantiation(
device_factory=I10Apple2PGM,
prefix="",
id=idd_gap_phase(wait_for_connection, fake_with_ophyd_sim),
pgm=pgm(wait_for_connection, fake_with_ophyd_sim),
name="idd",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idu_la_angle(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> LinearArbitraryAngle:
return device_instantiation(
device_factory=LinearArbitraryAngle,
prefix="",
id=idu(wait_for_connection, fake_with_ophyd_sim),
name="idu_la_angle",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)


def idd_la_angle(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> LinearArbitraryAngle:
return device_instantiation(
device_factory=LinearArbitraryAngle,
prefix="",
id=idu(wait_for_connection, fake_with_ophyd_sim),
name="idd_la_angle",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)
Loading
Loading