-
Notifications
You must be signed in to change notification settings - Fork 28
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
FooDetector should have a consistent initialiser pattern. #263
Comments
The current Diamond wrapper function looks like this, with the complexity that some StandardDetector implementations (The Aravis that are used as OAVs, but not those used on the test rigs) have CAM instead of DRV. def DLSFoo(prefix: str, name: str) -> FooDetector:
driver = FooDriver(prefix + "DRV:")
hdf = HDFWriter(prefix + "HDF5:")
return FooDetector(driver=driver, hdf=hdf) |
I'll mention what I had in the other PR, but at NSLS2 we use Basically: from ophyd_async.epics.areadetector import DRV_SUFFIX, HDF_SUFFIX
class FooDetector:
def __init__(self, prefix: str, name: str, drv_suffix=DRV_SUFFIX, hdf_suffix=HDF_SUFFIX):
.... With the globals in NSLS2's case being |
DLS has no such standards unfortunately... @DiamondJoseph what do you think about? def DLSFoo(prefix: str, name: str) -> FooDetector:
return FooDetector(prefix=prefix, drv_suffix="DRV:", hdf_suffix="HDF:") In which case we could default to the NSLS-II versions: class FooDetector:
def __init__(self, prefix: str, drv_suffix=":cam1", hdf_suffix=":HDF1", name=""):
.... Also I would like to make all names optional, defaulting to |
That patttern works for me, happy with those defaults (good argument to push for standardisation later) |
I'm happy with @coretl's solution too. In general when porting DLS stuff we have been trying to adopt PV naming standards and persuade the controls team to change PV names. @DominicOram has had some success in this and I think it's a good strategy going forward, so I think we are allowed to assume we follow a standard. That said the use of globals makes it more difficult to cater for the 1% that do not. I also think that detectors should look as much like other ophyd devices as possible, which the proposed solution satisfies because name and prefix and the only things you must pass. |
I'll put together a change to standardise the detectors we have so far, something for the docs too |
Although we aren't going to make this PV name change as a pre-requisite of adopting ophyd, we must be able to run alongside Malcolm so we will need to do Also the NSLS-II conventions are technically against our PV naming conventions, which are all caps, but then all areaDetector PVs are anyway so I'm not sure I care...
My suggestion ditched the globals, you get NSLS-II naming by default, and you have to specify if different. No DLS defaults here...
I see no reason to make |
Also, just to clarify, I wasn't suggesting we write @device_factory
def saxs() -> PilatusDetector:
return PilatusDetector("BL22I-EA-PILAT-01:", drv="DRV:", hdf="HDF:")
@device_factory
def waxs() -> PilatusDetector:
return PilatusDetector("BL22I-EA-PILAT-02:", drv="DRV:", hdf="HDF:") Not as DRY as it could be, but at least it's explicit |
Why is this required for compatibility with Malcolm? |
So we can gradually migrate scans over. Only change one thing at a time. |
FooDetector
is an implementation ofStandardDetector
, with aFooController
(which takes aFooDriver
) and aHDFWriter
.Each facility has a particular standard (which may be kept to varying degrees of rigour) for how the child component (.drv, .hdf) epics addresses extend the prefix of their parent device.
Diamond also has the particular limitation that our device factory functions (which primarily are init methods, but do not necessarily need to be) must have the args
prefix
andname
.The text was updated successfully, but these errors were encountered: