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))
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)))
def save(self): date = sunpy.time.parse_time(self.date) error = sys('touch '+self.maps_dir+'data/{:%Y/%m/%d/} > shelloutput.txt'.format(date)) if error != 0: sys('{0}{1:%Y}; {0}{1:%Y/%m}; {0}{1:%Y/%m/%d} > shelloutput.txt'.format( 'mkdir '+self.maps_dir+'data/', date)) GenericMap.save(self, self.maps_dir+'data/{:%Y/%m/%d/%Y-%m-%dT%H:%M:%S}.fits'.format(date), clobber=True)
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) self.meta['detector'] = "HMI" # self.meta['instrme'] = "HMI" # self.meta['obsrvtry'] = "SDO" self._nickname = self.detector
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)))
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])
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) self.meta['detector'] = "SJI" self.meta['waveunit'] = "Angstrom" self.meta['wavelnth'] = header['twave1']
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) self.meta["detector"] = "HMI" # self.meta['instrme'] = "HMI" # self.meta['obsrvtry'] = "SDO" self._name = self.detector + " " + str(self.measurement) self._nickname = self.detector
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) # Fill in some missing or broken info self.meta['detector'] = "MDI" self._fix_dsun() self._name = self.detector + " " + self.measurement self._nickname = self.detector + " " + self.measurement
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)))
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) # Fill in some missing or broken info self.meta['detector'] = "MDI" self._fix_dsun() self._name = self.observatory + " " + self.detector self._nickname = self.detector + " " + self.measurement
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())
def plot(self, vmin=None, vmax=None, *args, **kwargs): mean = np.nanmean(self.data, dtype=np.float64) std = np.nanstd(self.data, dtype=np.float64) if vmin is None: vmin = mean - (2.0 * std) if vmax is None: vmax = mean + (2.0 * std) GenericMap.plot(self, vmin=vmin, vmax=vmax, *args, **kwargs) return
def save(self): date = sunpy.time.parse_time(self.date) error = sys('touch ' + self.maps_dir + 'data/{:%Y/%m/%d/} > shelloutput.txt'.format(date)) if error != 0: sys('{0}{1:%Y}; {0}{1:%Y/%m}; {0}{1:%Y/%m/%d} > shelloutput.txt'. format('mkdir ' + self.maps_dir + 'data/', date)) GenericMap.save(self, self.maps_dir + 'data/{:%Y/%m/%d/%Y-%m-%dT%H:%M:%S}.fits'.format(date), clobber=True)
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)
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']
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']
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])
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')
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()))
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)
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()))
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'] = plt.get_cmap(name='sdoaia171')
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))
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()
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']
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()
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']
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))
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']
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())
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']
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) self._name = "RHESSI %d - %d keV" % (self.measurement[0], self.measurement[1]) self._nickname = self.detector # 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'
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")
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) # Fill in some missing or broken info self.meta['detector'] = "MDI" self._fix_dsun() self._nickname = self.detector + " " + self.measurement vmin = np.nanmin(self.data) vmax = np.nanmax(self.data) if abs(vmin) > abs(vmax): self.plot_settings['norm'] = colors.Normalize(-vmin, vmin) else: self.plot_settings['norm'] = colors.Normalize(-vmax, vmax)
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')
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) self._name = "RHESSI {measure[0]:.0f} - {measure[1]:.0f} keV".format(measure=self.measurement) self._nickname = self.detector # 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'
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)))
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)
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 or broken info self.meta['detector'] = "MDI" self._fix_dsun() self._nickname = self.detector + " " + self.measurement vmin = np.nanmin(self.data) vmax = np.nanmax(self.data) if abs(vmin) > abs(vmax): self.plot_settings['norm'] = colors.Normalize(-vmin, vmin) else: self.plot_settings['norm'] = colors.Normalize(-vmax, vmax)
def timelag_map(self, channel_a, channel_b, **kwargs): """ Construct map of timelag values that maximize the cross-correlation between two channels in each pixel of an AIA map. """ cc = self.cross_correlation(channel_a, channel_b, **kwargs) bounds = kwargs.get('timelag_bounds', None) if bounds is not None: indices, = np.where( np.logical_and(self.timelags >= bounds[0], self.timelags <= bounds[1])) start = indices[0] stop = indices[-1] + 1 else: start = 0 stop = self.timelags.shape[0] + 1 i_max_cc = cc[start:stop, :, :].argmax(axis=0) max_timelag = self.timelags[start:stop][i_max_cc] meta = self[channel_a].maps[0].meta.copy() del meta['instrume'] del meta['t_obs'] del meta['wavelnth'] meta['bunit'] = 's' meta['comment'] = f'{channel_a}-{channel_b} timelag' plot_settings = { 'cmap': 'RdBu_r', 'vmin': self.timelags[start:stop].value.min(), 'vmax': self.timelags[start:stop].value.max() } plot_settings.update(kwargs.get('plot_settings', {})) timelag_map = GenericMap(max_timelag, meta.copy(), plot_settings=plot_settings.copy()) return timelag_map
def peak_cross_correlation_map(self, channel_a, channel_b, **kwargs): """ Construct map of peak cross-correlation between two channels in each pixel of an AIA map. """ cc = self.cross_correlation(channel_a, channel_b, **kwargs) bounds = kwargs.get('timelag_bounds', None) if bounds is not None: indices, = np.where( np.logical_and(self.timelags >= bounds[0], self.timelags <= bounds[1])) start = indices[0] stop = indices[-1] + 1 else: start = 0 stop = self.timelags.shape[0] + 1 max_cc = cc[start:stop, :, :].max(axis=0) meta = self[channel_a].maps[0].meta.copy() del meta['instrume'] del meta['t_obs'] del meta['wavelnth'] meta['bunit'] = '' meta['comment'] = f'{channel_a}-{channel_b} cross-correlation' plot_settings = {'cmap': 'plasma'} plot_settings.update(kwargs.get('plot_settings', {})) correlation_map = GenericMap(max_cc, meta, plot_settings=plot_settings) return correlation_map
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])
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])
def __init__(self, data, header, temperature_bin_edges: u.K, **kwargs): self.temperature_bin_edges = temperature_bin_edges # sanitize header meta_base = header.copy() meta_base['temp_unit'] = self.temperature_bin_edges.unit.to_string() meta_base['bunit'] = data.unit.to_string() # build map list map_list = [] for i in range(self.temperature_bin_edges.shape[0] - 1): tmp = GenericMap(data[:, :, i], meta_base) tmp.meta['temp_a'] = self.temperature_bin_edges[i].value tmp.meta['temp_b'] = self.temperature_bin_edges[i+1].value tmp.plot_settings.update(kwargs.get('plot_settings', {})) map_list.append(tmp) # call super method super().__init__(map_list)
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) # 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)
def __init__(self, data, header, **kwargs): GenericMap.__init__(self, data, header, **kwargs) if header.get('lvl_num') == 2: self.meta['wavelnth'] = header.get('twave1') self.meta['detector'] = header.get('instrume') self.meta['waveunit'] = "Angstrom" if header.get('lvl_num') == 1: self.meta['wavelnth'] = int(header.get('img_path').split('_')[1]) self.meta['waveunit'] = "Angstrom" self.meta['detector'] = "SJI" self.meta['waveunit'] = "Angstrom" palette = cm.get_cmap('irissji' + str(int(self.meta['wavelnth']))) palette.set_bad('black') self.plot_settings['cmap'] = palette self.plot_settings['norm'] = ImageNormalize( stretch=visualization.AsinhStretch(0.1))