Skip to content

Commit

Permalink
Addition of CMS 800K detector
Browse files Browse the repository at this point in the history
  • Loading branch information
gfreychet committed Jan 17, 2024
1 parent c11246d commit 5d309b4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
32 changes: 32 additions & 0 deletions smi_analysis/Detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,35 @@ def calc_mask(self, bs, bs_kind=None, img=None, threshold=15):
mask[np.where(img < threshold)] = False

return np.logical_not(mask)


class Pilatus800k_CMS(Pilatus):
"""
Pilatus 800k detector, assembly of 3x3 modules
Available at NSLS-II 11-BM.
This is different from the "Pilatus CdTe 900kw" available at ESRF ID06-LVP which is 1x9 modules
"""
MAX_SHAPE = (1043, 981)
aliases = ["Pilatus 800k cms"]

def calc_mask(self, bs=None, bs_kind=None, optional_mask=None):
'''
:param bs: (string) This is the beamstop position on teh detctor (teh pixels behind will be mask inherently)
:param bs_kind: (string) What beamstop is in: Only need to be defined if pindiode which have a different shape)
:param optional_mask: (string) This is usefull for tender x-ray energy and will add extra max at the chips junction
:return: (a 2D array) A mask array with 0 and 1 with 0s where the image will be masked
'''
mask = np.logical_not(np.zeros(self.MAX_SHAPE))
mask[:, :5], mask[:, -5:], mask[:5, :], mask[-5:, :] = False, False, False, False
mask[:, 486:494]= False

#The two bottom missing modules
mask[620:, :486]= False

#Beamstop
if bs == [0, 0]:
return np.logical_not(mask)
else:
mask[bs[1]:, bs[0] - 8:bs[0] + 8] = False
return np.logical_not(mask)
6 changes: 6 additions & 0 deletions smi_analysis/SMI_beamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def define_detector(self):
self.det = Detector.Pilatus100k_OPLS()
elif self.detector == 'Pilatus300k_OPLS':
self.det = Detector.Pilatus300k_OPLS()
elif self.detector == 'Pilatus800k_CMS':
self.det = Detector.Pilatus800k_CMS()
else:
raise Exception('Unknown detector for SMI. Should be either: Pilatus1m or Pilatus300kw or rayonix')

Expand Down Expand Up @@ -117,6 +119,8 @@ def open_data(self, path, lst_img, optional_mask=None):
self.imgs.append(fabio.open(os.path.join(path, img)).data)
elif self.detector == 'Pilatus300k_OPLS':
self.imgs.append(fabio.open(os.path.join(path, img)).data)
elif self.detector == 'Pilatus800k_CMS':
self.imgs.append(fabio.open(os.path.join(path, img)).data)

def open_data_db(self, lst_img, optional_mask=None):
"""
Expand Down Expand Up @@ -151,6 +155,8 @@ def open_data_db(self, lst_img, optional_mask=None):
self.imgs.append(img)
elif self.detector == 'Pilatus300k_OPLS':
self.imgs.append(img)
elif self.detector == 'Pilatus800k_CMS':
self.imgs.append(img)

def calculate_integrator_trans(self, det_rots):
self.ai = []
Expand Down

0 comments on commit 5d309b4

Please sign in to comment.