Beispiel #1
0
                                       pre_delivery_dir,
                                       'NIRCam_SIAF_outdated.xml'))
        else:
            # compare new SIAF with PRD version
            ref_siaf = pysiaf.Siaf(instrument)

        tags = {'reference': compare_to, 'comparison': 'new pre-delivery'}

        compare.compare_siaf(pre_delivery_siaf,
                             reference_siaf_input=ref_siaf,
                             fractional_tolerance=1e-6,
                             report_dir=pre_delivery_dir,
                             tags=tags)

        compare.compare_transformation_roundtrip(pre_delivery_siaf,
                                                 reference_siaf_input=ref_siaf,
                                                 tags=tags,
                                                 report_dir=pre_delivery_dir)

        compare.compare_inspection_figures(pre_delivery_siaf,
                                           reference_siaf_input=ref_siaf,
                                           report_dir=pre_delivery_dir,
                                           tags=tags,
                                           mark_ref=True)

        create_jira_plots = False
        if create_jira_plots:
            # make figures for JWSTSIAF-129 Jira ticket
            # selected_aperture_names = [['NRCA1_GRISMTS', 'NRCA5_GRISM_F444W'],
            #                            ['NRCA1_GRISMTS64', 'NRCA5_GRISM64_F444W'],
            #                            ['NRCA1_GRISMTS128', 'NRCA5_GRISM128_F444W'],
            #                            ['NRCA1_GRISMTS256', 'NRCA5_GRISM256_F444W'],
    comparison_aperture_names = [
        AperName for AperName in aperture_name_list if 'MIMF' in AperName
    ]
    # comparison_aperture_names = [AperName for AperName, aperture in aperture_dict.items() if aperture.AperType == 'SLIT']
    # comparison_aperture_names = [AperName for AperName, aperture in aperture_dict.items() if aperture.AperType in ['FULLSCA', 'OSS']]
    # comparison_aperture_names = pcf_file_mapping.keys()

    # comparison_aperture_names = ['NRS_SKY_OTEIP']
    # comparison_aperture_names = ['NRS_SKY_OTEIP']
    comparison_aperture_names = [
        'NRS1_FULL', 'NRS2_FULL', 'NRS1_FULL_OSS', 'NRS2_FULL_OSS'
    ]
    # compare.compare_siaf(new_siaf, reference_siaf_input=ref_siaf, fractional_tolerance=1e-6, selected_aperture_name=['NRS1_FULL', 'NRS2_FULL', 'NRS1_FULL_OSS', 'NRS2_FULL_OSS'])
    # compare.compare_siaf(new_siaf, reference_siaf_input=ref_siaf, fractional_tolerance=1e-6, selected_aperture_name=['NRS_SKY_OTEIP'])
    # compare.compare_siaf(new_siaf, reference_siaf_input=ref_siaf, fractional_tolerance=1e-6, selected_aperture_name=comparison_aperture_names, report_dir=report_dir)
    compare.compare_siaf(new_siaf,
                         reference_siaf_input=ref_siaf,
                         fractional_tolerance=1e-6)
    # tools.compare_siaf_xml(ref_siaf, new_siaf)

selected_aperture_name = [
    AperName for AperName in aperture_name_list
    if ('GWA' not in AperName) and ('MSA' not in AperName) and (
        'SKY' not in AperName)
]
# run roundtrip test on all apertures
compare.compare_transformation_roundtrip(
    new_siaf,
    reference_siaf_input=ref_siaf,
    selected_aperture_name=selected_aperture_name)
Beispiel #3
0
#sort SIAF entries in the order of the aperture definition file
aperture_dict = OrderedDict(sorted(aperture_dict.items(), key=lambda t: aperture_name_list.index(t[0])))

#third pass to set DDCNames apertures, which depend on other apertures
ddc_siaf_aperture_names = np.array([key for key in _ddc_apername_mapping.keys()])
ddc_v2 = np.array([aperture_dict[aperture_name].V2Ref for aperture_name in ddc_siaf_aperture_names])
ddc_v3 = np.array([aperture_dict[aperture_name].V3Ref for aperture_name in ddc_siaf_aperture_names])
for AperName in aperture_name_list:
    separation_tel_from_ddc_aperture = np.sqrt((aperture_dict[AperName].V2Ref - ddc_v2)**2 + (aperture_dict[AperName].V3Ref - ddc_v3)**2)
    aperture_dict[AperName].DDCName = _ddc_apername_mapping[ddc_siaf_aperture_names[np.argmin(separation_tel_from_ddc_aperture)]]

aperture_collection = pysiaf.ApertureCollection(aperture_dict)

# write the SIAFXML to disk
[filename] = pysiaf.iando.write.write_jwst_siaf(aperture_collection, basepath=test_dir, file_format=['xml'])
print('SIAFXML written in {}'.format(filename))

# compare to SIAFXML produced the old way
# ref_siaf = pysiaf.Siaf(instrument, os.path.join(test_dir , '{}'.format('NIRISS_SIAF_2017-10-18.xml')))
ref_siaf = pysiaf.Siaf(instrument)
new_siaf = pysiaf.Siaf(instrument, filename)

# compare.compare_siaf(new_siaf, reference_siaf_input=ref_siaf, fractional_tolerance=1e-6, selected_aperture_name=['NIS_CEN', 'NIS_CEN_OSS'])
compare.compare_siaf(new_siaf, reference_siaf_input=ref_siaf, fractional_tolerance=1e-6)
# tools.compare_siaf_xml(ref_siaf, new_siaf)

compare.compare_transformation_roundtrip(new_siaf, reference_siaf_input=ref_siaf)


Beispiel #4
0
                                           skipped_aperture_type=['TRANSFORM'],
                                           selected_aperture_name=[
                                               'NRS1_FP1MIMF', 'NRS1_FP2MIMF',
                                               'NRS1_FP3MIMF', 'NRS2_FP4MIMF',
                                               'NRS2_FP5MIMF'
                                           ],
                                           mark_ref=True,
                                           xlimits=(100, 700),
                                           ylimits=(-700, -100),
                                           filename_appendix='MIMF_apertures')

        compare.compare_transformation_roundtrip(
            pre_delivery_siaf,
            reference_siaf_input=ref_siaf,
            tags=tags,
            report_dir=pre_delivery_dir,
            skipped_aperture_type=['TRANSFORM', 'SLIT'],
            selected_aperture_name=[
                'NRS1_FULL', 'NRS2_FULL', 'NRS1_FULL_OSS', 'NRS2_FULL_OSS'
            ])

        compare.compare_inspection_figures(pre_delivery_siaf,
                                           reference_siaf_input=ref_siaf,
                                           report_dir=pre_delivery_dir,
                                           tags=tags,
                                           skipped_aperture_type=['TRANSFORM'])

    # run some tests on the new SIAF
    from pysiaf.tests import test_nirspec

    print(