bluesky / ophyd-epics-devices

https://bluesky.github.io/ophyd-epics-devices
Apache License 2.0
1 stars 1 forks source link

Add logic for making signals on-the-fly, sans p4p -vv call #31

Closed rosesyrett closed 1 year ago

rosesyrett commented 1 year ago

Resolves https://github.com/bluesky/ophyd-epics-devices/issues/25

For this to work, I need to be able to query the epics signal via pv access to get the type of the signal, to be used in the signal_factory (i.e epicssignal ... function). Two things need to happen for this to work:

  1. The .db file being used (i.e. the one currently in tests/db/panda.db) needs to have enough information about the signal types,
  2. I need a way of doing 'pvget -vv ${IOC:PV}' via python's p4p library. I am struggling to see how to do that. edit: after discussion it seems like we can just use 'None' and the backend will guess.
rosesyrett commented 1 year ago

@coretl this is almost done, except in my tests the db used does not contain an "active" bool signal in the PVI. Could you just modify this MR to include it? Thanks

coretl commented 1 year ago

Try this:


record(bi, "$(IOC_NAME=PANDAQSRV):PCAP:ACTIVE")
{
    field(ZNAM,  "0")
    field(ONAM,  "1")
    field(PINI, "YES")
    info(Q:group, {
        "$(IOC_NAME=PANDAQSRV):PCAP:PVI": {
            "pvi.active.r": {
                "+channel": "NAME",
                "+type": "plain"
            }
        }
    })
}
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.55% :tada:

Comparison is base (23d4c46) 98.90% compared to head (feb26da) 99.45%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #31 +/- ## ========================================== + Coverage 98.90% 99.45% +0.55% ========================================== Files 5 5 Lines 364 365 +1 ========================================== + Hits 360 363 +3 + Misses 4 2 -2 ``` | [Files Changed](https://app.codecov.io/gh/bluesky/ophyd-epics-devices/pull/31?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluesky) | Coverage Δ | | |---|---|---| | [src/ophyd\_epics\_devices/panda.py](https://app.codecov.io/gh/bluesky/ophyd-epics-devices/pull/31?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluesky#diff-c3JjL29waHlkX2VwaWNzX2RldmljZXMvcGFuZGEucHk=) | `99.34% <100.00%> (+1.32%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.