diff --git a/news/epsilon.rst b/news/epsilon.rst new file mode 100644 index 0000000..f19b199 --- /dev/null +++ b/news/epsilon.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* MorphRGrid can now handle grids denser than 1e-08. Previously, it was possible that multiple points on the intersection range could be excluded. + +**Security:** + +* diff --git a/src/diffpy/morph/morphs/morphrgrid.py b/src/diffpy/morph/morphs/morphrgrid.py index fadce9f..b6f3e54 100644 --- a/src/diffpy/morph/morphs/morphrgrid.py +++ b/src/diffpy/morph/morphs/morphrgrid.py @@ -19,9 +19,6 @@ from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph -# roundoff tolerance for selecting bounds on arrays. -epsilon = 1e-8 - class MorphRGrid(Morph): """Resample to specified r-grid. @@ -71,6 +68,8 @@ def morph(self, x_morph, y_morph, x_target, y_target): self.rmax = rmaxinc if self.rstep is None or self.rstep < rstepinc: self.rstep = rstepinc + # roundoff tolerance for selecting bounds on arrays. + epsilon = self.rstep / 2 # Make sure that rmax is exclusive self.x_morph_out = numpy.arange( self.rmin, self.rmax - epsilon, self.rstep