Beispiel #1
0
def test_get_parse_obssum_hdulist():
    hdulist = sunpy.io.read_file(
        get_test_filepath('hsi_obssumm_20110404_042.fits.gz'))
    header, _data = rhessi.parse_observing_summary_hdulist(hdulist)
    assert header.get('DATE_OBS') == '2011-04-04T00:00:00.000'
    assert header.get('DATE_END') == '2011-04-05T00:00:00.000'
    assert header.get('TELESCOP') == 'HESSI'
Beispiel #2
0
    def _parse_hdus(cls, hdulist):
        """
        Parses a RHESSI `astropy.io.fits.HDUList` from a FITS file.

        Parameters
        ----------
        hdulist : `astropy.io.fits.HDUList`
            A HDU list.
        """
        header, d = rhessi.parse_observing_summary_hdulist(hdulist)
        # The time of dict `d` is astropy.time, but dataframe can only take datetime
        d['time'] = d['time'].datetime
        header = MetaDict(OrderedDict(header))
        data = DataFrame(d['data'], columns=d['labels'], index=d['time'])
        # Add the units data
        units = OrderedDict([
            ('3 - 6 keV', u.ct / u.s / u.Unit('detector')),
            ('6 - 12 keV', u.ct / u.s / u.Unit('detector')),
            ('12 - 25 keV', u.ct / u.s / u.Unit('detector')),
            ('25 - 50 keV', u.ct / u.s / u.Unit('detector')),
            ('50 - 100 keV', u.ct / u.s / u.Unit('detector')),
            ('100 - 300 keV', u.ct / u.s / u.Unit('detector')),
            ('300 - 800 keV', u.ct / u.s / u.Unit('detector')),
            ('800 - 7000 keV', u.ct / u.s / u.Unit('detector')),
            ('7000 - 20000 keV', u.ct / u.s / u.Unit('detector'))
        ])
        # Todo: check units used. https://hesperia.gsfc.nasa.gov/ssw/hessi/doc/guides/hessi_data_access.htm
        return data, header, units
Beispiel #3
0
    def _parse_hdus(cls, hdulist):
        """
        Parses a RHESSI `astropy.io.fits.HDUList` from a FITS file.

        Parameters
        ----------
        hdulist : `astropy.io.fits.HDUList`
            A HDU list.
        """
        header, d = rhessi.parse_observing_summary_hdulist(hdulist)
        # The time of dict `d` is astropy.time, but dataframe can only take datetime
        d['time'] = d['time'].datetime
        header = MetaDict(OrderedDict(header))
        data = DataFrame(d['data'], columns=d['labels'], index=d['time'])
        # Add the units data
        units = OrderedDict([('3 - 6 keV', u.ct / u.s / u.Unit('detector')),
                             ('6 - 12 keV', u.ct / u.s / u.Unit('detector')),
                             ('12 - 25 keV', u.ct / u.s / u.Unit('detector')),
                             ('25 - 50 keV', u.ct / u.s / u.Unit('detector')),
                             ('50 - 100 keV', u.ct / u.s / u.Unit('detector')),
                             ('100 - 300 keV', u.ct / u.s / u.Unit('detector')),
                             ('300 - 800 keV', u.ct / u.s / u.Unit('detector')),
                             ('800 - 7000 keV', u.ct / u.s / u.Unit('detector')),
                             ('7000 - 20000 keV', u.ct / u.s / u.Unit('detector'))])
        # Todo: check units used. https://hesperia.gsfc.nasa.gov/ssw/hessi/doc/guides/hessi_data_access.htm
        return data, header, units
Beispiel #4
0
 def _parse_hdus(cls, hdulist):
     """Parses a RHESSI FITS HDU list form a FITS file."""
     header, d = rhessi.parse_observing_summary_hdulist(hdulist)
     header = MetaDict(OrderedDict(header))
     data = DataFrame(d['data'], columns=d['labels'], index=d['time'])
     # Add the units data
     units = OrderedDict([('3 - 6 keV', u.ct / u.s / u.Unit('detector')),
                          ('6 - 12 keV', u.ct / u.s / u.Unit('detector')),
                          ('12 - 25 keV', u.ct / u.s / u.Unit('detector')),
                          ('25 - 50 keV', u.ct / u.s / u.Unit('detector')),
                          ('50 - 100 keV', u.ct / u.s / u.Unit('detector')),
                          ('100 - 300 keV', u.ct / u.s / u.Unit('detector')),
                          ('300 - 800 keV', u.ct / u.s / u.Unit('detector')),
                          ('800 - 7000 keV', u.ct / u.s / u.Unit('detector')),
                          ('7000 - 20000 keV', u.ct / u.s / u.Unit('detector'))])
     # Todo: check units used. https://hesperia.gsfc.nasa.gov/ssw/hessi/doc/guides/hessi_data_access.htm
     return data, header, units
Beispiel #5
0
def test_get_parse_obssum_hdulist():
    hdulist = sunpy.io.read_file(get_test_filepath('hsi_obssumm_20110404_042.fits.gz'))
    header, _data = rhessi.parse_observing_summary_hdulist(hdulist)
    assert header.get('DATE_OBS') == '2011-04-04T00:00:00.000'
    assert header.get('DATE_END') == '2011-04-05T00:00:00.000'
    assert header.get('TELESCOP') == 'HESSI'