Skip to content

Commit

Permalink
Merge pull request #332 from jonwright/master
Browse files Browse the repository at this point in the history
Monitor for normalisation of a pk2d or cf2d
  • Loading branch information
jonwright authored Oct 11, 2024
2 parents f097e3c + 4ccb911 commit 152b0c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ImageD11/sinograms/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class DataSet:
"detector",
"omegamotor",
"dtymotor",
"monitorname",
"pksfile",
"sparsefile",
"parfile",
Expand Down Expand Up @@ -131,6 +132,8 @@ def __init__(
self.shape = (0, 0)
self.omega = None
self.dty = None
self.monitor = None
self.monitorname = None

self._peaks_table = None
self._pk2d = None
Expand Down Expand Up @@ -524,6 +527,18 @@ def get_monitor(self, name="fpico6"):
monitor.append(mon)
self.monitor = np.concatenate(monitor).reshape(self.shape)
return self.monitor

def get_monitor_pk2d(self, pk2d, name='fpico6'):
"""
To be used to normalise the peaks 2d
"""
if self.monitor is None :
self.get_monitor( name )
iy = np.digitize( pk2d['dty'], self.ybinedges ) - 1
io = np.digitize( pk2d['omega'], self.obinedges ) - 1
#pk2d['iy'] = iy # cache these too ?
#pk2d['io'] = io
return self.monitor[ iy, io ]

def guess_detector(self):
"""Guess which detector we are using from the masterfile"""
Expand Down
1 change: 1 addition & 0 deletions ImageD11/sinograms/sinogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def build_sinogram(self, columns=('omega',)):
order = np.lexsort((np.arange(npks), sinoangles))
self.sinoangles = sinoangles[order]
self.ssino = self.sino[order].T
self.proj_scale = self.proj_scale[order]
if len(columns)>1:
self.angle_wt_sinos = { name : angs[name][order].T for name in columns }
self.hkle = pkindices[:, order] # dims are [ (h,k,l,sign(eta)) , nprojections ]
Expand Down

0 comments on commit 152b0c9

Please sign in to comment.