def test_flat_field_grism_step(rtdata, ignore_asdf_paths):
    """Test for the flat field step using grism data. The reference file for
       the grism and prism data should be None, only testing the grism
       case here."""

    input_file = "r0000201001001001002_01101_0001_WFI01_uncal.asdf"
    rtdata.get_data(f"WFI/grism/{input_file}")
    rtdata.input = input_file

    # Test CRDS
    step = FlatFieldStep()
    model = rdm.open(rtdata.input)
    try:
        ref_file_path = step.get_reference_file(model, "flat")
        ref_file_name = os.path.split(ref_file_path)[-1]
    except CrdsLookupError:
        ref_file_name = None
    assert ref_file_name is None

    # Test FlatFieldStep
    output = "r0000201001001001002_01101_0001_WFI01_flat.asdf"
    rtdata.output = output
    args = ["romancal.step.FlatFieldStep", rtdata.input]
    RomanStep.from_cmdline(args)
    rtdata.get_truth(f"truth/WFI/grism/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is
            None)
Beispiel #2
0
def test_saturation_grism_step(rtdata, ignore_asdf_paths):
    # Testing retrieval of best ref file for grism data,
    # and creation of a ramp file with CRDS selected saturation file applied.

    rtdata.get_data("WFI/grism/ramp_grism.asdf")
    rtdata.input = "ramp_grism.asdf"

    # Test CRDS
    step = SaturationStep()
    model = rdm.open(rtdata.input)
    ref_file_path = step.get_reference_file(model, "saturation")
    ref_file_name = os.path.split(ref_file_path)[-1]

    # Confirm that a WFI saturation reference file name was returned
    assert "roman_wfi_saturation" in ref_file_name

    # Test SaturationStep
    output = "ramp_grism_saturationstep.asdf"
    rtdata.output = output

    args = ["romancal.step.SaturationStep", rtdata.input]
    RomanStep.from_cmdline(args)

    ramp_out = rdm.open(rtdata.output)
    assert ("roman.pixeldq" in ramp_out.to_flat_dict())

    rtdata.get_truth(f"truth/WFI/grism/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is
            None)
Beispiel #3
0
def test_jump_detection_step(rtdata, ignore_asdf_paths):
    """ Function to run and compare Jump Detection files. Note: This should
        include tests for overrides etc. """
    rtdata.get_data("WFI/image/l1_0006_science_raw_dqinitstep.asdf")
    rtdata.input = "l1_0007_science_raw_dqinitstep.asdf"

    args = ["romancal.step.JumpStep", rtdata.input]
    RomanStep.from_cmdline(args)
    output = "l1_0007_science_raw_dqinitstep_jumpstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth,
            **ignore_asdf_paths) is None)
Beispiel #4
0
def test_linearity_step(rtdata, ignore_asdf_paths):
    """ Function to run and compare linearity correction files."""
    rtdata.get_data(
        "WFI/image/r0000101001001001001_01101_0001_WFI01_saturationstep.asdf")
    rtdata.input = "r0000101001001001001_01101_0001_WFI01_saturationstep.asdf"

    args = ["romancal.step.LinearityStep", rtdata.input]
    RomanStep.from_cmdline(args)
    output =\
        "r0000101001001001001_01101_0001_WFI01_linearitystep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is
            None)
def test_dark_current_outfile_suffix(rtdata, ignore_asdf_paths):
    """ Function to run and compare Dark Current subtraction files. Here the
        test is for renaming the output file. """
    rtdata.get_data(
        "WFI/image/r0000101001001001001_01101_0001_WFI01_linearitystep.asdf")
    rtdata.input = "r0000101001001001001_01101_0001_WFI01_linearitystep.asdf"

    args = ["romancal.step.DarkCurrentStep", rtdata.input,
            '--output_file=Test_dark', '--suffix="suffix_test"']
    RomanStep.from_cmdline(args)
    output = "Test_suffix_test.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth,
            **ignore_asdf_paths) is None)
Beispiel #6
0
def test_ramp_fitting_step(rtdata, ignore_asdf_paths):
    rtdata.get_data("WFI/image/ramp.asdf")
    rtdata.input = "ramp.asdf"

    args = ["romancal.step.RampFitStep", rtdata.input, '--save_opt=True', '--opt_name=rampfit_opt.asdf']
    RomanStep.from_cmdline(args)
    output = "ramp_0_rampfitstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)

    output = "rampfit_opt_fitopt.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)
Beispiel #7
0
def run_step_from_dict(rtdata, **step_params):
    """Run Steps with given parameter

    Parameters
    ----------
    rtdata: RegtestData
        The artifactory instance

    step_params: dict
        The parameters defining what step to run with what input

    Returns
    -------
    rtdata: RegtestData
        Updated `RegtestData` object with inputs set.

    Notes
    -----
    `step_params` looks like this:
    {
        'input_path': str or None  # The input file path, relative to artifactory
        'step': str                # The step to run, either a class or a config file
        'args': list,              # The arguments passed to `Step.from_cmdline`
    }
    """

    # Get the data. If `step_params['input_path]` is not
    # specified, the presumption is that `rtdata.input` has
    # already been retrieved.
    # input_path = step_params.get('input_path', None)
    # if input_path:
    #     try:
    #         rtdata.get_asn(input_path)
    #     except AssociationNotValidError:
    #         rtdata.get_data(input_path)

    # Figure out whether we have a config or class
    step = step_params['step']
    if step.endswith(('.asdf', '.cfg')):
        step = os.path.join('config', step)

    # Run the step
    full_args = [step, rtdata.input]
    full_args.extend(step_params['args'])

    RomanStep.from_cmdline(full_args)

    return rtdata
def test_dark_current_subtraction_step(rtdata, ignore_asdf_paths):
    """ Function to run and compare Dark Current subtraction files. Note: This
        should include tests for overrides etc. """

    input_datafile = "r0000101001001001001_01101_0001_WFI01_linearitystep.asdf"
    rtdata.get_data(f"WFI/image/{input_datafile}")
    rtdata.input = input_datafile

    args = ["romancal.step.DarkCurrentStep", rtdata.input]
    RomanStep.from_cmdline(args)
    output =\
        "r0000101001001001001_01101_0001_WFI01_darkcurrentstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth,
            **ignore_asdf_paths) is None)
Beispiel #9
0
def test_dq_init_image_step(rtdata, ignore_asdf_paths):
    # DMS25 Test: Testing retrieval of best ref file for image data,
    # and creation of a ramp file with CRDS selected mask file applied.

    rtdata.get_data("WFI/image/l1_0005_science_raw.asdf")
    rtdata.input = "l1_0005_science_raw.asdf"

    # Test CRDS
    step = DQInitStep()
    model = rdm.open(rtdata.input)
    step.log.info(
        'DMS25 MSG: Testing retrieval of best ref file for image data, '
        'Success is creation of a ramp file with CRDS selected mask file applied.'
    )

    step.log.info(
        f'DMS25 MSG: First data file: {rtdata.input.rsplit("/", 1)[1]}')
    ref_file_path = step.get_reference_file(model, "mask")
    step.log.info(
        f'DMS25 MSG: CRDS matched mask file: {ref_file_path.rsplit("/", 1)[1]}'
    )
    ref_file_name = os.path.split(ref_file_path)[-1]

    assert "roman_wfi_mask" in ref_file_name

    # Test DQInitStep
    output = "l1_0005_science_raw_dqinitstep.asdf"
    rtdata.output = output
    args = ["romancal.step.DQInitStep", rtdata.input]
    step.log.info(
        'DMS25 MSG: Running data quality initialization step. The first ERROR is '
        'expected, due to extra CRDS parameters not having been implemented yet.'
    )
    RomanStep.from_cmdline(args)
    ramp_out = rdm.open(rtdata.output)
    step.log.info(
        f'DMS25 MSG: Does ramp data contain pixeldq from mask file? : '
        f'{("roman.pixeldq" in ramp_out.to_flat_dict())}')
    assert ("roman.pixeldq" in ramp_out.to_flat_dict())

    rtdata.get_truth(f"truth/WFI/image/{output}")
    step.log.info(
        f'DMS25 MSG: Was proper data quality initialized ramp data produced? : '
        f'{(compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)}'
    )
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is
            None)
Beispiel #10
0
def test_dq_init_grism_step(rtdata, ignore_asdf_paths):
    """DMS26 Test: Testing retrieval of best ref file for grism data,
     and creation of a ramp file with CRDS selected mask file applied."""

    input_file = "r0000101001001001001_01102_0001_WFI01_uncal.asdf"
    rtdata.get_data(f"WFI/grism/{input_file}")
    rtdata.input = input_file

    # Test CRDS
    step = DQInitStep()
    model = rdm.open(rtdata.input)
    step.log.info('DMS26 MSG: Testing retrieval of best '
                  'ref file for grism data, '
                  'Success is creation of a ramp file with CRDS selected '
                  'mask file applied.')

    step.log.info(f'DMS26 MSG: First data file: '
                  f'{rtdata.input.rsplit("/", 1)[1]}')
    ref_file_path = step.get_reference_file(model, "mask")
    step.log.info(f'DMS26 MSG: CRDS matched mask file: '
                  f'{ref_file_path.rsplit("/", 1)[1]}')
    ref_file_name = os.path.split(ref_file_path)[-1]

    assert "roman_wfi_mask" in ref_file_name

    # Test DQInitStep
    output = "r0000101001001001001_01102_0001_WFI01_dqinitstep.asdf"
    rtdata.output = output
    args = ["romancal.step.DQInitStep", rtdata.input]
    step.log.info('DMS26 MSG: Running data quality initialization step.'
                  'The first ERROR is expected, due to extra CRDS parameters '
                  'not having been implemented yet.')
    RomanStep.from_cmdline(args)
    ramp_out = rdm.open(rtdata.output)
    step.log.info('DMS26 MSG: Does ramp data contain pixeldq '
                  'from mask file? : '
                  f'{("roman.pixeldq" in ramp_out.to_flat_dict())}')
    assert "roman.pixeldq" in ramp_out.to_flat_dict()

    rtdata.get_truth(f"truth/WFI/grism/{output}")
    step.log.info(
        'DMS26 MSG: Was proper data quality initialized '
        'ramp data produced? : '
        f'{(compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)}'
    )
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None
Beispiel #11
0
def test_flat_field_image_step(rtdata, ignore_asdf_paths):

    rtdata.get_data("WFI/image/l2_0004_rate.asdf")
    rtdata.input = "l2_0004_rate.asdf"

    # Test CRDS
    step = FlatFieldStep()
    model = rdm.open(rtdata.input)
    ref_file_path = step.get_reference_file(model, "flat")
    ref_file_name = os.path.split(ref_file_path)[-1]
    assert "roman_wfi_flat" in ref_file_name
    # Test FlatFieldStep
    output = "l2_0004_rate_flat.asdf"
    rtdata.output = output
    args = ["romancal.step.FlatFieldStep", rtdata.input]
    RomanStep.from_cmdline(args)
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is
            None)
def test_dark_current_output(rtdata, ignore_asdf_paths):
    """ Function to run and compare Dark Current subtraction files. Here the
        test for overriding the CRDS dark reference file. """

    rtdata.get_data(
        "WFI/image/r0000101001001001001_01101_0001_WFI01_linearitystep.asdf")
    rtdata.input = "r0000101001001001001_01101_0001_WFI01_linearitystep.asdf"
    dark_output_name = \
        "r0000101001001001001_01101_0001_WFI01_darkcurrentstep.asdf"

    args = ["romancal.step.DarkCurrentStep",
            rtdata.input,
            f"--dark_output={dark_output_name}"]
    RomanStep.from_cmdline(args)
    output =\
        "r0000101001001001001_01101_0001_WFI01_darkcurrentstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth,
            **ignore_asdf_paths) is None)
Beispiel #13
0
def test_jump_detection_step(rtdata, ignore_asdf_paths):
    """ Function to run and compare Jump Detection files. Note: This should
        include tests for overrides etc. """

    input_file = "r0000101001001001001_01101_0001_WFI01_darkcurrentstep.asdf"
    rtdata.get_data(f"WFI/image/{input_file}")
    rtdata.input = input_file

    # Note: the thresholds should be reset to the defaults once we have better
    # input data
    args = ["romancal.step.JumpStep", rtdata.input,
            '--rejection_threshold=180.',
            '--three_group_rejection_threshold=185.',
            '--four_group_rejection_threshold=190.']
    RomanStep.from_cmdline(args)
    output = "r0000101001001001001_01101_0001_WFI01_jumpstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert (compare_asdf(rtdata.output, rtdata.truth,
            **ignore_asdf_paths) is None)
def test_flat_field_image_step(rtdata, ignore_asdf_paths):
    """Test for the flat field step using imaging data."""

    input_data = "r0000101001001001001_01101_0001_WFI01_rampfitstep.asdf"
    rtdata.get_data(f"WFI/image/{input_data}")
    rtdata.input = input_data

    # Test CRDS
    step = FlatFieldStep()
    model = rdm.open(rtdata.input)
    ref_file_path = step.get_reference_file(model, "flat")
    ref_file_name = os.path.split(ref_file_path)[-1]
    assert "roman_wfi_flat" in ref_file_name
    # Test FlatFieldStep
    output = "r0000101001001001001_01101_0001_WFI01_flat.asdf"
    rtdata.output = output
    args = ["romancal.step.FlatFieldStep", rtdata.input]
    RomanStep.from_cmdline(args)
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None
Beispiel #15
0
def test_ramp_fitting_step(rtdata, ignore_asdf_paths):
    """ Testing the ramp fitting step"""
    input_data = "r0000101001001001001_01101_0001_WFI01_jumpstep.asdf"
    rtdata.get_data(f"WFI/image/{input_data}")
    rtdata.input = input_data

    args = [
        "romancal.step.RampFitStep", rtdata.input, '--save_opt=True',
        '--opt_name=rampfit_opt.asdf'
    ]
    RomanStep.from_cmdline(args)
    output = "r0000101001001001001_01101_0001_WFI01_rampfitstep.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None

    output = "rampfit_opt_fitopt.asdf"
    rtdata.output = output
    rtdata.get_truth(f"truth/WFI/image/{output}")
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None
Beispiel #16
0
def test_absolute_photometric_calibration(rtdata, ignore_asdf_paths):
    """DMS140 Test: Testing application of photometric correction using
       CRDS selected photom file."""

    input_data = "r0000201001001001001_01101_0001_WFI01_cal.asdf"
    rtdata.get_data(f"WFI/image/{input_data}")
    rtdata.input = input_data

    # Define step (for running and log access)
    step = PhotomStep()

    #  In Wide Field Imaging mode, the DMS shall generate Level 2 science
    # data products with absolute photometry calibrated in the WFI filter
    # used for the exposure.
    step.log.info('DMS140 MSG: Testing absolute photometric '
                  'calibrated image data. '
                  'Success is creation of a Level 2 image file with '
                  'CRDS selected photom file applied.')

    step.log.info('DMS140 MSG: Image data file: '
                  f'{rtdata.input.rsplit("/", 1)[1]}')

    # Note: if any of the following tests fail, check for a different
    # photom match from CRDS. Values come from roman_wfi_photom_0034.asdf

    # Test PhotomStep
    output = "r0000201001001001001_01101_0001_WFI01_cal_photomstep.asdf"
    rtdata.output = output
    args = ["romancal.step.PhotomStep", rtdata.input]
    step.log.info('DMS140 MSG: Running photometric conversion step.'
                  ' The first ERROR is expected, due to extra CRDS parameters'
                  ' not having been implemented yet.')
    RomanStep.from_cmdline(args)
    photom_out = rdm.open(rtdata.output)

    step.log.info(f'DMS140 MSG: Photom step recorded as complete? : '
                  f'{photom_out.meta.cal_step.photom == "COMPLETE"}')
    assert photom_out.meta.cal_step.photom == "COMPLETE"

    step.log.info(
        'DMS140 MSG: Photom megajansky conversion calculated? : ' +
        str((photom_out.meta.photometry.conversion_megajanskys.unit == u.MJy /
             u.sr) and math.isclose(
                 photom_out.meta.photometry.conversion_megajanskys.value,
                 0.3214,
                 abs_tol=0.0001)))
    assert photom_out.meta.photometry.conversion_megajanskys.unit == u.MJy / u.sr
    assert math.isclose(
        photom_out.meta.photometry.conversion_megajanskys.value,
        0.3214,
        abs_tol=0.0001)

    step.log.info(
        'DMS140 MSG: Photom microjanskys conversion calculated? : ' +
        str((photom_out.meta.photometry.conversion_microjanskys.unit == u.uJy /
             u.arcsec**2) and (math.isclose(
                 photom_out.meta.photometry.conversion_microjanskys.value,
                 7.5549,
                 abs_tol=0.0001))))
    assert photom_out.meta.photometry.conversion_microjanskys.unit == u.uJy / u.arcsec**2
    assert math.isclose(
        photom_out.meta.photometry.conversion_microjanskys.value,
        7.5549,
        abs_tol=0.0001)

    step.log.info('DMS140 MSG: Pixel area in steradians calculated? : ' + str(
        (photom_out.meta.photometry.pixelarea_steradians.unit == u.sr) and
        (math.isclose(photom_out.meta.photometry.pixelarea_steradians.value,
                      2.8083e-13,
                      abs_tol=1.0e-17))))
    assert photom_out.meta.photometry.pixelarea_steradians.unit == u.sr
    assert math.isclose(photom_out.meta.photometry.pixelarea_steradians.value,
                        2.8083e-13,
                        abs_tol=1.0e-17)

    step.log.info(
        'DMS140 MSG: Pixel area in square arcseconds calculated? : ' +
        str((photom_out.meta.photometry.pixelarea_arcsecsq.unit == u.arcsec**2)
            and
            (math.isclose(photom_out.meta.photometry.pixelarea_arcsecsq.value,
                          0.011948,
                          abs_tol=1.0e-6))))
    assert photom_out.meta.photometry.pixelarea_arcsecsq.unit == u.arcsec**2
    assert math.isclose(photom_out.meta.photometry.pixelarea_arcsecsq.value,
                        0.011948,
                        abs_tol=1.0e-6)

    step.log.info('DMS140 MSG: Photom megajansky conversion uncertainty calculated? : ' +
                  str((photom_out.meta.photometry.conversion_megajanskys_uncertainty.unit
                       == u.MJy / u.sr) and
                      (math.isclose(photom_out.meta.photometry.\
                                    conversion_megajanskys_uncertainty.value, 0.0,
                                    abs_tol=1.0e-6))))
    assert photom_out.meta.photometry.conversion_megajanskys_uncertainty.unit == u.MJy / u.sr
    assert math.isclose(
        photom_out.meta.photometry.conversion_megajanskys_uncertainty.value,
        0.0,
        abs_tol=1.0e-6)

    step.log.info('DMS140 MSG: Photom megajansky conversion uncertainty calculated? : ' +
                  str((photom_out.meta.photometry.conversion_microjanskys_uncertainty.unit ==
                       u.uJy / u.arcsec ** 2) and
                      (math.isclose(photom_out.meta.photometry.\
                                    conversion_microjanskys_uncertainty.value, 0.0,
                                    abs_tol=1.0e-6))))
    assert photom_out.meta.photometry.conversion_microjanskys_uncertainty.unit ==  \
           u.uJy / u.arcsec ** 2
    assert math.isclose(
        photom_out.meta.photometry.conversion_microjanskys_uncertainty.value,
        0.0,
        abs_tol=1.0e-6)

    rtdata.get_truth(f"truth/WFI/image/{output}")
    step.log.info(
        f'DMS140 MSG: Was the proper absolute photometry calibrated image data produced?'
        f' : {(compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)}'
    )
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None
def test_flat_field_crds_match_image_step(rtdata, ignore_asdf_paths):
    """DMS79 Test: Testing that different datetimes pull different
       flat files and successfully make level 2 output"""

    # First file
    input_l2_file = "r0000101001001001001_01101_0001_WFI01_assign_wcs.asdf"
    rtdata.get_data(f"WFI/image/{input_l2_file}")
    rtdata.input = input_l2_file

    # Test CRDS
    step = FlatFieldStep()
    model = rdm.open(rtdata.input)
    step.log.info('DMS79 MSG: Testing retrieval of best ref file, '
                  'Success is flat file with correct use after date')

    step.log.info('DMS79 MSG: First data file: '
                  f'{rtdata.input.rsplit("/", 1)[1]}')
    step.log.info('DMS79 MSG: Observation date: '
                  f'{model.meta.exposure.start_time}')

    ref_file_path = step.get_reference_file(model, "flat")
    step.log.info('DMS79 MSG: CRDS matched flat file: '
                  f'{ref_file_path.rsplit("/", 1)[1]}')
    flat = rdm.open(ref_file_path)
    step.log.info(f'DMS79 MSG: flat file UseAfter date: {flat.meta.useafter}')
    step.log.info(f'DMS79 MSG: UseAfter date before observation date? : '
                  f'{(flat.meta.useafter < model.meta.exposure.start_time)}')

    # Test FlatFieldStep
    output = "r0000101001001001001_01101_0001_WFI01_flat.asdf"
    rtdata.output = output
    args = ["romancal.step.FlatFieldStep", rtdata.input]
    step.log.info('DMS79 MSG: Running flat fielding step. The first ERROR is'
                  'expected, due to extra CRDS parameters not having been '
                  'implemented yet.')
    RomanStep.from_cmdline(args)
    rtdata.get_truth(f"truth/WFI/image/{output}")

    step.log.info(
        'DMS79 MSG: Was proper flat fielded '
        'Level 2 data produced? : '
        f'{(compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)}'
    )
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None

    # This test requires a second file, in order to meet the DMS79 requirement.
    # The test will show that two files with different observation dates match
    #  to separate flat files in CRDS.

    # Second file
    input_file = "r0000101001001001001_01101_0002_WFI01_assign_wcs.asdf"
    rtdata.get_data(f"WFI/image/{input_file}")
    rtdata.input = input_file

    # Test CRDS
    step = FlatFieldStep()
    model = rdm.open(rtdata.input)

    step.log.info('DMS79 MSG: Second data file: '
                  f'{rtdata.input.rsplit("/", 1)[1]}')
    step.log.info('DMS79 MSG: Observation date: '
                  f'{model.meta.exposure.start_time}')

    ref_file_path_b = step.get_reference_file(model, "flat")
    step.log.info('DMS79 MSG: CRDS matched flat file: '
                  f'{ref_file_path_b.rsplit("/", 1)[1]}')
    flat = rdm.open(ref_file_path_b)
    step.log.info(f'DMS79 MSG: flat file UseAfter date: {flat.meta.useafter}')
    step.log.info(f'DMS79 MSG: UseAfter date before observation date? : '
                  f'{(flat.meta.useafter < model.meta.exposure.start_time)}')

    # Test FlatFieldStep
    output = "r0000101001001001001_01101_0002_WFI01_flat.asdf"
    rtdata.output = output
    args = ["romancal.step.FlatFieldStep", rtdata.input]
    step.log.info('DMS79 MSG: Running flat fielding step. The first ERROR is'
                  'expected, due to extra CRDS parameters not having been '
                  'implemented yet.')
    RomanStep.from_cmdline(args)
    rtdata.get_truth(f"truth/WFI/image/{output}")
    step.log.info(
        'DMS79 MSG: Was proper flat fielded '
        'Level 2 data produced? : '
        f'{(compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths) is None)}'
    )
    assert compare_asdf(rtdata.output, rtdata.truth, **
                        ignore_asdf_paths) is None

    # Test differing flat matches
    step.log.info('DMS79 MSG REQUIRED TEST: Are the two data files '
                  'matched to different flat files? : '
                  f'{("/".join(ref_file_path.rsplit("/", 3)[1:]))} != '
                  f'{("/".join(ref_file_path_b.rsplit("/", 3)[1:]))}')
    assert ("/".join(ref_file_path.rsplit("/", 1)[1:])) != \
           ("/".join(ref_file_path_b.rsplit("/", 1)[1:]))