Пример #1
0
def test_niriss_imaging():
    nis = imaging_simulator.ImgSim(offline=True)
    nis.paramfile = os.path.join(os.path.dirname(__file__),
                                 'test_data/NIRISS/niriss_imaging_test.yaml')
    nis.create()
    nis.paramfile = os.path.join(os.path.dirname(__file__),
                                 'test_data/NIRISS/niriss_nrm_test.yaml')
    nis.create()
    value1 = numpy.loadtxt(
        'V88888024002P000000000112o_NIS_F480M_uncal_pointsources.list',
        usecols=[
            8,
        ])
    value2 = numpy.loadtxt(
        'V88888024002P000000000112o_NIS_NRM_F480M_uncal_pointsources.list',
        usecols=[
            8,
        ])
    fluxratio = value2 / value1

    # The 0.15 factor for the NRM and the 0.84 factor from the CLEARP element
    # are now baked into the PSF from WebbPSF.
    #targetratio = 0.15 / 0.84
    targetratio = 1.0
    deviation = abs(fluxratio / targetratio - 1.)
    assert deviation < 1.e-06
    # clean up the output files in the test directory from this test.
    os.system('/bin/rm V88888024002P000000000112o*')
Пример #2
0
def run_simulator(filename):
    img_sim_custom_yamls = imaging_simulator.ImgSim()
    img_sim_custom_yamls.paramfile = filename
    img_sim_custom_yamls.create()
    print('')
    print("Done creating file from {}".format(filename))
    print('')
Пример #3
0
def test_niriss_imaging():
    nis = imaging_simulator.ImgSim()
    nis.paramfile = os.path.join(os.path.dirname(__file__), 'test_data/NIRISS/niriss_imaging_test.yaml')
    nis.create()
    nis.paramfile = os.path.join(os.path.dirname(__file__), 'test_data/NIRISS/niriss_nrm_test.yaml')
    nis.create()
    value1 = numpy.loadtxt('V88888024002P000000000112o_NIS_F480M_uncal_pointsources.list',usecols=[8,])
    value2 = numpy.loadtxt('V88888024002P000000000112o_NIS_NRM_F480M_uncal_pointsources.list',usecols=[8,])
    fluxratio = value2 / value1
    targetratio = 0.15 / 0.84
    deviation = abs(fluxratio/targetratio - 1.)
    assert deviation < 1.e-06
    # clean up the output files in the test directory from this test.
    os.system('/bin/rm V88888024002P000000000112o*')
Пример #4
0
                              pointing_file=pointing_name,
                              catalogs=catalogues,
                              roll_angle=pav3,
                              dates=dates,
                              reffile_defaults=reffile_defaults,
                              verbose=True,
                              output_dir=output_directory,
                              simdata_output_dir=simdata_output_directory,
                              datatype=datatype)

yam.create_inputs()

# Create all files
yaml_files = glob.glob(os.path.join(output_directory, 'jw*.yaml'))
print(yaml_files)

for file in yaml_files:

    # set astrometric reference file to None to use pysiaf
    with open(file, 'r') as infile:
        yaml_content = yaml.safe_load(infile)
    yaml_content['Reffiles']['astrometric'] = 'None'
    yaml_content['psf_wing_threshold_file'] = 'config'
    modified_file = file.replace('.yaml', '_mod.yaml')
    with io.open(modified_file, 'w') as outfile:
        yaml.dump(yaml_content, outfile, default_flow_style=False)

    t1 = imaging_simulator.ImgSim()
    t1.paramfile = str(modified_file)
    t1.create()
Пример #5
0
def test_fgs_imaging():
    m = im.ImgSim(offline=True)
    m.paramfile = os.path.join(os.path.dirname(__file__),
                               'test_data/FGS/fgs_imaging_example.yaml')
    m.create()
Пример #6
0
def test_nircam_imaging():
    m = im.ImgSim()
    m.paramfile = os.path.join(os.path.dirname(__file__),
                               'test_data/NIRCam/nircam_imaging_example.yaml')
    m.create()