Closed prjemian closed 6 years ago
new PV will be: 2bmb:DX:theta
and has been added to ioc2bmb
IOC (will appear after next reboot), as well as attributes and layout XML files for 2bmbPG3:
UNTIL that IOC is rebooted, will run this PV in the MONA (soft) IOC: ~/.ipython/profile_2bmb/startup/run_mona_ioc.sh
wrote to Mark Rivers:
Working with AreaDetector and I don't understand how to do something
I have this waveform PV
# Contains (expected) theta (rotation angle) values for next tomo scan.
# Written by data acq software such as Bluesky.
record(waveform, "2bmb:DX:theta") {
field(DESC, "pre-computed theta angles")
field(DTYP, "Soft Channel")
field(EGU, "degrees")
field(FTVL, "DOUBLE")
field(NELM, "9999")
}
It has 1500 defined values. Here are the first 10:
[user2bmb@lyra,52,startup]$ caget -# 10 2bmb:DX:theta
2bmb:DX:theta 10 0 0.12008 0.24016 0.36024 0.48032 0.6004 0.72048 0.84056 0.96064 1.08072
I want this array written to my HDF5 file from area detector. In the attributes file:
<Attribute name="Theta" type="EPICS_PV" source="2bmb:DX:theta" dbrtype="DBR_DOUBLE" />
In the layout file:
<dataset name="Theta" source="ndattribute" ndattribute="Theta">
<attribute name="description" source="constant" value="pre-computed rotary angle positions" type="string" />
<attribute name="units" source="constant" value="degrees" type="string" />
</dataset>
most recent data collection file: -rw-rw-r-- 1 user2bmb xor2 3.3G Aug 17 16:52 79937e0b-fa40-40c8-b605_000000.h5
Here is the content in the HDF5 file that contains the word theta
(base) bash-4.2$ punx tre 79937e0b-fa40-40c8-b605_000000.h5 | grep -i theta
Theta_EGU:char[256] = degrees
@NDAttrName = Theta_EGU
@NDAttrSource = 2bmb:DX:theta.EGU
Theta:float64[1520] = [0.0, 0.0, 0.0, '...', 0.0]
@NDAttrName = Theta
@NDAttrSource = 2bmb:DX:theta
@axes = theta:y:x
@axes = theta:y:x
@axes = theta:y:x
theta:float64[1500] = [0.0, 0.12008005336891261, 0.24016010673782523, '...', 180.0]
We took 10 darks, 10 whites, and 1500 image frames, total of 1520. What is stored under Theta is not the array from the PV but 1520 of a double value of 0.0.
How can I store the array instead?
For now, I have Python code that runs after area detector finishes the HDF5 file. The code adds a new dataset with the theta array that I want. It would be more convenient to the process if the array could be written from the AD plugin.
Is it possible?
Mark's reply:
NDAttributes are limited to numeric scalars and strings. They cannot be arrays.
You can see this from the NDAttribute class header file: http://cars9.uchicago.edu/software/epics/areaDetectorDoxygenHTML/_n_d_attribute_8h_source.html
NDAttrValue is a union of the 8 numeric data types.
There is an issue in ADCore to add support for 1-D array attributes.
@MarkRivers: Thanks!
Bluesky knows about the theta values for the next sequence, it can compute the values and write a waveform PV. The PV can be added to the NDattributes of the area detector and written to HDF5 or passed with the PVA object.
No need to modify the HDF5 file after acquisition.
Needs a
theta
waveform PV.