diff --git a/CHANGES.rst b/CHANGES.rst index e29f726250..b2b0f93cae 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,15 @@ 1.11.1 (unreleased) =================== -- +ramp_fitting +------------ + +- Updated the CI tests due to change in STCAL, which fixed bug for using the + correct timing for slope computation. Since there are now special cases that + use ZEROFRAME data, as well as ramps that have only good data in the 0th + group, the timing for these ramps is not group time. These adjusted times + are now used. [#7612, spacetelescope/stcal#173] + 1.11.0 (2023-06-21) =================== diff --git a/jwst/ramp_fitting/tests/test_ramp_fit.py b/jwst/ramp_fitting/tests/test_ramp_fit.py index fb4b15618e..1313156eea 100644 --- a/jwst/ramp_fitting/tests/test_ramp_fit.py +++ b/jwst/ramp_fitting/tests/test_ramp_fit.py @@ -744,10 +744,10 @@ def test_twenty_groups_two_segments(): np.testing.assert_allclose(oslope[wh_data], 10. / deltatime, rtol=1E-4) np.testing.assert_allclose(oyint[0, 0, 0, :], model1.data[0, 0, 0, :], rtol=1E-5) - np.testing.assert_allclose( - opedestal[0, 0, :], - model1.data[0, 0, 0, :] - 10., - rtol=1E-5) + check = model1.data[0, 0, 0, :] - oslope + tol = 1E-5 + # Pixel 1 has zero slope, so ignore it. + np.testing.assert_allclose(opedestal[0, 0, 1:], check[0, 0, 0, 1:], tol) def test_miri_all_sat(): @@ -897,7 +897,7 @@ def test_zeroframe_usage(): # Check slopes information sdata, sdq, svp, svr, serr = slopes - check = np.array([[20.709406, 0.46572033, 4.6866207]]) + check = np.array([[41.003822, 0.46572033, 21.655062]]) np.testing.assert_allclose(sdata, check, tol, tol) # Since the second integration is GOOD the final DQ is GOOD. @@ -916,8 +916,8 @@ def test_zeroframe_usage(): # Check slopes information cdata, cdq, cvp, cvr, cerr = cube - check = np.array([[[186.28912, np.nan, 93.14456]], - [[0.46572027, 0.46572033, 0.46572033]]]) + check = np.array([[[3.7257825e+02, np.nan, 4.6572281e+02]], + [[4.6572030e-01, 4.6572030e-01, 4.6572030e-01]]]) np.testing.assert_allclose(cdata, check, tol, tol) # Column 2 in the first integration is marked GOOD because there @@ -1041,8 +1041,8 @@ def setup_small_cube(ngroups=10, nints=1, nrows=2, ncols=2, deltatime=10., # Need test for multi-ints near zero with positive and negative slopes -def setup_inputs(ngroups=10, readnoise=10, nints=1, - nrows=103, ncols=102, nframes=1, grouptime=1.0, gain=1, deltatime=1): +def setup_inputs(ngroups=10, readnoise=10, nints=1, nrows=103, ncols=102, + nframes=1, grouptime=1.0, gain=1, deltatime=1): data = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) err = np.ones(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) diff --git a/jwst/ramp_fitting/tests/test_ramp_fit_cases.py b/jwst/ramp_fitting/tests/test_ramp_fit_cases.py index 82ae7262ab..65ef1c7410 100644 --- a/jwst/ramp_fitting/tests/test_ramp_fit_cases.py +++ b/jwst/ramp_fitting/tests/test_ramp_fit_cases.py @@ -5,6 +5,7 @@ from stdatamodels.jwst.datamodels import RampModel, GainModel, ReadnoiseModel, dqflags + # # The first 12 tests are for a single ramp in a single integration. The ramps # have a variety of GROUPDQ vectors, with 1 or more segments in each ramp. The @@ -54,7 +55,7 @@ def test_pix_0(): # Set truth values for OPTIONAL results: # [slope, sigslope, var_poisson, var_rnoise, yint, sigyint, ped, weights] o_true = [1.0117551, 4.874572, 0.0020202, 0.00647973, - 15.911023, 27.789335, 4.882449, 13841.038] + 15.911023, 27.789335, 13.988245, 13841.038] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -92,7 +93,7 @@ def test_pix_1(): # Set truth values for OPTIONAL results: o_true = [1.9, 56.870003, 0.03454545, 1.0691562, -3., 56.870003, - -3.999998, 0.82091206] + 13.1, 0.82091206] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -129,7 +130,7 @@ def test_pix_2(): [0.26728904, 1.0691562, 1.0691562], # var_rnoise [14.999998, 51., 15.], # yint [36.709427, 56.870003, 56.870003], # sigyint - [6.5166273], # pedestal + [14.151663], # pedestal [13.091425, 0.84580624, 0.84580624], # weights ] @@ -169,7 +170,7 @@ def test_pix_3(): [0.01272805, 1.0691562], [14.504965, 15.], [27.842508, 56.870003], - [4.253134], + [13.925313], [4.2576841e+03, 8.458062e-01], ] @@ -202,7 +203,7 @@ def test_pix_4(): p_true = [1.5, GOOD, 1.047105, 0.02727273, 1.0691562] # Set truth values for OPTIONAL results: - o_true = [1.5, 0., 0.02727273, 1.0691562, 0., 0., 0., 0.8318386] + o_true = [1.5, 0., 0.02727273, 1.0691562, 0., 0., 13.5, 0.8318386] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -241,7 +242,7 @@ def test_pix_5(): [0.10691562, 0.03054732], [13.537246, 2015.0737], [35.301933, 67.10882], - [4.2391253], + [13.923912], [78.34764, 855.78046] ] @@ -282,7 +283,7 @@ def test_pix_6(): [1.0691562, 0.01909207], [15., -143.2391], [56.870003, 58.76999], - [-45.92052], + [8.907948], [8.4580624e-01, 2.0433204e+03] ] @@ -315,7 +316,7 @@ def test_pix_7(): # Set truth values for OPTIONAL results: o_true = [1.0757396, 6.450687, 0.0025974, 0.01272805, 14.504951, - 27.842508, 4.2426033, 4257.684] + 27.842508, 13.92426, 4257.684] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -347,7 +348,7 @@ def test_pix_8(): # Set truth values for OPTIONAL results: o_true = [0.98561335, 9.920554, 0.00363636, 0.03054732, 16.508228, - 39.383667, 5.1438665, 855.78046] + 39.383667, 14.014386, 855.78046] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -385,7 +386,7 @@ def test_pix_9(): [1.0691562, 0.05345781, 1.0691562], [15., 20.119896, 15.], [56.870003, 68.618195, 56.870003], - [5.000005], + [14.], [0.84580624, 297.23172, 0.84580624] ] @@ -425,7 +426,7 @@ def test_pix_10(): [1.0691562, 0.26728904, 0.05345781], [15., 17.999956, 15.000029], [56.870003, 88.40799, 93.73906], - [5.], + [14.], [0.84580624, 13.091425, 297.23172] ] @@ -457,7 +458,7 @@ def test_pix_11(): p_true = [1., GOOD, 1.042755, 0.01818182, 1.0691562] # Set truth values for OPTIONAL results: - o_true = [1., 56.870003, 0.01818182, 1.0691562, 15., 56.870003, 5., + o_true = [1., 56.870003, 0.01818182, 1.0691562, 15., 56.870003, 14., 0.84580624] assert_pri(p_true, new_mod, 0) @@ -498,7 +499,7 @@ def test_pix_12(): # slope, sig_slope, var_p, var_r, yint, sig_yint, pedestal, weights # slope = group1 / deltatime = 15 / 10 = 1.5 # sig_slope, yint, sig_yint, and pedestal are all zero, because only 1 good group - o_true = [1.5, 0., 0.027273, 1.069156, 0., 0., 0., 0.831839] + o_true = [1.5, 0., 0.027273, 1.069156, 0., 0., 13.5, 0.831839] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -544,7 +545,7 @@ def test_miri_0(): # Set truth values for OPTIONAL results: o_true = [1.025854, 6.450687, 0.0025974, 0.01272805, 26.439266, 27.842508, - 14.74146, 4257.684] + 23.974146, 4257.684] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -576,7 +577,7 @@ def test_miri_1(): # Set truth values for OPTIONAL results: o_true = [1.1996487, 6.450687, 0.0025974, 0.01272805, 126.110214, - 27.842508, 113.00351, 4257.684] + 27.842508, 123.800354, 4257.684] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -608,7 +609,7 @@ def test_miri_2(): # Set truth values for OPTIONAL results: o_true = [1.025854, 6.450687, 0.0025974, 0.01272805, 26.439266, 27.842508, - 14.74146, 4257.684] + 23.974146, 4257.684] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) @@ -640,7 +641,7 @@ def test_miri_3(): # Set truth values for OPTIONAL results: o_true = [1.025854, 6.450687, 0.0025974, 0.01272805, 26.439266, - 27.842508, 14.74146, 4257.684] + 27.842508, 23.974146, 4257.684] assert_pri(p_true, new_mod, 0) assert_opt(o_true, opt_mod, 0) diff --git a/jwst/ramp_fitting/tests/test_ramp_fit_step.py b/jwst/ramp_fitting/tests/test_ramp_fit_step.py index 3914f6f371..5844b29247 100644 --- a/jwst/ramp_fitting/tests/test_ramp_fit_step.py +++ b/jwst/ramp_fitting/tests/test_ramp_fit_step.py @@ -330,7 +330,7 @@ def test_one_group_not_suppressed_one_integration(setup_inputs): tol = 1e-5 # Check slopes information - check = np.array([[np.nan, 1., 1.0000002]]) + check = np.array([[np.nan, .2, 0.2]]) np.testing.assert_allclose(slopes.data, check, tol) check = np.array([[DNU | SAT, GOOD, GOOD]]) @@ -346,7 +346,7 @@ def test_one_group_not_suppressed_one_integration(setup_inputs): np.testing.assert_allclose(slopes.err, check, tol) # Check slopes information - check = np.array([[[np.nan, 1., 1.0000001]]]) + check = np.array([[[np.nan, .2, .2]]]) np.testing.assert_allclose(cube.data, check, tol) check = np.array([[[DNU | SAT, GOOD, GOOD]]]) @@ -377,7 +377,7 @@ def test_one_group_suppressed_one_integration(setup_inputs): tol = 1e-5 # Check slopes information - check = np.array([[np.nan, np.nan, 1.0000002]]) + check = np.array([[np.nan, np.nan, .2]]) np.testing.assert_allclose(slopes.data, check, tol) check = np.array([[DNU | SAT, DNU, GOOD]]) @@ -393,7 +393,7 @@ def test_one_group_suppressed_one_integration(setup_inputs): np.testing.assert_allclose(slopes.err, check, tol) # Check slopes information - check = np.array([[[np.nan, np.nan, 1.0000001]]]) + check = np.array([[[np.nan, np.nan, .2]]]) np.testing.assert_allclose(cube.data, check, tol) check = np.array([[[DNU | SAT, DNU, 0]]]) @@ -426,7 +426,7 @@ def test_one_group_not_suppressed_two_integrations(setup_inputs): tol = 1e-5 # Check slopes information - check = np.array([[1.0000001, 1.0000002, 1.0000002]]) + check = np.array([[.2, .2, .2]]) np.testing.assert_allclose(slopes.data, check, tol) check = np.array([[GOOD, GOOD, GOOD]]) @@ -442,8 +442,8 @@ def test_one_group_not_suppressed_two_integrations(setup_inputs): np.testing.assert_allclose(slopes.err, check, tol) # Check slopes information - check = np.array([[[np.nan, 1., 1.0000001]], - [[1.0000001, 1.0000001, 1.0000001]]]) + check = np.array([[[np.nan, .2, .2]], + [[.2, .2, .2]]]) np.testing.assert_allclose(cube.data, check, tol) check = np.array([[[SAT | DNU, GOOD, GOOD]], @@ -480,7 +480,7 @@ def test_one_group_suppressed_two_integrations(setup_inputs): tol = 1e-5 # Check slopes information - check = np.array([[1.0000001, 1.0000001, 1.0000002]]) + check = np.array([[.2, .2, .2]]) np.testing.assert_allclose(slopes.data, check, tol) check = np.array([[GOOD, GOOD, GOOD]]) @@ -496,8 +496,8 @@ def test_one_group_suppressed_two_integrations(setup_inputs): np.testing.assert_allclose(slopes.err, check, tol) # Check slopes information - check = np.array([[[np.nan, np.nan, 1.0000001]], - [[1.0000001, 1.0000001, 1.0000001]]]) + check = np.array([[[np.nan, np.nan, .2]], + [[.2, .2, .2]]]) np.testing.assert_allclose(cube.data, check, tol) check = np.array([[[DNU | SAT, DNU, GOOD]],