added show all to sample storage
This commit is contained in:
parent
345a95dbe7
commit
02f950de8d
@ -4,6 +4,7 @@ from ophyd import Component as Cpt
|
|||||||
from ophyd import Device
|
from ophyd import Device
|
||||||
from ophyd import DynamicDeviceComponent as Dcpt
|
from ophyd import DynamicDeviceComponent as Dcpt
|
||||||
from ophyd import EpicsSignal
|
from ophyd import EpicsSignal
|
||||||
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
|
|
||||||
class FlomniSampleStorageError(Exception):
|
class FlomniSampleStorageError(Exception):
|
||||||
@ -18,6 +19,7 @@ class FlomniSampleStorage(Device):
|
|||||||
"unset_sample_slot",
|
"unset_sample_slot",
|
||||||
"set_sample_in_gripper",
|
"set_sample_in_gripper",
|
||||||
"unset_sample_in_gripper",
|
"unset_sample_in_gripper",
|
||||||
|
"show_all",
|
||||||
]
|
]
|
||||||
SUB_VALUE = "value"
|
SUB_VALUE = "value"
|
||||||
_default_sub = SUB_VALUE
|
_default_sub = SUB_VALUE
|
||||||
@ -80,3 +82,36 @@ class FlomniSampleStorage(Device):
|
|||||||
def is_sample_in_gripper(self) -> bool:
|
def is_sample_in_gripper(self) -> bool:
|
||||||
val = self.sample_in_gripper.get()
|
val = self.sample_in_gripper.get()
|
||||||
return bool(val)
|
return bool(val)
|
||||||
|
|
||||||
|
def get_sample_name(self, slot_nr) -> str:
|
||||||
|
val = getattr(self.sample_names, f"sample{slot_nr}").get()
|
||||||
|
return str(val)
|
||||||
|
|
||||||
|
def show_all(self):
|
||||||
|
t = PrettyTable()
|
||||||
|
t.title = "flOMNI sample storage"
|
||||||
|
field_names = [""]
|
||||||
|
field_names.extend(str(ax) for ax in range(1,11))
|
||||||
|
for ct in range(0,2):
|
||||||
|
t.field_names = field_names
|
||||||
|
row = ["Container " + str(ct)]
|
||||||
|
row.extend(
|
||||||
|
"used" if self.is_sample_slot_used(slot_nr) else "free"
|
||||||
|
for slot_nr in range((ct*10)+1,(ct*10)+11)
|
||||||
|
)
|
||||||
|
t.add_row(row)
|
||||||
|
print(t)
|
||||||
|
print("\n\nFollowing samples are currently loaded:\n")
|
||||||
|
for ct in range(1,21):
|
||||||
|
if self.is_sample_slot_used(ct):
|
||||||
|
print(f" Position {ct:2.0f}: {self.get_sample_name(ct)}")
|
||||||
|
if self.sample_in_gripper.get():
|
||||||
|
print(f"\nGripper: {self.sample_in_gripper_name.get()}\n")
|
||||||
|
else:
|
||||||
|
print(f"\nGripper: no sample\n")
|
||||||
|
|
||||||
|
if self.is_sample_slot_used(0):
|
||||||
|
print(f"flOMNI stage: {self.get_sample_name(0)}\n")
|
||||||
|
else:
|
||||||
|
print(f"flOMNI stage: no sample\n")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user