示例#1
0
 def norm_set(self, text):
     stretch_dict = {
         'No Stretch': None,
         'Sqrt Stretch': SqrtStretch(),
         'Linear Stretch': LinearStretch(),
         'Squared Stretch': SquaredStretch(),
         'Power Stretch': PowerStretch(self.a),
         'Log Stretch': LogStretch(self.a)
     }
     self.stretch_val = stretch_dict[text]
     if text == 'Log Stretch':
         self.var_max = 10000
         self.var_int = 10
         self.cube = self.stretch_val(self.cube_base)
         #self.norm = ImageNormalize(interval=self.interval, stretch=self.stretch_val, clip=True)
     elif text == 'Sqrt Stretch':
         self.cube = np.sqrt(self.cube)
     elif text == 'No Stretch':
         self.norm = None
         self.cube = self.cube_base
     else:
         self.var_max = 10
         self.var_int = 1
         self.cube = self.stretch_val(self.cube_base, clip=False)
         #self.norm = ImageNormalize(interval=self.interval, stretch=self.stretch_val, clip=True)
     main.create_image(self.cube)
示例#2
0
文件: soho.py 项目: vatch123/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
        # 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)))
示例#3
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

# change 'figure_width': 1920, 'figure_height': 1080 =(19.2,10.8)
        f = Figure(figsize=(8, 6))
        a = f.add_subplot(111)
        f.subplots_adjust(left=0, bottom=0.005, right=1, top=1)
        a.get_xaxis().set_visible(False)
        a.get_yaxis().set_visible(False)              
        
        # add axes for sliders 
        ax_norma = f.add_axes([0.81, 0.1, 0.15, 0.025])
        ax_contr = f.add_axes([0.81, 0.05, 0.15, 0.025])

        hdu_list = fits.open(sky_image)
        hdu_list.info()
        img = hdu_list[0].data

        # interval = MinMaxInterval()
        contrast=0.15
        interval = ZScaleInterval(contrast=contrast)
        vmin, vmax = interval.get_limits(img)

        norm = ImageNormalize(vmin=vmin, vmax=vmax, stretch=PowerStretch(power_normalise))

        a.imshow(img, origin='lower', norm=norm, cmap='cividis')#, vmax=max_saturation)

        # Embedding In Tk
        canvas = FigureCanvasTkAgg(f, self)
        # import code; code.interact(local=dict(globals(), **locals()))
        canvas.draw()
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        # Show ToolBar
        toolbar = NavigationToolbar(canvas, self)
        toolbar.update()
        # Activate Zoom
        toolbar.zoom(self)
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        
        delta_f = 0.1
        
        # add sliders 
        s_norma = Slider(ax_norma, 'Normalise', 0.1, 5.0, valinit=power_normalise, valstep=delta_f)
        s_contr = Slider(ax_contr, 'Contrast', 0.1, 1.0, valinit=contrast)
        

        def update(val):
            n_norma = s_norma.val
            n_contr = s_contr.val
            # assign new values to contrast and normalise
            interval = ZScaleInterval(contrast=n_contr)
            vmin, vmax = interval.get_limits(img)
            norm = ImageNormalize(vmin=vmin, vmax=vmax, stretch=PowerStretch(n_norma))
            a.imshow(img, origin='lower', norm=norm, cmap='cividis')
            canvas.draw_idle()
        s_norma.on_changed(update)    
        s_contr.on_changed(update)
        
        hdu_list.close()
示例#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
    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))
示例#6
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)
示例#7
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)
示例#8
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)
示例#9
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)
示例#10
0
 def update(val):
     n_norma = s_norma.val
     n_contr = s_contr.val
     # assign new values to contrast and normalise
     interval = ZScaleInterval(contrast=n_contr)
     vmin, vmax = interval.get_limits(img)
     norm = ImageNormalize(vmin=vmin, vmax=vmax, stretch=PowerStretch(n_norma))
     a.imshow(img, origin='lower', norm=norm, cmap='cividis')
     canvas.draw_idle()
示例#11
0
文件: soho.py 项目: s0nskar/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'] = cm.get_cmap(self._get_cmap_name())
        self.plot_settings['norm'] = ImageNormalize(stretch=PowerStretch(0.5))
示例#12
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)))
示例#13
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
示例#14
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=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']
示例#15
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'] = 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']
示例#16
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')
        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)
示例#17
0
    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']
示例#18
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)))
示例#19
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))
示例#20
0
    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'] = 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
示例#21
0
    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")
示例#22
0
    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
示例#23
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

# change 'figure_width': 1920, 'figure_height': 1080 =(19.2,10.8)
        f = Figure(figsize=(8, 6))
        a = f.add_subplot(111)
        f.subplots_adjust(left=0, bottom=0.005, right=1, top=1)
        a.get_xaxis().set_visible(False)
        a.get_yaxis().set_visible(False)

        hdu_list = fits.open(sky_image)
        hdu_list.info()
        img = hdu_list[0].data

        # interval = MinMaxInterval()
        interval = ZScaleInterval(contrast=0.15)
        vmin, vmax = interval.get_limits(img)

        norm = ImageNormalize(vmin=vmin, vmax=vmax, stretch=PowerStretch(0.7))

        a.imshow(img, origin='lower', norm=norm, cmap='cividis')#, vmax=max_saturation)

        # Embedding In Tk
        canvas = FigureCanvasTkAgg(f, self)
        # import code; code.interact(local=dict(globals(), **locals()))
        canvas.draw()
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        # Show ToolBar
        toolbar = NavigationToolbar(canvas, self)
        toolbar.update()
        # Activate Zoom
        toolbar.zoom(self)
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        hdu_list.close()
示例#24
0
    xaxis.display_minor_ticks(True)
    yaxis.display_minor_ticks(True)
    # xaxis.set_minor_frequency(xmi_num)
    # yaxis.set_minor_frequency(ymi_num)

    """ scaling and imaging """
    interp='none'
    # interpolation of the datacube, e.g., 'none'/'nearest'/'bilinear'/'bicubic', defaut is 'none'

    scaling='linear'
    # scaling of the datacube, e.g., 'linear'/'log'/'power'/'sqrt'/'squared', defaut is 'linear'
    index=1e3
    # index of log and power scaling, default is 1e3
    if scaling=='linear': stretch=LinearStretch()
    elif scaling=='log': stretch=LogStretch(index)
    elif scaling=='power': stretch=PowerStretch(index)
    elif scaling=='sqrt': stretch=SqrtStretch()
    elif scaling=='squared': stretch=SquaredStretch()
    if scale is None: interval=ManualInterval(vmin=np.nanmin(dat), vmax=np.nanmax(dat))
    else: interval=ManualInterval(vmin=scale[0], vmax=scale[1])
    # norm=ImageNormalize(dat, interval=interval, stretch=stretch)
    
    if scale is None: norm=colors.Normalize(vmin=np.nanmin(dat), vmax=np.nanmax(dat))
    else: norm=colors.Normalize(vmin=scale[0], vmax=scale[1])

    # ax.set_xlim(-0.5, dat.shape[1]-0.5)
    # ax.set_ylim(-0.5, dat.shape[0]-0.5)
    if colormap is not None: plt.set_cmap(colormap)
    cmap=mpl.cm.get_cmap()
    cmap.set_bad(color='white')
    im=ax.imshow(dat, norm=norm, interpolation=interp, cmap=cmap, origin='lower')
示例#25
0
文件: pyscript.py 项目: heh15/Arp240
image = fits.open('image/NGC5257_12CO21_pbcor_cube_masked.fits')
image_mas = fits.open(outfolder + 'mask.fits')
xmin, xmax = 345, 615
ymin, ymax = 347, 617
zmin, zmax = 0, 69
data = image[0].data[zmin:zmax + 1, ymin:ymax + 1, xmin:xmax + 1]
data_mas = image_mas[0].data[zmin:zmax + 1, ymin:ymax + 1, xmin:xmax + 1]
head = image[0].header
zsize = data[:, 0, 0].size
cdeltsp = 0.1
cont = 0.0182647
v = np.array([1, 2, 4, 8, 16, 32, 64]) * cont
v_neg = [-cont]
interval = PercentileInterval(99.5)
vmax = interval.get_limits(data)[1]
norm = ImageNormalize(vmin=cont, vmax=vmax, stretch=PowerStretch(0.5))

files_mod, typ = [], []
for thisFile in os.listdir(outfolder):
    if 'mod_azim.fits' in thisFile: files_mod.append(thisFile)

if len(files_mod) == 1: typ.append('AZIM')

for thisFile in os.listdir(outfolder):
    if 'mod_local.fits' in thisFile: files_mod.append(thisFile)

if len(files_mod) == 2: typ.append('LOCAL')
elif (len(files_mod) == 1 and len(typ) == 0): typ.append('LOCAL')
elif (len(files_mod) == len(typ) == 0): exit()

# Beginning channel map plot
示例#26
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.Label(self, text="u", font=LARGE_FONT)
        label.pack(pady=10, padx=10)

        button = ttk.Button(self,
                            text="optical g",
                            command=lambda: controller.show_frame(GPage))
        button.pack()

        button2 = ttk.Button(self,
                             text="optical r",
                             command=lambda: controller.show_frame(RPage))
        button2.pack()

        button3 = ttk.Button(self,
                             text="optical i",
                             command=lambda: controller.show_frame(IPage))
        button3.pack()

        f = Figure(figsize=(8, 6))
        a = f.add_subplot(111)
        f.subplots_adjust(left=0, bottom=0.005, right=1, top=1)
        a.get_xaxis().set_visible(False)
        a.get_yaxis().set_visible(False)

        # add axes for sliders
        ax_norma = f.add_axes([0.81, 0.1, 0.15, 0.025])
        ax_contr = f.add_axes([0.81, 0.05, 0.15, 0.025])

        hdu_list = fits.open(sky_image)
        hdu_list.info()
        img = hdu_list[0].data

        contrast = image_contrast
        interval = ZScaleInterval(contrast=contrast)
        vmin, vmax = interval.get_limits(img)

        stretch_options = {
            'LogStretch': LogStretch(power_normalise),
            'PowerStretch': PowerStretch(power_normalise),
        }

        norm = ImageNormalize(vmin=vmin,
                              vmax=vmax,
                              stretch=stretch_options[image_scaling])

        a.imshow(img, origin='lower', norm=norm, cmap='cividis')

        # Embedding In Tk
        canvas = FigureCanvasTkAgg(f, self)
        canvas.draw()
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        # Show ToolBar
        toolbar = NavigationToolbar(canvas, self)
        toolbar.update()
        # Activate Zoom
        toolbar.zoom(self)
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        delta_f = 0.1

        # add sliders
        s_norma = Slider(ax_norma,
                         'Normalise',
                         0.1,
                         5.0,
                         valinit=power_normalise,
                         valstep=delta_f)
        s_contr = Slider(ax_contr, 'Contrast', 0.1, 1.0, valinit=contrast)

        def update(val):
            n_norma = s_norma.val
            n_contr = s_contr.val
            # assign new values to contrast and normalise
            interval = ZScaleInterval(contrast=n_contr)
            vmin, vmax = interval.get_limits(img)
            norm = ImageNormalize(vmin=vmin,
                                  vmax=vmax,
                                  stretch=PowerStretch(n_norma))
            a.imshow(img, origin='lower', norm=norm, cmap='cividis')
            # saving data to json file
            SaveJson(n_norma, n_contr)
            canvas.draw_idle()

        s_norma.on_changed(update)
        s_contr.on_changed(update)

        hdu_list.close()
示例#27
0
    logging.basicConfig(level=logging.DEBUG)

    parser = argparse.ArgumentParser(
        description="Temporal drizzle animation utility")
    parser.add_argument('cfg',
                        type=str,
                        help='YML config file for the drizzle animator.')

    args = parser.parse_args()

    pipe.configure_pipeline(args.cfg)
    config = pipe.config.config

    if config.animation.power:
        VALID_STRETCHES['power'] = PowerStretch(config.animation.power)

    if not config.animation.target:
        log.warning(
            'Target missing! Must be specified in the config for metadata.')

    if not config.data.startt:
        start = 0
    else:
        start = config.data.startt

    if config.data.duration and config.data.stopt:
        end = start + config.data.duration
    elif config.data.duration and not config.data.stopt:
        end = start + config.data.duration
    elif not config.data.duration and config.data.stopt:
示例#28
0
                backgroundcolor="white",
                transform=ax1[i].transAxes)

    ax1[i].plot(null, np.zeros_like(null), "r:", lw=2)
    ax1[i].errorbar(distance,
                    fluxring[i],
                    yerr=erb[i],
                    fmt="ko-",
                    lw=3,
                    elinewidth=1,
                    capsize=2,
                    label=wav)

    # Plots SZ signal
    # normalises data with 'zscale' and stretches it by 'PowerStretch' as in ds9
    norm = ImageNormalize(SZ[i], interval=zscale(), stretch=PowerStretch(1.3))
    P1 = ax2[1, i].imshow(MCsim[i], norm=norm, aspect="auto")
    P2 = ax2[0, i].imshow(SZ[i], norm=norm, aspect="auto")
    cb = fig2.colorbar(P1, cax=cax[i], orientation="horizontal")
    cb.ax.xaxis.set_ticks_position("top")
    cb.set_label(r"$\mathrm{mJy/px}$", fontsize=10)
    cb.ax.xaxis.set_label_position("top")
    cb.ax.tick_params(labelsize=8)

    for j in range(len(ax2)):
        ax2[j, i].axis("off")

        t = ax2[j, i].text(0.69,
                           0.90,
                           wav,
                           color="w",