Exemplo n.º 1
0
 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     self.detector = "SWAP"
     self.instrument = "SWAP"
     self.observatory = "PROBA2"
     self.name = "SWAP %s" % header.get('wavelnth')
     self.cmap = cm.get_cmap(name='sdoaia171')
Exemplo n.º 2
0
    def get_properties(cls, header):
        """Parses SXT image header"""
        properties = Map.get_properties(header)
        
        # 2012/11/07 - 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 the value of 1 AU as a standard.
        properties['dsun']= constants.au
        
        wavelnth = header.get('wavelnth')
        if wavelnth == 'Al.1':
            wavelnth = 'Al01'
        if wavelnth.lower() == 'open':
            wavelnth = 'white light'

        properties.update({
            "detector": "SXT",
            "instrument": "SXT",
            "observatory": "Yohkoh",
            "name": "SXT %s" % wavelnth,
            "nickname": "SXT",
            "cmap": cm.get_cmap(name='yohkohsxt' + wavelnth[0:2].lower())
        })
        return properties 
Exemplo n.º 3
0
    def get_properties(cls, header):
        """Parses RHESSI image header"""
        properties = Map.get_properties(header)

        properties.update({
            "date":
            parse_time(header.get('date_obs')),
            "detector":
            header.get('telescop'),
            "instrument":
            header.get('telescop'),
            "measurement": [header.get('energy_l'),
                            header.get('energy_h')],
            "observatory":
            "SDO",
            "name":
            "RHESSI %d - %d keV" %
            (header.get('energy_l'), header.get('energy_h')),
            "cmap":
            cm.get_cmap('rhessi'),
            "exposure_time": (parse_time(header.get('date_end')) -
                              parse_time(header.get('date_obs'))).seconds,
            "coordinate_system": {
                'x': 'HPLN-TAN',
                'y': 'HPLT-TAN'
            }
        })
        return properties
Exemplo n.º 4
0
    def get_properties(cls, header):
        """Parses EIT image header"""
        properties = Map.get_properties(header)

        # Solar radius in arc-seconds at 1 au
        # @TODO: use sunpy.sun instead
        radius_1au = 959.644

        scale = header.get("cdelt1")

        properties.update({
            "date":
            parse_time(header.get('date_obs')),
            "detector":
            "EIT",
            "dsun": ((radius_1au / (properties['rsun_arcseconds'] * scale)) *
                     constants.au),
            "name":
            "EIT %s" % header.get('wavelnth'),
            "nickname":
            "EIT",
            "cmap":
            cm.get_cmap('sohoeit%d' % header.get('wavelnth'))
        })
        return properties
Exemplo n.º 5
0
    def get_properties(cls, header):
        """Parses XRT image header"""
        properties = Map.get_properties(header)
        # XRT uses DATE_OBS, not date-obs.
        properties["date"] = parse_time(header.get('date_obs', None))

        #TODO: proper exception handling here - report to the user that there is
        # an unexpected value
        fw1 = header.get('EC_FW1_')
        if not(fw1.lower() in [x.lower() for x in cls.filter_wheel1_measurements]):
            pass
        fw2 = header.get('EC_FW2_')
        if not(fw2.lower() in [x.lower() for x in cls.filter_wheel2_measurements]):
            pass

        # All images get the same color table - IDL Red temperature (loadct, 3)
        properties.update({
            "detector": "XRT",
            "instrument": "XRT",
            "observatory": "Hinode",
            "name": "XRT %s-%s " % (fw1.replace('_', ' '),
                                       fw2.replace('_', ' ')),
            "nickname": "XRT",
            "cmap": cm.get_cmap(name='hinodexrt')
        })
        return properties
Exemplo n.º 6
0
    def get_properties(cls, header):
        """Parses SXT image header"""
        properties = Map.get_properties(header)

        # 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.
        properties["dsun"] = constants.au
        yohkoh_solar_r = header.get("solar_r", None)
        if yohkoh_solar_r == None:
            properties["dsun"] = constants.au
        else:
            properties["dsun"] = constants.radius / (np.deg2rad(yohkoh_solar_r / 3600.0))

        wavelnth = header.get("wavelnth")
        if wavelnth == "Al.1":
            wavelnth = "Al01"
        if wavelnth.lower() == "open":
            wavelnth = "white light"

        properties.update(
            {
                "detector": "SXT",
                "instrument": "SXT",
                "observatory": "Yohkoh",
                "name": "SXT %s" % wavelnth,
                "nickname": "SXT",
                "cmap": cm.get_cmap(name="yohkohsxt" + wavelnth[0:2].lower()),
            }
        )
        return properties
Exemplo n.º 7
0
    def get_properties(cls, header):
        """Parses COR image header"""
        properties = Map.get_properties(header)

        # @TODO: Deal with invalid values for exptime. E.g. STEREO-B COR2
        # on 2012/03/20 has -1 for some images.
        properties.update({
            "date":
            parse_time(header.get('date-obs', header.get('date_obs'))),
            "detector":
            header.get('detector'),
            "instrument":
            "SECCHI",
            "observatory":
            header.get('obsrvtry'),
            "measurement":
            "white-light",
            "name":
            "SECCHI %s" % header.get('detector'),
            "nickname":
            "%s-%s" % (header.get('detector'), header.get('obsrvtry')[-1]),
            "cmap":
            cm.get_cmap('stereocor%s' % properties['detector'][-1])
        })
        return properties
Exemplo n.º 8
0
    def get_properties(cls, header):
        """Parses XRT image header"""
        properties = Map.get_properties(header)
        # XRT uses DATE_OBS, not date-obs.
        properties["date"] = parse_time(header.get('date_obs', None))

        #TODO: proper exception handling here - report to the user that there is
        # an unexpected value
        fw1 = header.get('EC_FW1_')
        if not(fw1.lower() in [x.lower() for x in cls.filter_wheel1_measurements]):
            pass
        fw2 = header.get('EC_FW2_')
        if not(fw2.lower() in [x.lower() for x in cls.filter_wheel2_measurements]):
            pass

        # All images get the same color table - IDL Red temperature (loadct, 3)
        properties.update({
            "detector": "XRT",
            "instrument": "XRT",
            "observatory": "Hinode",
            "name": "XRT %s-%s " % (fw1.replace('_', ' '),
                                       fw2.replace('_', ' ')),
            "nickname": "XRT",
            "cmap": cm.get_cmap(name='hinodexrt')
        })
        return properties
Exemplo n.º 9
0
    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=PowerStretch(0.5))
Exemplo n.º 10
0
    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=PowerStretch(0.5))
Exemplo n.º 11
0
 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     
     self.detector = "AIA"
     self.instrument = "AIA"
     self.observatory = "SDO"
     self.cmap = cm.get_cmap('sdoaia%d' % header.get('wavelnth'))
Exemplo n.º 12
0
 def plot_conts(self, dmax=0.0, dmin=0.0, updateonly=False):
     levels = [dmin, dmax]
     naxis = self.plot_settings['slicers_axisinfo']['NAXIS'][
         self.plot_settings['dim_idx']]
     cmap = cm.get_cmap(self.plot_settings['cmap'])
     if updateonly:
         for s in range(naxis):
             self.im[s].set_cmap(
                 colors.ListedColormap([cmap(float(s + 1) / naxis)] *
                                       len(levels)))
     else:
         self.im = []
         mapx, mapy = utils.map2wcsgrids(self.spmap)
         for s in range(naxis):
             self.im.append(
                 self.axes.contourf(mapx,
                                    mapy,
                                    self.img_data[s, ...],
                                    levels=levels,
                                    colors=[cmap(float(s + 1) / naxis)] *
                                    len(levels),
                                    alpha=0.25,
                                    antialiased=True))
             for cnt in self.im[-1].collections:
                 # This is the fix for the white lines between contour levels
                 cnt.set_edgecolor("face")
                 cnt.set_linewidth(0.000000000000000)  # ax.set_title(' ')
         self.img_slicer.slicers_widgets[
             self.plot_settings['dim_idx']].setDisabled(True)
         self.axes.set_xlim(self.spmap.xrange.to(u.arcsec).value)
         self.axes.set_ylim(self.spmap.yrange.to(u.arcsec).value)
     try:
         # allways try to remove color bar first to avoid overplots when new Fits file is added
         self.axes.figure.delaxes(self.ax_cb)
     except:
         pass
     vmin = self.plot_settings['slicers_axisinfo']['CRVAL'][
         self.plot_settings['dim_idx']]
     vmax = vmin + naxis * self.plot_settings['slicers_axisinfo']['CDELT'][
         self.plot_settings['dim_idx']]
     if self.image_control.control_colorBar_check.isChecked():
         self.plot_colorbar(
             custom_cb={
                 'cmap': cm.get_cmap(self.plot_settings['cmap']),
                 'vmax': vmax,
                 'vmin': vmin
             })
Exemplo n.º 13
0
 def __init__(self, data, header, **kwargs):
     
     GenericMap.__init__(self, data, header, **kwargs)
     
     self._name = self.observatory + " " + self.detector + " " + str(self.measurement)
     self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])
     
     self.cmap = cm.get_cmap('stereocor%s' % self.detector[-1])
Exemplo n.º 14
0
 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     self.date = parse_time(header.get('date_obs'))
     self.detector = "EUVI"
     self.instrument = "SECCHI"
     self.observatory = header.get('obsrvtry')
     self.name = "EUVI %s" % self.meas
     self.cmap = cm.get_cmap('sohoeit%d' % header.get('wavelnth'))
Exemplo n.º 15
0
def pltEovsaQlookImage(timobj, spws, vmaxs, vmins, dpis_dict, fig=None, ax=None, overwrite=False, verbose=False):
    plt.ioff()
    dateobj = timobj.to_datetime()
    datestrdir = dateobj.strftime("%Y/%m/%d/")
    imgindir = imgfitsdir + datestrdir

    # if not os.path.exists(imgindir):
    #     os.makedirs(imgindir)
    cmap = cm_smap.get_cmap('sdoaia304')

    if fig is None or ax is None:
        mkfig = True
    else:
        mkfig = False

    if mkfig:
        fig, ax = plt.subplots(figsize=(8, 8))
        fig.subplots_adjust(bottom=0.0, top=1.0, left=0.0, right=1.0)

    if verbose: print('Processing EOVSA images for date {}'.format(dateobj.strftime('%Y-%m-%d')))
    for s, sp in enumerate(spws):
        fexists = []
        for l, dpi in dpis_dict.items():
            figname = os.path.join(movieoutdir, '{}_eovsa_bd{:02d}.jpg'.format(l, s + 1))
            fexists.append(os.path.exists(figname))

        if overwrite or (False in fexists):
            ax.cla()
            spwstr = '-'.join(['{:02d}'.format(int(sp_)) for sp_ in sp.split('~')])
            eofile = imgindir + 'eovsa_{}.spw{}.tb.disk.fits'.format(dateobj.strftime('%Y%m%d'), spwstr)
            if not os.path.exists(eofile): continue
            if not os.path.exists(movieoutdir): os.makedirs(movieoutdir)
            eomap = smap.Map(eofile)
            norm = colors.Normalize(vmin=vmins[s], vmax=vmaxs[s])
            eomap_ = pmX.Sunmap(eomap)
            eomap_.imshow(axes=ax, cmap=cmap, norm=norm)
            eomap_.draw_limb(axes=ax, lw=0.5, alpha=0.5)
            eomap_.draw_grid(axes=ax, grid_spacing=10. * u.deg, lw=0.5)
            ax.set_xlabel('')
            ax.set_ylabel('')
            ax.set_xticklabels([])
            ax.set_yticklabels([])
            ax.text(0.02, 0.02,
                    'EOVSA {:.1f} GHz  {}'.format(eomap.meta['CRVAL3'] / 1e9, eomap.date.strftime('%d-%b-%Y 20:00 UT')),
                    transform=ax.transAxes, color='w', ha='left', va='bottom', fontsize=9)
            ax.text(0.98, 0.02, 'Max Tb {:.0f} K'.format(np.nanmax(eomap.data)),
                    transform=ax.transAxes, color='w', ha='right', va='bottom', fontsize=9)
            ax.set_xlim(-1227, 1227)
            ax.set_ylim(-1227, 1227)

            for l, dpi in dpis_dict.items():
                figname = os.path.join(movieoutdir, '{}_eovsa_bd{:02d}.jpg'.format(l, s + 1))
                fig.savefig(figname, dpi=np.int(dpi), quality=85)
    if mkfig:
        pass
    else:
        plt.close(fig)
    return
Exemplo n.º 16
0
    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'] = cm.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=source_stretch(self.meta, AsinhStretch(0.01)))
Exemplo n.º 17
0
    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'] = cm.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(
            stretch=visualization.AsinhStretch(0.01))
Exemplo n.º 18
0
    def __init__(self, data, header, **kwargs):
        
        GenericMap.__init__(self, data, header, **kwargs)
        
        # Fill in some missing info
        self.meta['detector'] = "AIA"
#        self.meta['instrme'] = "AIA"
        
        self._nickname = self.detector
        
        self.cmap = cm.get_cmap('sdoaia%d' % self.wavelength)
Exemplo n.º 19
0
    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'] = cm.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=PowerStretch(0.5))
Exemplo n.º 20
0
    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'] = cm.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=PowerStretch(0.5))
Exemplo n.º 21
0
def pltEmptyImage(datestr, spws, vmaxs, vmins, dpis_dict={'t': 32.0}):
    plt.ioff()
    dateobj = datetime.strptime(datestr, "%Y-%m-%d")
    datastrdir = dateobj.strftime("%Y/%m/%d/")
    imgindir = imgfitsdir + datastrdir
    imgoutdir = './nodata/'

    cmap = cm.get_cmap('sdoaia304')

    fig, ax = plt.subplots(figsize=(8, 8))
    fig.subplots_adjust(bottom=0.0, top=1.0, left=0.0, right=1.0)

    rect = patches.Rectangle((-1227, -300),
                             1227 * 2,
                             300 * 2,
                             linewidth=0,
                             edgecolor='none',
                             facecolor='k',
                             alpha=0.5)

    for s, sp in enumerate(spws):
        ax.cla()
        spwstr = '-'.join(['{:02d}'.format(int(sp_)) for sp_ in sp.split('~')])
        eofile = imgindir + 'eovsa_{}.spw{}.tb.disk.fits'.format(
            dateobj.strftime('%Y%m%d'), spwstr)
        if not os.path.exists(eofile): continue
        if not os.path.exists(imgoutdir): os.makedirs(imgoutdir)
        eomap = smap.Map(eofile)
        norm = colors.Normalize(vmin=vmins[s], vmax=vmaxs[s])
        eomap_ = pmX.Sunmap(eomap)
        eomap_.imshow(axes=ax, cmap=cmap, norm=norm, alpha=0.75)
        eomap_.draw_limb(axes=ax, lw=0.5, alpha=0.5)
        eomap_.draw_grid(axes=ax, grid_spacing=10. * u.deg, lw=0.5)
        ax.set_xlabel('')
        ax.set_ylabel('')
        ax.set_xticklabels([])
        ax.set_yticklabels([])
        ax.text(0.5,
                0.5,
                'No Data',
                transform=ax.transAxes,
                color='w',
                ha='center',
                va='center',
                fontsize=120)
        ax.add_patch(rect)
        ax.set_xlim(-1227, 1227)
        ax.set_ylim(-1227, 1227)

        for l, dpi in dpis_dict.items():
            figname = os.path.join(imgoutdir,
                                   '{}_eovsa_bd{:02d}.jpg'.format(l, s + 1))
            fig.savefig(figname, dpi=np.int(dpi), quality=85)
    return
Exemplo n.º 22
0
Arquivo: soho.py Projeto: kik369/sunpy
 def __init__(self, data, header, **kwargs):
     
     GenericMap.__init__(self, data, header, **kwargs)
     
     # Fill in some missing or broken info
     self._fix_date()
     
     self._name = self.instrument + " " + self.detector
     self._nickname = self.instrument + "-" + self.detector
             
     self.cmap = cm.get_cmap('soholasco%s' % self.detector[1])
Exemplo n.º 23
0
Arquivo: sdo.py Projeto: bsipocz/sunpy
    def __init__(self, data, header, **kwargs):

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

        # Fill in some missing info
        self.meta['detector'] = "AIA"
#        self.meta['instrme'] = "AIA"

        self._nickname = self.detector
        self._name = self.detector + " " + str(self.measurement)
        self.cmap = cm.get_cmap(self._get_cmap_name())
Exemplo n.º 24
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']
Exemplo n.º 25
0
    def __init__(self, data, header, **kwargs):

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

        # Fill in some missing info
        self.meta['detector'] = "EIT"
        self._fix_dsun()

        self._name = self.detector + " " + str(self.measurement)
        self._nickname = self.detector

        self.cmap = cm.get_cmap('sohoeit{wl:d}'.format(wl=self.wavelength))
Exemplo n.º 26
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()))
Exemplo n.º 27
0
 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     
     self.date = parse_time(header.get('date_obs'))
     self.detector = header.get('telescop')
     self.instrument = header.get('telescop')
     self.measurement = [header.get('energy_l'), header.get('energy_h')]
     self.name = "RHESSI %d - %d keV" % (header.get('energy_l'), 
                                         header.get('energy_h'))
     self.cmap = cm.get_cmap('rhessi')
     self.exposure_time = (parse_time(header.get('date_end')) - 
                           parse_time(header.get('date_obs'))).seconds
Exemplo n.º 28
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'] = "SWAP"
#        self.meta['instrme'] = "SWAP"
        self.meta['obsrvtry'] = "PROBA2"

        self._nickname = self.detector
        self.plot_settings['cmap'] = cm.get_cmap(name='sdoaia171')
Exemplo n.º 29
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" + self.measurement)
        self.plot_settings["norm"] = colors.LogNorm()
Exemplo n.º 30
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']
Exemplo n.º 31
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'] = "SWAP"
#        self.meta['instrme'] = "SWAP"
        self.meta['obsrvtry'] = "PROBA2"

        self._nickname = self.detector
        self.plot_settings['cmap'] = cm.get_cmap(name='sdoaia171')
Exemplo n.º 32
0
    def __init__(self, data, header, **kwargs):

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

        # Fill in some missing info
        self.meta['detector'] = "AIA"
#        self.meta['instrme'] = "AIA"

        self._nickname = self.detector
        self._name = self.detector + " " + str(self.measurement)

        self.cmap = cm.get_cmap('sdoaia{wl:d}'.format(wl=self.wavelength))
Exemplo n.º 33
0
Arquivo: soho.py Projeto: kik369/sunpy
 def __init__(self, data, header, **kwargs):
     
     GenericMap.__init__(self, data, header, **kwargs)
     
     # Fill in some missing info
     self.meta['detector'] = "EIT"
     self._fix_dsun()
     
     self._name = self.detector + " " + str(self.measurement)
     self._nickname = self.detector
     
     self.cmap = cm.get_cmap('sohoeit%d' % self.wavelength)
Exemplo n.º 34
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' + self.measurement)
        self.plot_settings['norm'] = colors.LogNorm()
Exemplo n.º 35
0
    def __init__(self, data, header, **kwargs):

        GenericMap.__init__(self, data, header, **kwargs)
        self.meta['wavelnth'] = np.nan
        self.meta['waveunit'] = 'nm'
        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']
Exemplo n.º 36
0
 def get_properties(cls, header):
     """Parses SWAP image header"""
     properties = Map.get_properties(header)
     
     properties.update({
         "detector": "SWAP",
         "instrument": "SWAP",
         "observatory": "PROBA2",
         "name": "SWAP %s" % header.get('wavelnth'),
         "nickname": "SWAP",
         "cmap": cm.get_cmap(name='sdoaia171')
     })
     return properties
Exemplo n.º 37
0
    def get_properties(cls, header):
        """Parses SWAP image header"""
        properties = Map.get_properties(header)

        properties.update({
            "detector": "SWAP",
            "instrument": "SWAP",
            "observatory": "PROBA2",
            "name": "SWAP %s" % header.get('wavelnth'),
            "nickname": "SWAP",
            "cmap": cm.get_cmap(name='sdoaia171')
        })
        return properties
Exemplo n.º 38
0
    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._name = self.detector + " " + str(self.measurement)
        self._nickname = self.detector

        self.cmap = cm.get_cmap(self._get_cmap_name())
Exemplo n.º 39
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']
Exemplo n.º 40
0
 def get_properties(cls, header):
     """Parses EUVI image header"""
     properties = Map.get_properties(header)
     
     properties.update({
         "date": parse_time(header.get('date-obs',header.get('date_obs'))),
         "detector": "EUVI",
         "instrument": "SECCHI",
         "observatory": header.get('obsrvtry'),
         "cmap": cm.get_cmap('sohoeit%d' % header.get('wavelnth')),
         "nickname": "EUVI-" + header.get('obsrvtry')[-1]
     })
     return properties
Exemplo n.º 41
0
    def __init__(self, data, header, **kwargs):

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

        self._name = self.observatory + " " + self.detector + " " + str(self.measurement)
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])

        self.cmap = cm.get_cmap('stereohi{det!s}'.format(det=self.detector[-1]))

        # 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']
Exemplo n.º 42
0
 def get_properties(cls, header):
     """Parses AIA image header"""
     properties = Map.get_properties(header)
     
     properties.update({
         "detector": "AIA",
         "instrument": "AIA",
         "observatory": "SDO",
         "nickname": "AIA",
         "cmap": cm.get_cmap('sdoaia%d' % header.get('wavelnth')),
         "processing_level": header.get('LVL_NUM')            
     })
     return properties
Exemplo n.º 43
0
    def __init__(self, data, header, **kwargs):

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

        self._name = self.observatory + " " + self.detector + " " + str(self.measurement)
        self._nickname = "{0}-{1}".format(self.detector, self.observatory[-1])

        self.cmap = cm.get_cmap('stereohi%s' % self.detector[-1])

        # 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']
Exemplo n.º 44
0
 def get_properties(cls, header):
     """Parses LASCO image header"""
     properties = Map.get_properties(header)
     
     datestr = "%sT%s" % (header.get('date_obs'), header.get('time_obs'))
     
     properties.update({
         "date": parse_time(datestr),
         "measurement": "white-light",
         "name": "LASCO %s" % header.get('detector'),
         "nickname": "LASCO-%s" % header.get('detector'),
         "cmap": cm.get_cmap('soholasco%s' % properties['detector'][1])
     })
     return properties
Exemplo n.º 45
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"] = "SWAP"
        #        self.meta['instrme'] = "SWAP"
        self.meta["obsrvtry"] = "PROBA2"

        self._name = self.detector + " " + str(self.measurement)
        self._nickname = self.detector

        self.cmap = cm.get_cmap(name="sdoaia171")
Exemplo n.º 46
0
 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     
     # Solar radius in arc-seconds at 1 au
     # @TODO: use sunpy.sun instead
     radius_1au = 959.644
     
     scale = header.get("cdelt1")
     
     self.date = parse_time(header.get('date_obs'))
     self.detector = "EIT"
     self.dsun = (radius_1au / (self.rsun_arcseconds * scale)) * constants.au
     self.name = "EIT %s" % header.get('wavelnth')
     self.cmap = cm.get_cmap('sohoeit%d' % header.get('wavelnth'))
Exemplo n.º 47
0
    def get_properties(cls, header):
        """Parses AIA image header"""
        properties = Map.get_properties(header)

        properties.update(
            {
                "detector": "AIA",
                "instrument": "AIA",
                "observatory": "SDO",
                "nickname": "AIA",
                "cmap": cm.get_cmap("sdoaia%d" % header.get("wavelnth")),
            }
        )
        return properties
Exemplo n.º 48
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"

        # Name that will appear at the top of a TRACE image plot
        self._name = self.detector + " " + self.measurement
        self._nickname = self.detector

        # Colour maps
        self.cmap = cm.get_cmap('trace' + self.measurement)
Exemplo n.º 49
0
    def __init__(self, data, header, **kwargs):

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

        # Fill in some missing or broken info
        datestr = "%sT%s" % (self.meta.get('date-obs', self.meta.get(
            'date_obs')), 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._name = self.instrument + " " + self.detector + " " + self.measurement
        self._nickname = self.instrument + "-" + self.detector
        self.cmap = cm.get_cmap('soholasco%s' % self.detector[1])
Exemplo n.º 50
0
    def __init__(self, data, header, **kwargs):

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

        self._nickname = self.detector
        #TODO Currently (8/29/2011), cannot read fits files containing more than one image (schriste)
        # Fix some broken/misapplied keywords
        if self.meta['ctype1'] == 'arcsec':
            self.meta['cunit1'] = 'arcsec'
            self.meta['ctype1'] = 'HPLN-TAN'
        if self.meta['ctype2'] == 'arcsec':
            self.meta['cunit2'] = 'arcsec'
            self.meta['ctype2'] = 'HPLT-TAN'

        self.meta['waveunit'] = 'keV'
        self.meta['wavelnth'] = [self.meta['energy_l'], self.meta['energy_h']]
        self.plot_settings['cmap'] = cm.get_cmap('rhessi')
Exemplo n.º 51
0
    def get_properties(cls, header):
        """Parses AIA image header"""
        properties = Map.get_properties(header)

        properties.update({
            "detector":
            "AIA",
            "instrument":
            "AIA",
            "observatory":
            "SDO",
            "nickname":
            "AIA",
            "cmap":
            cm.get_cmap('sdoaia%d' % header.get('wavelnth'))
        })
        return properties
Exemplo n.º 52
0
    def __init__(self, data, header, **kwargs):
        GenericMap.__init__(self, data, header, **kwargs)

        self.meta['detector'] = "SOT"
        self.meta['telescop'] = "Hinode"
        self._nickname = self.detector

        #TODO (add other options, Now all threated as intensity. This follows Hinode SDC archive)
        # StokesQUV -> grey, Velocity -> EIS, Width -> EIS, Mag Field Azi -> IDL 5 (STD gamma II)
        # 'WB' -> red
        # 'NB'(0 = red); (>0 = gray), # nb has 1 stokes I, the rest quv
        # 'SP' (<=1 = red); (>1 = gray) #sp has 2 stokes I, the rest quv
        color = {'SOT/WB': 'intensity',
                 'SOT/NB': 'intensity', # For the 1st dimension
                 'SOT/SP': 'intensity', # For the 1st 2 dimensions
                 }

        self.plot_settings['cmap'] = cm.get_cmap('hinodesot' + color[self.instrument])
Exemplo n.º 53
0
    def get_properties(cls, header):
        """Parses EUVI image header"""
        properties = Map.get_properties(header)

        properties.update({
            "date":
            parse_time(header.get('date_obs')),
            "detector":
            "EUVI",
            "instrument":
            "SECCHI",
            "observatory":
            header.get('obsrvtry'),
            "cmap":
            cm.get_cmap('sohoeit%d' % header.get('wavelnth')),
            "nickname":
            "EUVI-" + header.get('obsrvtry')[-1]
        })
        return properties
Exemplo n.º 54
0
    def get_properties(cls, header):
        """Parses LASCO image header"""
        properties = Map.get_properties(header)

        datestr = "%sT%s" % (header.get('date_obs'), header.get('time_obs'))

        properties.update({
            "date":
            parse_time(datestr),
            "measurement":
            "white-light",
            "name":
            "LASCO %s" % header.get('detector'),
            "nickname":
            "LASCO-%s" % header.get('detector'),
            "cmap":
            cm.get_cmap('soholasco%s' % properties['detector'][1])
        })
        return properties
Exemplo n.º 55
0
    def __init__(self, data, header, **kwargs):

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

        self.meta['detector'] = "SXT"
        self.meta['telescop'] = "Yohkoh"
        self.plot_settings['cmap'] = cm.get_cmap(name='yohkohsxt' + self.measurement[0:2].lower())
        self.plot_settings['norm'] = ImageNormalize(stretch=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))
Exemplo n.º 56
0
    def __init__(self, data, header, **kwargs):

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

        # converting data array to masked array
        # self.data = ma.masked_where(self.data > SATURATION_LIMIT, self.data)

        fw1 = header.get('EC_FW1_')
        if fw1.lower() not in _lower_list(self.filter_wheel1_measurements):
            raise ValueError('Unpexpected filter wheel 1 in header.')
        fw1 = fw1.replace("_", " ")

        fw2 = header.get('EC_FW2_')
        if fw2.lower() not in _lower_list(self.filter_wheel2_measurements):
            raise ValueError('Unpexpected filter wheel 2 in header.')
        fw2 = fw2.replace("_", " ")

        self.meta['detector'] = "XRT"
#        self.meta['instrume'] = "XRT"
        self.meta['telescop'] = "Hinode"                
        self.plot_settings['cmap'] = cm.get_cmap(name='hinodexrt')
Exemplo n.º 57
0
    def get_properties(cls, header):
        """Parses SXT image header"""
        properties = Map.get_properties(header)

        # 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.
        properties['dsun'] = constants.au
        yohkoh_solar_r = header.get('solar_r', None)
        if yohkoh_solar_r == None:
            properties['dsun'] = constants.au
        else:
            properties['dsun'] = constants.radius / (np.deg2rad(
                yohkoh_solar_r / 3600.0))

        wavelnth = header.get('wavelnth')
        if wavelnth == 'Al.1':
            wavelnth = 'Al01'
        if wavelnth.lower() == 'open':
            wavelnth = 'white light'

        properties.update({
            "detector":
            "SXT",
            "instrument":
            "SXT",
            "observatory":
            "Yohkoh",
            "name":
            "SXT %s" % wavelnth,
            "nickname":
            "SXT",
            "cmap":
            cm.get_cmap(name='yohkohsxt' + wavelnth[0:2].lower())
        })
        return properties
Exemplo n.º 58
0
    def __init__(self, data, header, **kwargs):

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

        fw1 = header.get('EC_FW1_')
        if fw1.lower() not in _lower_list(self.filter_wheel1_measurements):
            raise ValueError('Unpexpected filter wheel 1 in header.')
        fw1 = fw1.replace("_", " ")

        fw2 = header.get('EC_FW2_')
        if fw2.lower() not in _lower_list(self.filter_wheel2_measurements):
            raise ValueError('Unpexpected filter wheel 2 in header.')
        fw2 = fw2.replace("_", " ")

        self.meta['detector'] = "XRT"
        #        self.meta['instrume'] = "XRT"
        self.meta['telescop'] = "Hinode"

        self._name = "{0} {1}-{2}".format(self.detector, fw1, fw2)
        self._nickname = self.detector

        self.cmap = cm.get_cmap(name='hinodexrt')