Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally scale sinogram rows by ring current #242

Merged
merged 6 commits into from
Mar 6, 2024

Conversation

jadball
Copy link
Contributor

@jadball jadball commented Mar 6, 2024

Added ring current scaling to sinograms, removes reconstruction artifacts caused by inconsistent peak intensities between rotations

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jonwright
Copy link
Member

The (fpico6, fpico4) monitor should be imported to the sparse files during assemble_label. We can add an option somewhere to use this in properties.py or add it to the peaks table (then normalise during pk2d or pk2dmerge). For ring current I thought it is in the scan 1.2 groups and you need to interpolate it somehow to get the right data shape.

For this pull request, I think ds.ring_currents has shape NYxNOMEGA but ssino has shape NHKL ??

@jonwright
Copy link
Member

If you want to correct the whole rows with an average ring current (or monitor) per scan, then it needs to be a bit more clear how it works, I was assuming this would correct frame by frame.

@jadball
Copy link
Contributor Author

jadball commented Mar 6, 2024

In map_grain_from_peaks in the notebook, ssino always has NY rows:

NY = len(ds.ybincens)  # number of y translations
[...]
sino = np.zeros( ( npks, NY ), 'f' )
hits = np.zeros( ( npks, NY ), 'f' )
angs = np.zeros( ( npks, NY ), 'f' )
adr = destRow * NY + iy 
# Just accumulate 
sig = flt.sum_intensity
ImageD11.cImageD11.put_incr64( sino, adr, sig )
ImageD11.cImageD11.put_incr64( hits, adr, np.ones(len(de),dtype='f'))
ImageD11.cImageD11.put_incr64( angs, adr, flt.omega)

sinoangles = angs.sum( axis = 1) / hits.sum( axis = 1 )
# Normalise:
sino = (sino.T/sino.max( axis=1 )).T
# Sort (cosmetic):
order = np.lexsort((np.arange(npks), sinoangles))
sinoangles = sinoangles[order]
ssino = sino[order].T

At the moment, I am correcting each Y translation by the ring current. Looking at a few different datasets over the last few years, we always have instrument/machine/current available in the .1 scans. Depending on the macro used to collect the data, we sometimes don't have .2 scans.

Going forward, I agree it would be better to correct each frame - I will make an issue for this.

@jadball
Copy link
Contributor Author

jadball commented Mar 6, 2024

Hold off on merging for now, I'll make a correction function for the sinogram with documentation so it's clearer what this does

@jadball
Copy link
Contributor Author

jadball commented Mar 6, 2024

Now happy to merge

@jonwright
Copy link
Member

Feel free to merge if you prefer as it is. My feeling is that doing a monitor correction when building the sinogram seems a bit busy. You can do this normalisation either before (to the peaks) or after (to the sinogram) without needing it to be part of the peaks-to-sinogram builder function.

@jadball
Copy link
Contributor Author

jadball commented Mar 6, 2024

I think what we have now is a good hold-over until we are properly scaling the peaks, I'll add a new function to correct the sinograms after they are created rather than during creation

@jadball jadball merged commit fe74de9 into FABLE-3DXRD:master Mar 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants