pydm icon indicating copy to clipboard operation
pydm copied to clipboard

Logical indexing for NTTable subfields

Open jakerudolph opened this issue 1 year ago • 3 comments

What's the problem this feature will solve? When indexing into a column of an NTTable subfield (i.e. the second index), I need to know exactly which index my desired object is at.

Describe the solution you'd like While this is possible to manage on the user end by getting the PV in python code and identifying the index that way, it would be nice if it were possible to add a logical statement to the second subfield straight in designer. In my mind it would look something like pva:MY_PV/subfield1/subfield2==indexIWant. I could also see a solution using syntax similar to the calc plugin. I defer to your all's expertise!

jakerudolph avatar Apr 06 '23 21:04 jakerudolph

Hey! Would it possible to give us a use case or small example where this would be applied. So I can better understand the feature. Thank you

YektaY avatar May 23 '23 20:05 YektaY

Hi Yekta, sure: I have an NTTable containing information about klystron anomalies with 2 columns, "station" and "anomaly_state". If I want to get the anomaly state of a particular station, I need to find the index of that station in the "station" column, and append that to the pv, so I end up with something like:

station_idx = stations_column.index(klystron_i_want)
channel = f"pva://KLYS:SYS0:1:ANOM_STATES/anomaly_state/{station_idx}"

This works fine, but it might be nice to index directly to that index, so that channel becomes:

channel = f"pva://KLYS:SYS0:1:ANOM_STATES/anomaly_state/station={klys_i_want}"

Does this make sense?

jakerudolph avatar May 23 '23 20:05 jakerudolph

Hey, yeah sorry for the slow reply, I will look into this soon. Thanks!

YektaY avatar Aug 10 '23 20:08 YektaY