[Nexus] making link under different name in Python

Carlos Pascual cpascual at cells.es
Mon Nov 4 08:28:56 GMT 2013


I asked this same thing to the nexus-development list in August 2012...

IMHO, a keyword argument (e.g. "name") should be added to 
NXgroup.makelink()

As a workaround, you can use the makenamedlink() method from the NeXus 
file object of the nap (but beware, because it is sometimes tricky to mix 
the NXTree API with the NAPI).

As an example on how I dealt with the named links using the NAPI, you 
can see the BaseNEXUS_FileRecorder._nxln() method in line 476 of this 
file:

https://sourceforge.net/p/sardana/sardana.git/ci/master/tree/src/sardana/macroserver/scan/recorder/storage.py#l476


On Fri 1 November 2013 12:07:47 Andras WACHA wrote:
> Dear NeXus devs and users,
> 
> I am currently implementing NeXus as a data storage system for our new
> laboratory SAXS instrument. The control software is written in
> Python, and I would like to use the NeXusTree API for saving HDF-5
> files.
> 
> We have one main 2D detector, which is saved to
> NXentry/NXinstrument/detector:NXdetector. However, for scan
> measurements we use several "virtual" detectors, which are defined as
> operations on the images of the main detector, e.g. sum, maximum,
> barycenter etc. I would like to implement these as auxiliary
> detectors, e.g. in
> NXentry/NXinstrument/max:NXdetector etc. However, to comply with the
> base class specifications -- and to have the same structure of all
> these virtual detectors -- I would prefer to use the 'data' field in
> each group to hold the NP data points, and create links into
> NXentry/NXdata for each dataset. However, here I would like to use
> the name of the virtual detector (e.g. max, sum, total etc.), which I
> found I cannot do either with nxs.NXdata.makelink() or using
> nxs.NXdata.max=nxs.NXlink(target=...) -like constructs.
> 
> How should one proceed in such cases? Or should I do things otherwise?
> 
> Best regards,
> 
> Andras Wacha
-- 
+----------------------------------------------------+
 Carlos Pascual Izarra
 Scientific Software Coordinator
 Computing Division
 Cells / Alba Synchrotron  [http:/www.cells.es]
 Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
 E-08290 Cerdanyola del Valles (Barcelona), Spain
 E-mail: cpascual at cells.es
 Phone: +34 93 592 4428
+----------------------------------------------------+


More information about the NeXus mailing list