コード例 #1
0
def test_source_stretch():
    """
    Tests that the correct stretch function is returned.
    """
    hvjp2 = Map(jp2path)
    aia_fits_stretch = aia.plot_settings['norm'].stretch
    assert source_stretch(aia.meta, aia_fits_stretch) is aia_fits_stretch
    assert isinstance(source_stretch(hvjp2.meta, aia_fits_stretch), LinearStretch)
コード例 #2
0
def test_source_stretch(aia171_test_map, hvjp2):
    """
    Tests that the correct stretch function is returned.
    """
    aia_fits_stretch = aia171_test_map.plot_settings['norm'].stretch
    assert source_stretch(aia171_test_map.meta,
                          aia_fits_stretch) is aia_fits_stretch
    assert isinstance(source_stretch(hvjp2.meta, aia_fits_stretch),
                      LinearStretch)
コード例 #3
0
ファイル: soho.py プロジェクト: Hypnus1803/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        self.meta['CUNIT1'] = self.meta['CUNIT1'].lower()
        self.meta['CUNIT2'] = self.meta['CUNIT2'].lower()

        # Fill in some missing or broken info
        datestr = "{date}T{time}".format(date=self.meta.get('date-obs',
                                                            self.meta.get('date_obs')
                                                            ),
                                         time=self.meta.get('time-obs',
                                                            self.meta.get('time_obs')
                                                            )
                                         )
        self.meta['date-obs'] = datestr

        # If non-standard Keyword is present, correct it too, for compatibility.
        if 'date_obs' in self.meta:
            self.meta['date_obs'] = self.meta['date-obs']
        self.meta['wavelnth'] = np.nan
        self.meta['waveunit'] = 'nm'
        self._nickname = self.instrument + "-" + self.detector
        self.plot_settings['cmap'] = cm.get_cmap('soholasco{det!s}'.format(det=self.detector[1]))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #4
0
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)), clip=False)
コード例 #5
0
ファイル: soho.py プロジェクト: ruchikachavhan/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        self.meta['CUNIT1'] = self.meta.get('CUNIT1', 'arcsec').lower()
        self.meta['CUNIT2'] = self.meta.get('CUNIT2', 'arcsec').lower()

        # Fill in some missing or broken info
        # Test if change has already been applied
        if 'T' not in self.meta['date-obs']:
            datestr = "{date}T{time}".format(date=self.meta.get('date-obs',
                                                                self.meta.get('date_obs')
                                                                ),
                                             time=self.meta.get('time-obs',
                                                                self.meta.get('time_obs')
                                                                )
                                             )
            self.meta['date-obs'] = datestr

        # If non-standard Keyword is present, correct it too, for compatibility.
        if 'date_obs' in self.meta:
            self.meta['date_obs'] = self.meta['date-obs']
        self._nickname = self.instrument + "-" + self.detector
        self.plot_settings['cmap'] = plt.get_cmap('soholasco{det!s}'.format(det=self.detector[1]))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #6
0
ファイル: soho.py プロジェクト: samiali12/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self.plot_settings['cmap'] = 'soholasco{det!s}'.format(
            det=self.detector[1])
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)
コード例 #7
0
ファイル: trace.py プロジェクト: wtbarnes/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        # Colour maps
        self.plot_settings['cmap'] = 'trace' + str(self.meta['WAVE_LEN'])
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, LogStretch()), clip=False)
コード例 #8
0
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self.plot_settings['cmap'] = 'yohkohsxt' + self.measurement[0:2].lower(
        )
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)
コード例 #9
0
ファイル: suvi.py プロジェクト: wtbarnes/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        self.plot_settings["cmap"] = self._get_cmap_name()
        self.plot_settings["norm"] = ImageNormalize(stretch=source_stretch(
            self.meta, AsinhStretch(0.01)),
                                                    clip=False)
コード例 #10
0
ファイル: sdo.py プロジェクト: Cadair/sunpy
    def __init__(self, data, header, **kwargs):
        GenericMap.__init__(self, data, header, **kwargs)

        # Fill in some missing info
        self.meta['detector'] = "AIA"
        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, AsinhStretch(0.01)))
コード例 #11
0
ファイル: sdo.py プロジェクト: yashrsharma44/sunpy
    def __init__(self, data, header, **kwargs):
        GenericMap.__init__(self, data, header, **kwargs)

        # Fill in some missing info
        self.meta['detector'] = "AIA"
        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, AsinhStretch(0.01)))
コード例 #12
0
ファイル: sdo.py プロジェクト: hayesla/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self._nickname = self.detector
        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, AsinhStretch(0.01)), clip=False)
コード例 #13
0
ファイル: stereo.py プロジェクト: wtbarnes/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = "{}-{}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = 'euvi{wl:d}'.format(
            wl=int(self.wavelength.value))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.25)),
                                                    clip=False)
コード例 #14
0
ファイル: stereo.py プロジェクト: wtbarnes/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = "{}-{}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = 'stereocor{det!s}'.format(
            det=self.detector[-1])
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)
コード例 #15
0
ファイル: soho.py プロジェクト: ruchikachavhan/sunpy
    def __init__(self, data, header, **kwargs):
        GenericMap.__init__(self, data, header, **kwargs)

        # Fill in some missing info
        self.meta['detector'] = "EIT"
        self.meta['waveunit'] = "Angstrom"
        self._fix_dsun()
        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #16
0
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)                
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = cm.get_cmap('stereohi{det!s}'.format(det=self.detector[-1]))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)))

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
コード例 #17
0
ファイル: stereo.py プロジェクト: bwgref/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = plt.get_cmap('stereohi{det!s}'.format(det=self.detector[-1]))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)))

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
コード例 #18
0
ファイル: mlso.py プロジェクト: samiali12/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = self.detector

        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.25)), clip=False)
        # Negative value pixels can appear that lead to ugly looking images.
        # This can be fixed by setting the lower limit of the normalization.
        self.plot_settings['norm'].vmin = 0.0
コード例 #19
0
ファイル: soho.py プロジェクト: PritishC/sunpy
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')

        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #20
0
ファイル: suvi.py プロジェクト: xhchen03/sunpy
    def __init__(self, data, header, **kwargs):

        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self.meta["detector"] = "SUVI"
        self.meta["telescop"] = "GOES-R"
        self._nickname = self.detector
        self.plot_settings["cmap"] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings["norm"] = ImageNormalize(
            stretch=source_stretch(self.meta, AsinhStretch(0.01)))
コード例 #21
0
ファイル: soho.py プロジェクト: xhchen03/sunpy
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')

        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #22
0
ファイル: stereo.py プロジェクト: bwgref/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = plt.get_cmap('sohoeit{wl:d}'.format(wl=int(self.wavelength.value)))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)))
        self.meta['waveunit'] = 'Angstrom'

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
コード例 #23
0
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        # It needs to be verified that these must actually be set and are not
        # already in the header.
        self.meta['detector'] = "TRACE"
        self.meta['obsrvtry'] = "TRACE"
        self._nickname = self.detector
        # Colour maps
        self.plot_settings['cmap'] = cm.get_cmap('trace' + str(self.meta['WAVE_LEN']))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, LogStretch()))
コード例 #24
0
ファイル: trace.py プロジェクト: DanRyanIrish/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        # It needs to be verified that these must actually be set and are not
        # already in the header.
        self.meta['detector'] = "TRACE"
        self.meta['obsrvtry'] = "TRACE"
        self._nickname = self.detector
        # Colour maps
        self.plot_settings['cmap'] = plt.get_cmap('trace' + str(self.meta['WAVE_LEN']))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, LogStretch()))
コード例 #25
0
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = cm.get_cmap('sohoeit{wl:d}'.format(wl=int(self.wavelength.value)))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)))
        self.meta['waveunit'] = 'Angstrom'

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
コード例 #26
0
ファイル: soho.py プロジェクト: samriddhi-dev/sunpy
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')
        if 'waveunit' not in header or not header['waveunit']:
            header['waveunit'] = "Angstrom"
        super().__init__(data, header, **kwargs)

        self._nickname = self.detector
        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)
コード例 #27
0
    def __init__(self, data, header, **kwargs):
        if 'bunit' not in header and 'pixlunit' in header:
            # PIXLUNIT is not a FITS standard keyword
            header['bunit'] = header['pixlunit']

        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self.meta['detector'] = self.meta.get('detector', "AIA")
        self._nickname = self.detector
        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, AsinhStretch(0.01)),
                                                    clip=False)
コード例 #28
0
ファイル: stereo.py プロジェクト: jeffreypaul15/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self._nickname = "{}-{}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = 'stereocor{det!s}'.format(
            det=self.detector[-1])
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not ('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
コード例 #29
0
ファイル: soho.py プロジェクト: Cadair/sunpy
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')

        GenericMap.__init__(self, data, header, **kwargs)
        # Fill in some missing info
        self.meta['detector'] = "EIT"
        self.meta['waveunit'] = "Angstrom"

        self._fix_dsun()
        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #30
0
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')

        GenericMap.__init__(self, data, header, **kwargs)
        # Fill in some missing info
        self.meta['detector'] = "EIT"
        self.meta['waveunit'] = "Angstrom"

        self._fix_dsun()
        self._nickname = self.detector
        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #31
0
ファイル: trace.py プロジェクト: samriddhi-dev/sunpy
    def __init__(self, data, header, **kwargs):
        # Assume pixel units are arcesc if not given
        header['cunit1'] = header.get('cunit1', 'arcsec')
        header['cunit2'] = header.get('cunit2', 'arcsec')
        super().__init__(data, header, **kwargs)

        # It needs to be verified that these must actually be set and are not
        # already in the header.
        self.meta['detector'] = "TRACE"
        self.meta['obsrvtry'] = "TRACE"
        self._nickname = self.detector
        # Colour maps
        self.plot_settings['cmap'] = 'trace' + str(self.meta['WAVE_LEN'])
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, LogStretch()),
                                                    clip=False)
コード例 #32
0
ファイル: mlso.py プロジェクト: zimmaz/sunpy
    def __init__(self, data, header, **kwargs):

        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self.meta['observatory'] = 'MLSO'
        self.meta['detector'] = 'KCor'
        self.meta['waveunit'] = 'nanometer'
        # Since KCor is on Earth, no need to raise the warning in mapbase
        self.meta['dsun_obs'] = (sun.earth_distance(self.date)).to(u.m).value
        self.meta['hgln_obs'] = 0.0
        self._nickname = self.detector

        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)), clip=False)
        # Negative value pixels can appear that lead to ugly looking images.
        # This can be fixed by setting the lower limit of the normalization.
        self.plot_settings['norm'].vmin = 0.0
コード例 #33
0
ファイル: mlso.py プロジェクト: Cadair/sunpy
    def __init__(self, data, header, **kwargs):

        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self.meta['observatory'] = 'MLSO'
        self.meta['detector'] = 'KCor'
        self.meta['waveunit'] = 'nanometer'
        # Since KCor is on Earth, no need to raise the warning in mapbase
        self.meta['dsun_obs'] = (get_sunearth_distance(self.date)).to(u.m).value
        self.meta['hgln_obs'] = 0.0
        self._nickname = self.detector

        self.plot_settings['cmap'] = plt.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.25)))
        # Negative value pixels can appear that lead to ugly looking images.
        # This can be fixed by setting the lower limit of the normalization.
        self.plot_settings['norm'].vmin = 0.0
コード例 #34
0
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        # Fill in some missing info
        self.meta['detector'] = self.meta.get('detector', "AIA")
        if 'bunit' not in self.meta and 'pixlunit' in self.meta:
            # PIXLUNIT is not a FITS standard keyword
            self.meta['bunit'] = self.meta['pixlunit']
        self._nickname = self.detector
        self.plot_settings['cmap'] = self._get_cmap_name()
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, AsinhStretch(0.01)),
                                                    clip=False)
        # DN is not a FITS standard unit, so convert to counts
        if self.meta.get('bunit', None) == 'DN':
            self.meta['bunit'] = 'ct'
        if self.meta.get('bunit', None) == 'DN/s':
            self.meta['bunit'] = 'ct/s'
コード例 #35
0
ファイル: yohkoh.py プロジェクト: samriddhi-dev/sunpy
    def __init__(self, data, header, **kwargs):
        super().__init__(data, header, **kwargs)

        self.meta['detector'] = "SXT"
        self.meta['telescop'] = "Yohkoh"
        self.plot_settings['cmap'] = 'yohkohsxt' + self.measurement[0:2].lower()
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)), clip=False)

        # 2012/12/19 - the SXT headers do not have a value of the distance from
        # the spacecraft to the center of the Sun.  The FITS keyword 'DSUN_OBS'
        # appears to refer to the observed diameter of the Sun.  Until such
        # time as that is calculated and properly included in the file, we will
        # use simple trigonometry to calculate the distance of the center of
        # the Sun from the spacecraft.  Note that the small angle approximation
        # is used, and the solar radius stored in SXT FITS files is in arcseconds.
        self.meta['dsun_apparent'] = self.meta.get('dsun_apparent', constants.au)
        if 'solar_r' in self.meta:
            self.meta['dsun_apparent'] = constants.radius/(np.deg2rad(self.meta['solar_r']/3600.0))
コード例 #36
0
ファイル: yohkoh.py プロジェクト: bwgref/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        self.meta['detector'] = "SXT"
        self.meta['telescop'] = "Yohkoh"
        self.plot_settings['cmap'] = plt.get_cmap(name='yohkohsxt' + self.measurement[0:2].lower())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, PowerStretch(0.5)))

        # 2012/12/19 - the SXT headers do not have a value of the distance from
        # the spacecraft to the center of the Sun.  The FITS keyword 'DSUN_OBS'
        # appears to refer to the observed diameter of the Sun.  Until such
        # time as that is calculated and properly included in the file, we will
        # use simple trigonometry to calculate the distance of the center of
        # the Sun from the spacecraft.  Note that the small angle approximation
        # is used, and the solar radius stored in SXT FITS files is in arcseconds.
        self.meta['dsun_apparent'] = constants.au
        if 'solar_r' in self.meta:
            self.meta['dsun_apparent'] = constants.radius/(np.deg2rad(self.meta['solar_r']/3600.0))
コード例 #37
0
ファイル: stereo.py プロジェクト: tanvimoharir/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)
        self._nickname = "{}-{}".format(self.detector, self.observatory[-1])
        self.plot_settings['cmap'] = 'sohoeit{wl:d}'.format(
            wl=int(self.wavelength.value))
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.25)),
                                                    clip=False)
        self.meta['waveunit'] = 'Angstrom'

        # Try to identify when the FITS meta data does not have the correct
        # date FITS keyword
        if ('date_obs' in self.meta) and not ('date-obs' in self.meta):
            self.meta['date-obs'] = self.meta['date_obs']
        # fix CROTA to CROTAn
        if "crota" in self.meta and "crota2" not in self.meta:
            log.debug("EUVIMap: Changing the CROTA keyword to CROTA2")
            self.meta["crota2"] = self.meta.pop("crota")
コード例 #38
0
ファイル: soho.py プロジェクト: lamby/sunpy
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)

        self.meta['CUNIT1'] = self.meta['CUNIT1'].lower()
        self.meta['CUNIT2'] = self.meta['CUNIT2'].lower()

        # Fill in some missing or broken info
        datestr = "{date}T{time}".format(
            date=self.meta.get('date-obs', self.meta.get('date_obs')),
            time=self.meta.get('time-obs', self.meta.get('time_obs')))
        self.meta['date-obs'] = datestr

        # If non-standard Keyword is present, correct it too, for compatibility.
        if 'date_obs' in self.meta:
            self.meta['date_obs'] = self.meta['date-obs']
        self.meta['wavelnth'] = np.nan
        self.meta['waveunit'] = 'nm'
        self._nickname = self.instrument + "-" + self.detector
        self.plot_settings['cmap'] = cm.get_cmap(
            'soholasco{det!s}'.format(det=self.detector[1]))
        self.plot_settings['norm'] = ImageNormalize(
            stretch=source_stretch(self.meta, PowerStretch(0.5)))
コード例 #39
0
ファイル: soho.py プロジェクト: samriddhi-dev/sunpy
    def __init__(self, data, header, **kwargs):

        header['cunit1'] = header['cunit1'].lower()
        header['cunit2'] = header['cunit2'].lower()

        super().__init__(data, header, **kwargs)

        # Fill in some missing or broken info
        # Test if change has already been applied
        if 'T' not in self.meta['date-obs']:
            datestr = "{date}T{time}".format(
                date=self.meta.get('date-obs', self.meta.get('date_obs')),
                time=self.meta.get('time-obs', self.meta.get('time_obs')))
            self.meta['date-obs'] = parse_time(datestr).isot

        # If non-standard Keyword is present, correct it too, for compatibility.
        if 'date_obs' in self.meta:
            self.meta['date_obs'] = self.meta['date-obs']
        self._nickname = self.instrument + "-" + self.detector
        self.plot_settings['cmap'] = 'soholasco{det!s}'.format(
            det=self.detector[1])
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(
            self.meta, PowerStretch(0.5)),
                                                    clip=False)

        # For Helioviewer images, clear rotation metadata, as these have already been rotated.
        # Also check that all CROTAn keywords exist to make sure that it's an untouched
        # Helioviewer file.
        if ('helioviewer' in self.meta and 'crota' in self.meta
                and 'crota1' in self.meta and 'crota2' in self.meta):
            log.debug(
                "LASCOMap: Cleaning up CROTAn keywords "
                "because the map has already been rotated by Helioviewer")
            self.meta.pop('crota')
            self.meta.pop('crota1')
            self.meta['crota2'] = 0