Hi Hinko,
The array counter in the NDPluginFile plugin is intended to be a count of the actual number of arrays written to disk, not the number of callbacks received by the plugin.
Moving the arrayCounter++ before the if would violate this, since then it would increment even if the array was not saved if autosave was false and the Save button was not pressed for each array.
We could increment the array count each time that Save button is pressed in single mode. That would be preferable, but would have the problem that one can save the
same array multiple times with the Save button, and then array count is misleading, since it is counting the same array multiple times.
Note that in an upcoming R3-0 release of ADCore we propose to do a major re-write of NDPluginFile to simplify things. This is documented here:
https://github.com/areaDetector/ADCore/issues/73
This is the proposed change:
*******************************************************************
Currently NDPluginFile has the following controls:
FileWriteMode: [Single, Stream, Capture]
Autosave: Automatically save each image in Single mode or the entire capture buffer in Capture mode.
Save: Saves the last array received in Single mode or saves the entire capture buffer in Capture mode
NumCapture: Number of frames to capture or stream
Capture: Start/stop saving files in Capture mode or start/stop streaming files to disk in Stream mode.
These controls are not intuitive, many users get confused. They also add a lot of complexity to the NDPluginFile base class. The Capture mode functionality (saving NDArrays in
a memory buffer) is now available in the NDPluginCircularBuff plugin.
Proposed change:
Eliminate FileWriteMode
Eliminate Autosave
Eliminate Capture
Retain Save, it will start/stop file saving
Rename NumCapture to NumSave. It defines the total number of NDArrays to save. If it is <=0 then file saving will continue until Save is set to 0.
Add NumArraysPerFile. It defines the number of NDArrays per file.
With these changes the number of arrays per file can be defined independently of the total number of arrays to save. This allows saving single arrays per file with HDF5 and netCDF,
for example which is not currently possible.
This change will require changes to many clients so it will need to be a major release of ADCore.
*******************************************************************
I would appreciate any comments on this proposed change.
Mark
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hinko Kocevar
Sent: Wednesday, March 18, 2015 9:26 AM
To: [email protected]
Subject: Increment array counter for NDFileModeSingle
Hi,
In areaDetector NDPluginFile I noticed that the array count is incremented only if autosave is active (if in Single mode). This means that by clicking ‘Save’ button the array counter is not incremented. Is there a reason for this?
See
https://github.com/areaDetector/ADCore/blob/master/ADApp/pluginSrc/NDPluginFile.cpp#L708.
By moving arrayCounter++ before the if() would a way to have array counter incremented even if autosave is not active.
Best regards,
Hinko