@@ -24,20 +24,40 @@ def run_pipeline(rtdata_module, resource_tracker):
24
24
args = ["calwebb_spec2" , rtdata .input ,
25
25
"--steps.assign_wcs.save_results=true" ,
26
26
"--steps.msa_flagging.save_results=true" ,
27
- "--steps.nsclean.skip=False" ,
28
- "--steps.nsclean.save_results=true" ,
29
27
"--steps.bkg_subtract.save_results=true" ,
30
28
"--steps.extract_2d.save_results=true" ,
31
29
"--steps.srctype.save_results=true" ,
32
30
"--steps.wavecorr.save_results=true" ,
33
31
"--steps.flat_field.save_results=true" ,
34
32
"--steps.pathloss.save_results=true" ,
35
33
"--steps.barshadow.save_results=true" ]
36
- # FIXME: Handle warnings properly.
37
- # Example: RuntimeWarning: Invalid interval: upper bound XXX is strictly less than lower bound XXX
38
- with pytest .warns (AstropyUserWarning , match = "Input data contains invalid values" ):
39
- with resource_tracker .track ():
40
- Step .from_cmdline (args )
34
+
35
+ with resource_tracker .track ():
36
+ Step .from_cmdline (args )
37
+
38
+ return rtdata
39
+
40
+
41
+ @pytest .fixture (scope = "module" )
42
+ def run_pipeline_nsclean (rtdata_module , resource_tracker ):
43
+ """Run the calwebb_spec2 pipeline on NIRSpec MOS with nsclean."""
44
+
45
+ rtdata = rtdata_module
46
+
47
+ # Get the MSA metadata file referenced in the input exposure
48
+ rtdata .get_data ("nirspec/mos/jw01345066001_01_msa.fits" )
49
+
50
+ # Get the input ASN file and exposures
51
+ rtdata .get_asn ("nirspec/mos/jw01345-o066_20230831t181155_spec2_00010_asn.json" )
52
+
53
+ # Run the calwebb_spec2 pipeline; save results from intermediate steps
54
+ args = ["calwebb_spec2" , rtdata .input ,
55
+ "--output_file=jw01345066001_05101_00003_nrs1_nsc" ,
56
+ "--steps.nsclean.skip=False" ,
57
+ "--steps.nsclean.save_results=True" ]
58
+
59
+ with resource_tracker .track ():
60
+ Step .from_cmdline (args )
41
61
42
62
return rtdata
43
63
@@ -47,7 +67,7 @@ def test_log_tracked_resources(log_tracked_resources, run_pipeline):
47
67
48
68
49
69
@pytest .mark .parametrize ("suffix" , [
50
- "assign_wcs" , "msa_flagging" , "nsclean" , " bsub" , "extract_2d" , "wavecorr" , "flat_field" ,
70
+ "assign_wcs" , "msa_flagging" , "bsub" , "extract_2d" , "wavecorr" , "flat_field" ,
51
71
"srctype" , "pathloss" , "barshadow" , "cal" , "s2d" , "x1d" ])
52
72
def test_nirspec_mos_spec2 (run_pipeline , fitsdiff_default_kwargs , suffix ):
53
73
"""Regression test of the calwebb_spec2 pipeline on a
@@ -66,3 +86,24 @@ def test_nirspec_mos_spec2(run_pipeline, fitsdiff_default_kwargs, suffix):
66
86
# Compare the results
67
87
diff = FITSDiff (rtdata .output , rtdata .truth , ** fitsdiff_default_kwargs )
68
88
assert diff .identical , diff .report ()
89
+
90
+
91
+ @pytest .mark .parametrize ("suffix" , [
92
+ "nsclean" , "cal" , "s2d" , "x1d" ])
93
+ def test_nirspec_mos_spec2_nsclean (run_pipeline , fitsdiff_default_kwargs , suffix ):
94
+ """Regression test of the calwebb_spec2 pipeline on a
95
+ NIRSpec MOS exposure. Using an exposure that's part of a
96
+ 3-shutter nod sequence, so there are nodded exposures available
97
+ with which to do background subtraction."""
98
+
99
+ # Run the pipeline and retrieve outputs
100
+ rtdata = run_pipeline
101
+ output = f"jw01345066001_05101_00003_nrs1_nsc_{ suffix } .fits"
102
+ rtdata .output = output
103
+
104
+ # Get the truth files
105
+ rtdata .get_truth ("truth/test_nirspec_mos_spec2/" + output )
106
+
107
+ # Compare the results
108
+ diff = FITSDiff (rtdata .output , rtdata .truth , ** fitsdiff_default_kwargs )
109
+ assert diff .identical , diff .report ()
0 commit comments