示例#1
0
def test_calspec3_config_miri_multi(_jail, miri_full_coverage):
    """ Test CalSpec3 MIRI configuration default band cubes"""

    pars_input = {}
    pars_input['channel'] = []
    pars_input['subchannel'] = []
    pars_input['filter'] = []
    pars_input['grating'] = []
    weighting = 'msm'
    output_type = 'multi'
    single = False
    par_filename = 'None'
    resol_filename = 'None'

    input_file = 'test.fits'
    num_files = len(miri_full_coverage)
    input_filenames = []
    for i in range(num_files):
        input_filenames.append(input_file)

    pars = {
        'channel': pars_input['channel'],
        'subchannel': pars_input['subchannel'],
        'grating': pars_input['grating'],
        'filter': pars_input['filter'],
        'weighting': weighting,
        'single': single,
        'output_type': output_type
    }

    cubeinfo = cube_build.CubeData(miri_full_coverage, input_filenames,
                                   par_filename, resol_filename, **pars)

    master_table = file_table.FileTable()
    this_instrument = master_table.set_file_table(cubeinfo.input_models,
                                                  cubeinfo.input_filenames)

    assert this_instrument == 'MIRI'

    cubeinfo.instrument = this_instrument
    cubeinfo.determine_band_coverage(master_table)
    num_cubes, cube_pars = cubeinfo.number_cubes()
    assert num_cubes == 1
    assert cubeinfo.all_channel == [
        '1', '1', '1', '2', '2', '2', '3', '3', '3', '4', '4', '4'
    ]
    assert cubeinfo.all_subchannel == [
        'short', 'medium', 'long', 'short', 'medium', 'long', 'short',
        'medium', 'long', 'short', 'medium', 'long'
    ]

    assert cube_pars['1']['par1'] == [
        '1', '1', '1', '2', '2', '2', '3', '3', '3', '4', '4', '4'
    ]
    assert cube_pars['1']['par2'] == [
        'short', 'medium', 'long', 'short', 'medium', 'long', 'short',
        'medium', 'long', 'short', 'medium', 'long'
    ]
示例#2
0
def test_calspec3_config_nirspec(_jail, nirspec_medium_coverage):
    """ Test CalSpec3 configuration for NIRSpec - default band cubes"""

    pars_input = {}
    pars_input['channel'] = []
    pars_input['subchannel'] = []
    pars_input['filter'] = []
    pars_input['grating'] = []
    weighting = 'msm'
    output_type = 'band'
    single = False
    par_filename = 'None'
    resol_filename = 'None'

    input_file = 'test.fits'
    num_files  = len(nirspec_medium_coverage)
    input_filenames = []
    for i in range (num_files):
        input_filenames.append(input_file)

    pars = {
        'channel': pars_input['channel'],
        'subchannel': pars_input['subchannel'],
        'grating': pars_input['grating'],
        'filter': pars_input['filter'],
        'weighting': weighting,
        'single': single,
        'output_type':output_type}

    cubeinfo = cube_build.CubeData(
        nirspec_medium_coverage,
        input_filenames,
        par_filename,
        resol_filename,
        **pars)

    master_table = file_table.FileTable()
    this_instrument = master_table.set_file_table(
        cubeinfo.input_models,cubeinfo.input_filenames)

    assert this_instrument == 'NIRSPEC'

    cubeinfo.instrument  = this_instrument
    cubeinfo.determine_band_coverage(master_table)
    num_cubes,cube_pars = cubeinfo.number_cubes()

    assert num_cubes == 2

    assert cubeinfo.all_grating == ['g140m','g235m']
    assert cubeinfo.all_filter == ['f100lp','f170lp']

    assert cube_pars['1']['par1'] == ['g140m']
    assert cube_pars['1']['par2'] == ['f100lp']
    assert cube_pars['2']['par1'] == ['g235m']
    assert cube_pars['2']['par2'] == ['f170lp']
示例#3
0
def test_calspec2_config(_jail, miri_ifushort_short):
    """ Determine cube based on calspec2 setup """

    pars_input = {}
    pars_input['channel'] = []
    pars_input['subchannel'] = []
    pars_input['filter'] = []
    pars_input['grating'] = []
    weighting = 'msm'
    output_type = 'multi' #calspec 2 setup. Only 1 cube create from 2 chanels
    single = False
    par_filename = 'None'
    resol_filename = 'None'

    input_file = 'test.fits'
    input_models = []
    input_filenames = []
    input_models.append(miri_ifushort_short)
    input_filenames.append(input_file)

    pars = {
        'channel': pars_input['channel'],
        'subchannel': pars_input['subchannel'],
        'grating': pars_input['grating'],
        'filter': pars_input['filter'],
        'weighting': weighting,
        'single': single,
        'output_type':output_type}

    cubeinfo = cube_build.CubeData(
        input_models,
        input_filenames,
        par_filename,
        resol_filename,
        **pars)

    master_table = file_table.FileTable()
    this_instrument = master_table.set_file_table(
        cubeinfo.input_models,cubeinfo.input_filenames)

    assert this_instrument == 'MIRI'

    cubeinfo.instrument  = this_instrument
    cubeinfo.determine_band_coverage(master_table)
    assert cubeinfo.all_channel == ['1','2']
    assert cubeinfo.all_subchannel == ['short','short']

    num_cubes,cube_pars = cubeinfo.number_cubes()
    assert num_cubes == 1
    assert cube_pars['1']['par1'] == ['1','2']
    assert cube_pars['1']['par2'] == ['short','short']