-
Notifications
You must be signed in to change notification settings - Fork 1
Code Comparity 20260318
Paul Moeller edited this page Mar 17, 2026
·
1 revision
import lcls_tools.common.devices.reader
def screens_for_beampath(beampath):
for a in lcls_tools.common.devices.reader.create_beampath(
beampath
).areas.values():
if not a.screen_collection:
continue
for s in a.screen_collection.devices.values():
if not s.controls_information.PVs.target_control:
continue
if s.metadata.sum_l_meters is None:
continue
yield s
result = sorted(
screens_for_beampath("CU_HXR"),
key=lambda x: x.metadata.sum_l_meters
)
for r in result:
print(f"{r.metadata.sum_l_meters} {r.name}")import importlib
import pykern.pkio
import pykern.pkyaml
def screens_for_beampath(beampath):
for p in pykern.pkio.sorted_glob(
pykern.pkio.py_path(
importlib.import_module("lcls_tools.common.devices.yaml").__file__,
)
.dirpath()
.join("*.yaml")
):
for n, s in pykern.pkyaml.load_file(p).get("screens", {}).items():
if beampath not in s.metadata.beam_path:
continue
if "target_control" not in s.controls_information.PVs:
continue
s.name = n
yield s
result = sorted(
screens_for_beampath("CU_HXR"),
key=lambda x: x.metadata.sum_l_meters
)
for r in result:
print(f"{r.metadata.sum_l_meters} {r.name}")