Skip to content

Commit

Permalink
pattern: Moved minum subtraction after cubic spliine interpolation in…
Browse files Browse the repository at this point in the history
… .get_uniform
  • Loading branch information
Somerandomguy10111 committed Dec 18, 2024
1 parent 49997ad commit 22e74d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xrdpattern/pattern/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def show_all(self, single_plot : bool = False, limit_patterns : int = 100, title
data = [p.get_pattern_data() for p in patterns]
fig, ax = plt.subplots(dpi=600)
for x, y in data:
ax.plot(x, y, linewidth=0.25, alpha=0.75)
ax.plot(x, y, linewidth=0.25, alpha=0.75, linestyle='--')

ax.set_xlabel(r'$2\theta$ [$^\circ$]')
ax.set_ylabel('Standardized relative intensity (a.u.)')
Expand Down
5 changes: 4 additions & 1 deletion xrdpattern/pattern/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ def _get_uniform(self, start_val : float, stop_val : float, num_entries : int, c
x = np.array(self.two_theta_values)
y = np.array(self.intensities)
x, y = self.to_strictly_increasing(x, y)
y -= np.min(y)

cs = CubicSpline(x, y)
std_intensities = cs(std_angles)
below_start_indices = np.where(std_angles < start)[0]
above_end_indices = np.where(std_angles > end)[0]

indices_in_range = np.where((std_angles >= start) & (std_angles <= end))[0]
range_min = np.min(std_intensities[indices_in_range])
std_intensities -= range_min

if constant_padding:
below_start, after_end = y[0], y[-1]
else:
Expand Down

0 comments on commit 22e74d5

Please sign in to comment.