Esempio n. 1
0
def test_flag_cr(sci_blot_image_pair):
    """Test the flag_cr function.  Test logic, not the actual noise model."""
    sci, blot = sci_blot_image_pair
    assert (sci.dq == 0).all()

    # Drop some CRs on the science array
    sci.data[3, 3] += 100
    sci.data[3, 7] += 1e3
    sci.data[7, 3] += 1e4
    sci.data[7, 7] += 1e5

    # run flag_cr() which updates in-place.  Copy sci first.
    data_copy = sci.data.copy()
    flag_cr(sci, blot)

    # Make sure science data array is unchanged after flag_cr()
    np.testing.assert_allclose(sci.data, data_copy)

    # Verify that both DQ flags are set in the DQ array for all outliers
    assert sci.dq[3, 3] == OUTLIER_DO_NOT_USE
    assert sci.dq[3, 7] == OUTLIER_DO_NOT_USE
    assert sci.dq[7, 3] == OUTLIER_DO_NOT_USE
    assert sci.dq[7, 7] == OUTLIER_DO_NOT_USE

    # Verify the source wasn't flagged
    assert sci.dq[10, 10] == datamodels.dqflags.pixel["GOOD"]
Esempio n. 2
0
def test_flag_cr_with_subtracted_background(sci_blot_image_pair):
    """Test the flag_cr function on background-subtracted data"""
    sci, blot = sci_blot_image_pair

    sci.meta.background.subtracted = True
    sci.meta.background.level = 3

    # Drop a CR on the science array
    sci.data[5, 5] += 10

    flag_cr(sci, blot)
    assert sci.dq[5, 5] > 0
Esempio n. 3
0
def test_flag_cr(sci_blot_image_pair):
    """Test the flag_cr function.  Test logic, not the actual noise model."""
    sci, blot = sci_blot_image_pair
    assert (sci.dq == 0).all()

    # Add some background
    sci.data += 3
    blot.data += 3

    # Drop a CR on the science array
    sci.data[5, 5] += 10

    flag_cr(sci, blot)
    assert sci.dq[5, 5] > 0