Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
Boston S R committed Nov 22, 2024
1 parent c1c4399 commit fb0ad87
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions tests/cis_tests/proto_remove_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@
blanks[peakList.groupID] = [(0, peakList.peaks[0].minimum)]
for i in range(len(peakList.peaks) - 1):
blanks[peakList.groupID].append((peakList.peaks[i].maximum, peakList.peaks[i+1].minimum))
blanks.append(peakList.peaks[-1].maximum, 10.0)
blanks[peakList.groupID].append((peakList.peaks[-1].maximum, 10.0))
groupDetectorIDs = access_pointer(GroupedDetectorIDs(focusWorkspace))

ConvertUnits(
InputWorkspace=inputWorkspace,
OutputWorkpace=ref,
OutputWorkspace=ref,
Target="dSpacing",
)

Expand All @@ -136,13 +136,6 @@
)
#


RemoveEventBackground(
InputWorkspace=inputWorkspace,
GroupingWorkspace=focusWorkspace,
OutputWorkspace=ref,
DetectorPeaks = create_pointer(detectorPeaks),
)
ConvertUnits(
InputWorkspace=ref,
OutputWorkspace=ref,
Expand All @@ -167,7 +160,6 @@
Xmax=10,
)


### REMOVE EVENT BACKGROUND BY SMOOTHING ##

ConvertUnits(
Expand All @@ -186,11 +178,19 @@
DetectorPeaks = create_pointer(detectorPeaks),
SmoothingParameter=0.5,
)
Minus(
ws = Divide(
LHSWorkspace=total,
RHSWorkspace=background,
OutputWorkspace=peaks,
)
ws.setDistribution(False)
ReplaceSpecialValues(
InputWorkspace=peaks,
OutputWorkspace=peaks,
SmallNumberThreshold=0,
SmallNumberValue=0,
UseAbsolute=False,
)
CrossCorrelate(
InputWorkspace=peaks,
OutputWorkspace="smoothing",
Expand All @@ -203,4 +203,21 @@
OutputWorkspace="smoothing_offset",
Xmin=-10,
Xmax=10,
)
)

### PLOT PEAK RESULTS #################################
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
ax.plot(mtd[total], wkspIndex=0, label="Total Data", normalize_by_bin_width=True)
ax.plot(mtd[ref], wkspIndex=0, label="Event Blanking", normalize_by_bin_width=True)
ax.plot(mtd[peaks], wkspIndex=0, label="Smoothing Subtraction", normalize_by_bin_width=True)
ax.legend()
fig.show()


### PLOT CC RESULTS #################################
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
ax.plot(mtd["no_removal"], wkspIndex=0, label="Total Data", normalize_by_bin_width=True)
ax.plot(mtd["event_blank"], wkspIndex=0, label="Event Blanking", normalize_by_bin_width=True)
ax.plot(mtd["smoothing"], wkspIndex=0, label="Smoothing Subtraction", normalize_by_bin_width=True)
ax.legend()
fig.show()

0 comments on commit fb0ad87

Please sign in to comment.