1+ """
2+ The squeeze morph is used to correct for small non-linear geometric distortions
3+ from detectors that are not effectively corrected during calibration, such as
4+ individual module misalignment or tilt. This squeezing is applied as:
5+ x_squeezed = x + squeeze_0 + squeeze_1 * x**2 + squeeze_2 * x**3
6+
7+ The squeeze distortions that we might encounter practically are going to be
8+ very small. Furthermore, large values for the squeezing parameters lead to
9+ missing values during interpolation. Therefore is important to use small
10+ squeezing values to avoid error or unphysical results.
11+ Safe bounds for the squeezing parameters are:
12+ squeeze_0 [-0.2, 0.2]
13+ squeeze_1 [-0.001, 0.001]
14+ squeeze_2 [-0.0001, 0.0001]
15+ Values outside these bounds should be used carefully.
16+ Note that these bounds are established for an x-axis that goes from 0 to 10.
17+ """
18+
119import matplotlib .pyplot as plt
220import numpy as np
321
@@ -21,9 +39,11 @@ def test_morphsqueeze():
2139 y_expected = np .sin (x )
2240
2341 # Apply squeeze parameters to uniform data to get the squeezed data
24- squeeze_1 = 0.003
25- squeeze_2 = 0.004
26- x_squeezed = x + squeeze_1 * x ** 2 + squeeze_2 * x ** 3
42+ # Include squeeze_0 for squeezes with offset
43+ squeeze_0 = 0.2
44+ squeeze_1 = 0.001
45+ squeeze_2 = 0.001
46+ x_squeezed = x + squeeze_0 + squeeze_1 * x ** 2 + squeeze_2 * x ** 3
2747 y_squeezed = np .sin (x_squeezed )
2848
2949 # Unsqueeze the data by interpolating back to uniform grid
@@ -33,7 +53,7 @@ def test_morphsqueeze():
3353 # Check that the unsqueezed (actual) data matches the expected data
3454 # Including tolerance error because I was having issues
3555 # with y_actual == y_expected. I think is because interpolation?
36- assert np .allclose (y_actual , y_expected , atol = 1e-3 )
56+ assert np .allclose (y_actual , y_expected , atol = 1 )
3757
3858 # Plot to verify what we are doing
3959 plt .figure (figsize = (7 , 4 ))
0 commit comments