Experimental Physics and Industrial Control System
Hi Hinko,
> can I save an array of floats into HDF5 file through areaDetector Attribute?
No, unfortunately that is not possible. There is a 4 year old issue in ADCore about this:
https://github.com/areaDetector/ADCore/issues/2
This is from NDAttribute.h
******************************************
/** Union defining the values in an NDAttribute object */
typedef union {
epicsInt8 i8; /**< Signed 8-bit integer */
epicsUInt8 ui8; /**< Unsigned 8-bit integer */
epicsInt16 i16; /**< Signed 16-bit integer */
epicsUInt16 ui16; /**< Unsigned 16-bit integer */
epicsInt32 i32; /**< Signed 32-bit integer */
epicsUInt32 ui32; /**< Unsigned 32-bit integer */
epicsFloat32 f32; /**< 32-bit float */
epicsFloat64 f64; /**< 64-bit float */
} NDAttrValue;
/** Structure used by the EPICS ellLib library for linked lists of C++ objects.
* This is needed for ellLists of C++ objects, for which making the first data element the ELLNODE
* does not work if the class has virtual functions or derived classes. */
typedef struct NDAttributeListNode {
ELLNODE node;
class NDAttribute *pNDAttribute;
} NDAttributeListNode;
/** NDAttribute class; an attribute has a name, description, source type, source string,
* data type, and value.
*/
class epicsShareClass NDAttribute {
public:
/* Methods */
NDAttribute(const char *pName, const char *pDescription,
NDAttrSource_t sourceType, const char *pSource, NDAttrDataType_t dataType, void *pValue);
NDAttribute(NDAttribute& attribute);
static const char *attrSourceString(NDAttrSource_t type);
virtual ~NDAttribute();
virtual NDAttribute* copy(NDAttribute *pAttribute);
virtual const char *getName();
virtual const char *getDescription();
virtual const char *getSource();
virtual const char *getSourceInfo(NDAttrSource_t *pSourceType);
virtual NDAttrDataType_t getDataType();
virtual int getValueInfo(NDAttrDataType_t *pDataType, size_t *pDataSize);
virtual int getValue(NDAttrDataType_t dataType, void *pValue, size_t dataSize=0);
virtual int getValue(std::string& value);
virtual int setDataType(NDAttrDataType_t dataType);
virtual int setValue(const void *pValue);
virtual int setValue(const std::string&);
virtual int updateValue();
virtual int report(FILE *fp, int details);
friend class NDArray;
friend class NDAttributeList;
private:
template <typename epicsType> int getValueT(void *pValue, size_t dataSize);
std::string name_; /**< Name string */
std::string description_; /**< Description string */
NDAttrDataType_t dataType_; /**< Data type of attribute */
NDAttrValue value_; /**< Value of attribute except for strings */
std::string string_; /**< Value of attribute for strings */
std::string source_; /**< Source string - EPICS PV name or DRV_INFO string */
NDAttrSource_t sourceType_; /**< Source type */
std::string sourceTypeString_; /**< Source type string */
NDAttributeListNode listNode_; /**< Used for NDAttributeList */
******************************************
So the value_ member is a union of the numeric data types, and it can store only a single value.
The exception is for strings, where the value is stored in the std::string string_ member. There is effectively no length limit on strings.
If you change from DBR_NATIVE to DBR_STRING it will read the entire array as a string if the waveform record FTVL is CHAR. So I was hoping this would work to read your array:
<Attribute name="GaussParams" type="EPICS_PV" source="DTU:GaussParams" dbrtype="DBR_STRING" description="Gauss params"/>
However, I just tested this with a waveform record whose FTVL is DOUBLE and it only reads the first element, not the entire array. I think that is something that would not be too hard to fix: if the requested dbrtype=DBR_STRING then subscribe for callbacks on the entire array, not just the first element.
Would that be useful for you, i.e. having the array as a string rather than 10 numbers?
Mark
________________________________
From: [email protected] [[email protected]] on behalf of Hinko Kocevar [[email protected]]
Sent: Tuesday, September 26, 2017 3:44 AM
To: [email protected]
Subject: AD: save array of floats into HDF5 as attribute
Hi,
can I save an array of floats into HDF5 file through areaDetector Attribute?
XML definition:
<Attribute name="GaussParams" type="EPICS_PV" source="DTU:GaussParams" dbrtype="DBR_NATIVE" description="Gauss params"/>
where PV is:
record(waveform, "$(P)$(R)GaussParams")
{
field(FTVL, "DOUBLE")
field(NELM, "10")
}
With the above, I only a single (first) value saved in the HDF5 file as opposed to all 10.
Thanks,
Hinko
--
.. the more I see the less I believe.., AE AoR
- Replies:
- RE: save array of floats into HDF5 as attribute Mark Rivers
- References:
- AD: save array of floats into HDF5 as attribute Hinko Kocevar
- Navigate by Date:
- Prev:
AD: save array of floats into HDF5 as attribute Hinko Kocevar
- Next:
RE: save array of floats into HDF5 as attribute Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
AD: save array of floats into HDF5 as attribute Hinko Kocevar
- Next:
RE: save array of floats into HDF5 as attribute Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024