FABLE-3DXRD / ImageD11

ImageD11 is a python code for identifying individual grains in spotty area detector X-ray diffraction images.
https://imaged11.readthedocs.io/
GNU General Public License v2.0
15 stars 24 forks source link

Normalised intensities, was get_ring_current_per_scan does not work for fscan2d data #315

Open jonwright opened 2 months ago

jonwright commented 2 months ago

Probably: we should be reading a monitor via the sparse file anyway.

"""

KeyError Traceback (most recent call last) Cell In[42], line 6 4 correct_sinos_with_ring_current = True 5 if correct_sinos_with_ring_current: ----> 6 ds.get_ring_current_per_scan() 8 for gs in grainsinos: 9 gs.correct_ring_current(is_half_scan=is_half_scan)

File ~/git/ImageD11_clean/ImageD11/sinograms/dataset.py:490, in DataSet.get_ring_current_per_scan(self) 488 with h5py.File(self.masterfile, "r") as h5in: 489 for scan in self.scans: --> 490 ring_current = float(h5in[scan]["instrument/machine/current"][()]) 491 ring_currents.append(ring_current) 493 self.ring_currents_per_scan = np.array(ring_currents)

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File /cvmfs/hpc.esrf.fr/software/packages/linux/x86_64/jupyter-slurm/2023.10.7/envs/jupyter-slurm/lib/python3.11/site-packages/h5py/_hl/group.py:357, in Group.getitem(self, name) 355 raise ValueError("Invalid HDF5 object reference") 356 elif isinstance(name, (bytes, str)): --> 357 oid = h5o.open(self.id, self._e(name), lapl=self._lapl) 358 else: 359 raise TypeError("Accessing a group is done with bytes or str, " 360 "not {}".format(type(name)))

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File h5py/h5o.pyx:189, in h5py.h5o.open()

KeyError: "Unable to synchronously open object (object '1.1::[0:7200]' doesn't exist)" """

jonwright commented 2 months ago

316 reads the monitor data

To apply to a sinogram there are a couple of options:

jonwright commented 1 week ago

332 gives a column to apply to the pk2d file.

To be decided:

jonwright commented 1 week ago

Further thought... We also have the Lorentz and Polarisation factor for each reflection to add. There can be long tails on peaks, so it is not the same to have sum( (intensity/monitor) ) versus (sum of intensity)/(sum of monitor) for an integrated peak intensity.

Or, we could apply the Lorentz + Polarisation directly on the raw_intensity.