Ejemplo n.º 1
0
def test_get_possible_apertures(instrument, expected_list):
    """Make sure the correct apertures are returned for the given instrument
    """
    badpix = bad_pixel_monitor.BadPixels()
    badpix.instrument = instrument
    ap_list = badpix.get_possible_apertures()
    assert ap_list == expected_list
Ejemplo n.º 2
0
def test_filter_query_results():
    """Test MAST query filtering to extract most common filter/pupil and
    acceptable readout patterns
    """
    badpix = bad_pixel_monitor.BadPixels()
    badpix.instrument = 'nircam'

    dict1 = {'filter': 'F070W', 'pupil': 'CLEAR', 'readpatt': 'RAPID'}
    dict2 = {'filter': 'F090W', 'pupil': 'CLEAR', 'readpatt': 'BRIGHT1'}
    dict3 = {'filter': 'F070W', 'pupil': 'CLEAR', 'readpatt': 'BRIGHT1'}
    query_results = [dict1, dict2, dict1, dict1, dict3, dict1]

    filtered = badpix.filter_query_results(query_results, 'flat')

    assert filtered == [dict1, dict1, dict1, dict1]

    # NIRSpec
    badpix.instrument = 'nirspec'

    dict1 = {'filter': 'F070W', 'grating': 'CLEAR', 'readpatt': 'NRSRAPID'}
    dict2 = {'filter': 'F070W', 'grating': 'CLEAR', 'readpatt': 'NRSIRS2'}
    dict3 = {'filter': 'F070W', 'grating': 'CLEAR', 'readpatt': 'NRSRAPID'}
    query_results = [dict1, dict2, dict1, dict1, dict3, dict1]

    filtered = badpix.filter_query_results(query_results, 'flat')

    assert filtered == [dict1, dict1, dict1, dict3, dict1]
Ejemplo n.º 3
0
def test_identify_tables():
    """Be sure the correct database tables are identified
    """
    badpix = bad_pixel_monitor.BadPixels()
    badpix.instrument = 'nircam'
    badpix.identify_tables()
    assert badpix.query_table == eval('NIRCamBadPixelQueryHistory')
    assert badpix.pixel_table == eval('NIRCamBadPixelStats')
Ejemplo n.º 4
0
def test_make_crds_parameter_dict():
    """Test that the dictionary to be used for CRDS queries is properly
    created
    """
    badpix = bad_pixel_monitor.BadPixels()
    badpix.instrument = 'nircam'
    badpix.detector = 'nrcalong'
    params = badpix.make_crds_parameter_dict()
    assert params['INSTRUME'] == 'NIRCAM'
    assert params['DETECTOR'] == 'NRCALONG'
    assert params['CHANNEL'] == 'LONG'