Skip to content
Snippets Groups Projects
Commit 239dd0e3 authored by Hampus Wikmark Kreuger's avatar Hampus Wikmark Kreuger
Browse files

Merge branch 'p2866_updates_darksubtraction' into 'p2866_updates'

Centroid subtracts dark image if there is one

See merge request !191
parents 92cb6a1f 7134dd95
No related branches found
No related tags found
3 merge requests!195Commented centroid,!191Centroid subtracts dark image if there is one,!188P2866 updates
...@@ -333,11 +333,11 @@ class hRIXS: ...@@ -333,11 +333,11 @@ class hRIXS:
# If runNB cannot be iterated over, we assume it's a single run # If runNB cannot be iterated over, we assume it's a single run
data = self.from_run(runNB, proposal) data = self.from_run(runNB, proposal)
self.dark_image = data['hRIXS_det'].mean(dim='trainId') self.dark_image = data['hRIXS_det'].mean(dim='trainId')
self.dark_im_array = self.dark_image.to_numpy()
self.USE_DARK = True self.USE_DARK = True
def find_curvature(self, runNB, proposal=None, plot=True, args=None, **kwargs): def find_curvature(self, runNB, proposal=None, plot=True, args=None, **kwargs):
data = self.from_run(runNB, proposal) data = self.from_run(runNB, proposal)
image = data['hRIXS_det'].sum(dim='trainId') \ image = data['hRIXS_det'].sum(dim='trainId') \
.to_numpy()[self.X_RANGE, self.Y_RANGE].T .to_numpy()[self.X_RANGE, self.Y_RANGE].T
if args is None: if args is None:
...@@ -356,8 +356,12 @@ class hRIXS: ...@@ -356,8 +356,12 @@ class hRIXS:
hit_y = [] hit_y = []
ret = np.zeros((len(data["hRIXS_det"]), bins)) ret = np.zeros((len(data["hRIXS_det"]), bins))
for image, r in zip(data["hRIXS_det"], ret): for image, r in zip(data["hRIXS_det"], ret):
if self.USE_DARK:
use_image = image.to_numpy() - self.dark_im_array
else:
use_image = image.to_numpy()
c = centroid( c = centroid(
image.to_numpy()[self.X_RANGE, self.Y_RANGE].T, use_image[self.X_RANGE, self.Y_RANGE].T,
threshold=self.THRESHOLD, threshold=self.THRESHOLD,
std_threshold=self.STD_THRESHOLD, std_threshold=self.STD_THRESHOLD,
curvature=(self.CURVE_A, self.CURVE_B)) curvature=(self.CURVE_A, self.CURVE_B))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment