Skip to content

add machine electrical current

payno requested to merge add_current into master

In order to improve flat field correction we require the machine electrical current to be stored in the produced NXtomo.

tomoscan!78 (merged) must be merge first

connection with NXtomo

To me this fit the NXtomo control/data field: And it requires to have this for each frame.

existing and behavior

Currently from bliss we do not have this information for each frame. It is saved either:

  • once on the x.1 if the bliss scan is short. (for darks and flats for example)
  • several time in the x.2 (something like each second) if the bliss scan is long like for porjections

In order to deduce this value for each frame we collect all know electrical_current with it time stamp. Then we create a time stamp for each frame. Once all data has been parsed we deduce machine electrical current for each frame from the collected one.


  • Add electrical current to the nexus module
  • add collection of the electrical current datasets
  • add calculation of frame time stamps
  • add deduction of the machine electrical current from collected electrical current and frame time stamps.
  • add test
  • add doc
  • test on real dataset (tested on bamboo_hercules.h5 and WG_30_0019_P_156_3896_D_744)
  • implement nexus control concatenation operation
  • if contains only one current register it with start time

how to use

Now machine electric current should be handled automatically. It looks for a current dataset at different locations (according to the type of bliss scan the location can vary.)

Once converted you can access it from tomoscan. For example if your Nxtomo is located at entry0000 path on the my_file.nx you can use:

from tomoscan.esrf.scan.hdf5scan import HDF5TomoScan
scan = HDF5TomoScan("my_file.nx", "entry0000")

frames_electric_current = scan.electric_current

This will return the array of all the electric_current. Dark and flat frames as the projection or the alignment one. To access some frames users can filter those values from the image_key_control values. Like:

from tomoscan.esrf.hdf5scan import ImageKey

projections_electric_current = scan.electric_current[scan.image_key_control == ImageKey.PROJECTION.value]

extra info



Here you can see the result of the output obtain for the bamboo_hercules dataset. The 'steps effects' come from the raw data precision which looks the same:


edit: unit is note the same between the two curve: eV vs keV.

Edited by payno

Merge request reports