コード例 #1
0
ファイル: test_processors.py プロジェクト: nicHoch/STIXCore
def test_level1_processor_generate_primary_header(config, product):
    config.get.side_effect = [td.soop.DIR, '.']
    processor = FitsL1Processor('some/path')
    beg = SCETime(coarse=683769519, fine=0)
    end = SCETime(coarse=beg.coarse + 24 * 60 * 60)
    beg + (end - beg) / 2
    product.scet_timerange = SCETimeRange(start=beg, end=end)
    product.utc_timerange = product.scet_timerange.to_timerange()
    product.raw = ['packet1.xml', 'packet2.xml']
    product.parent = ['l01.fits', 'l02.fts']
    product.level = 'L1'
    product.type = "ql"
    product.service_type = 1
    product.service_subtype = 2
    product.ssid = 3

    test_data = {
        'FILENAME': 'a_filename.fits',
        'OBT_BEG': beg.as_float().value,
        'OBT_END': end.as_float().value,
        'DATE_OBS': product.utc_timerange.start.fits,
        'DATE_BEG': product.utc_timerange.start.fits,
        'DATE_AVG': product.utc_timerange.center.fits,
        'DATE_END': product.utc_timerange.end.fits,
        'STYPE': product.service_type,
        'SSTYPE': product.service_subtype,
        'SSID': product.ssid,
        'TIMESYS': 'UTC',
        'LEVEL': 'L1',
        'OBS_ID': 'SSTX_040A_000_000_5Md2_112;SSTX_040A_000_000_vFLg_11Y',
        'OBS_TYPE': '5Md2;vFLg',
        'OBS_MODE': 'STIX_ANALYSIS;STIX_BASIC',
        'SOOPNAME': '',
        'SOOPTYPE': '',
        'TARGET': '',
        'RSUN_ARC': 1589.33,
        'HGLT_OBS': -0.32,
        'HGLN_OBS': -66.52,
        'RAW_FILE': 'packet1.xml;packet2.xml',
        'PARENT': 'l01.fits;l02.fts'
    }

    header = processor.generate_primary_header('a_filename.fits', product)
    for name, value, *comment in header:
        if name in test_data.keys():
            if isinstance(value, float):
                assert np.allclose(test_data[name], value)
            else:
                assert value == test_data[name]
コード例 #2
0
ファイル: test_processors.py プロジェクト: nicHoch/STIXCore
def test_levelb_processor_generate_primary_header(datetime, product):
    processor = FitsLBProcessor('some/path')
    datetime.now().isoformat.return_value = '1234-05-07T01:02:03.346'
    beg = SCETime(coarse=0, fine=0)
    end = SCETime(coarse=1, fine=2**15)
    product.control = {
        "scet_coarse": [beg.coarse, end.coarse],
        "scet_fine": [beg.fine, end.fine]
    }
    product.raw = ['packet1.xml', 'packet2.xml']
    product.parent = ['packet1.xml', 'packet2.xml']
    product.level = 'LB'
    product.service_type = 1
    product.service_subtype = 2
    product.ssid = 3
    product.obt_beg = beg
    product.obt_end = end
    product.date_obs = beg
    product.date_beg = beg
    product.date_end = end

    test_data = {
        'FILENAME': 'a_filename.fits',
        'DATE': '1234-05-07T01:02:03.346',
        'OBT_BEG': beg.to_string(),
        'OBT_END': end.to_string(),
        'DATE_OBS': beg.to_string(),
        'DATE_BEG': beg.to_string(),
        'DATE_END': end.to_string(),
        'STYPE': product.service_type,
        'SSTYPE': product.service_subtype,
        'SSID': product.ssid,
        'TIMESYS': "OBT",
        'LEVEL': 'LB',
        'RAW_FILE': 'packet1.xml;packet2.xml',
        'PARENT': 'packet1.xml;packet2.xml'
    }

    header = processor.generate_primary_header('a_filename.fits', product)
    for name, value, *comment in header:
        if name in test_data.keys():
            assert value == test_data[name]
コード例 #3
0
ファイル: test_processors.py プロジェクト: nicHoch/STIXCore
def test_level0_processor_generate_primary_header(datetime, product):
    processor = FitsL0Processor('some/path')
    datetime.now().isoformat.return_value = '1234-05-07T01:02:03.346'
    product.obs_beg = SCETime(coarse=0, fine=0)
    product.obs_avg = SCETime(coarse=0, fine=2**15)
    product.obs_end = SCETime(coarse=1, fine=2**15)
    product.scet_timerange = SCETimeRange(start=product.obs_beg,
                                          end=product.obs_end)
    product.raw = ['packet1.xml', 'packet2.xml']
    product.parent = ['lb1.fits', 'lb2.fts']
    product.service_type = 1
    product.service_subtype = 2
    product.ssid = 3
    product.level = 'L0'

    test_data = {
        'FILENAME': 'a_filename.fits',
        'DATE': '1234-05-07T01:02:03.346',
        'OBT_BEG': 0.0,
        'OBT_END': 1.5000076295109483,
        'DATE_OBS': '0000000000:00000',
        'DATE_BEG': '0000000000:00000',
        'DATE_AVG': '0000000000:49152',
        'DATE_END': '0000000001:32768',
        'STYPE': 1,
        'SSTYPE': 2,
        'SSID': 3,
        'TIMESYS': "OBT",
        'LEVEL': 'L0',
        'RAW_FILE': 'packet1.xml;packet2.xml',
        'PARENT': 'lb1.fits;lb2.fts'
    }

    header = processor.generate_primary_header('a_filename.fits', product)
    for name, value, *comment in header:
        if name in test_data.keys():
            assert value == test_data[name]