diff --git a/docs/notebooks b/docs/notebooks index 43ba05942..d3a039c52 160000 --- a/docs/notebooks +++ b/docs/notebooks @@ -1 +1 @@ -Subproject commit 43ba0594276c66e27a877488ec333b5c3e0b56b3 +Subproject commit d3a039c52a4b16724340de5af46c3f158209d03f diff --git a/stingray/pulse/modeling.py b/stingray/pulse/modeling.py index dc864d33f..2934b0935 100644 --- a/stingray/pulse/modeling.py +++ b/stingray/pulse/modeling.py @@ -89,14 +89,16 @@ def sinc_square_deriv(x, amplitude=1.0, mean=0.0, width=1.0): >>> assert np.allclose(sinc_square_deriv(0, amplitude=2.), [1., 0., 0.]) """ x_is_zero = x == mean - + denominator = (x - mean) / width + denominator_squared = np.where(denominator == 0, 1e-10, denominator**2) # Avoid division by 0 d_x = ( 2 * amplitude * sinc((x - mean) / width) * (x * np.cos((x - mean) / width) - np.sin((x - mean) / width)) - / ((x - mean) / width) ** 2 + / denominator_squared ) + d_x = np.asanyarray(d_x) d_amplitude = sinc((x - mean) / width) ** 2 d_x[x_is_zero] = 0