pcdshub / pcdsdevices

Collection of Ophyd device subclasses for IOCs unique to LCLS PCDS.
https://pcdshub.github.io/pcdsdevices/
Other
5 stars 58 forks source link

adding PA1K4-PF device in TMO beamline #1273

Closed tongju12 closed 1 month ago

tongju12 commented 1 month ago

![Uploading Screenshot 2024-08-19 at 11.36.05 AM.png…]()

Adding a new pcdsdevices in TMO beamline located at PA1K4 as photon filter

Adding a new device: PA1K4-PF

Motivation and Context

Scientists require this device to work as calibrating photon energy

How Has This Been Tested?

Run command to show the GUI.

Where Has This Been Documented?

https://jira.slac.stanford.edu/browse/ECS-4824

Pre-merge checklist

tongju12 commented 1 month ago

For the PV name, I try to hardcode pf_y from ":MMS:Y" to "PA1K4:PF:MMS:Y", however, after I run typhos command , it comes out as "PA1K4:PF:PA1K4:PF:MMS:Y", it automatically add the prefix"PF1K4:PF". Same thing, when I try to remove hardcode in pf from "PA1K4:PF:STATE" to ":STATE", after running command, it comes out as "STATE:GET_RBV", then I have to hardcode for pf. I am very confused how to fix the conflict here. So I have to use one line code is hard coded, the other line is not. If there is a way to fix it, please let me know. thanks.

tangkong commented 1 month ago

Just to confirm what you're trying to do here with the prefixes, are you trying to have

Why don't we want both to take the device prefix?

tongju12 commented 1 month ago

Yes, pf_y automatically takes prefix "PA1K4:PF" while pf did not take the prefix. Why we need to take prefix "PA1K4:PF"? Because related PVs of this device are all involved "PA1K4:PF". Or can we put prefix as empty ""? I am still confused here.

tangkong commented 1 month ago

When you create an ophyd device, you normally provide a prefix. This is because we assume that devices will be re-used with different prefixes.

my_foil = SCaFoil("MY:PREFIX:", name="my_foil")
your_foil = SCaFoil("OTHER:PREFIX:", name="your_foil")

This prefix gets pre-pended to the components automatically, creating the full PV. As written in the code, pf_y takes this prefix as usual, but you have explicitly told pf to not do so. If we set the prefix to "MY:PREFIX:" like I did in the previous snippet, we'll get

my_foil.pf --> "PA1K4:PF:STATE"
my_foil.pf_y --> "MY:PREFIX::MMS:Y"

If SCaFoil.pf will ALWAYS have the same PV (PA1K4:PF:STATE), this is fine. But if you might ever make another foil and want to reuse this device, we should let SCaFoil.pf take the prefix as normal.

tongju12 commented 1 month ago

Thank you very much, Robert. I think this should be the last one to add because this device is right after the first mirror in TMO hutch, it should calibrate the beam for almost all of the devices after this is installed. I will keep the prefix here so far. If they will add another one later, I will come back to modify later. Thank you very much for your suggestions though.

tongju12 commented 1 month ago

Thanks a lot, Robert! As we discussed, I edit several spots you mentioned here and leave light path as current status to deliver the GUI.