def abscal(uv_files, pol=-5): pol2str = {-5:'xx', -6:'yy'} polstr = pol2str[pol] # echo info echo("Running abscal on field {} in JD {} for pol {}".format(field, JD, pol), type=1) # get source info echo("getting source info", type=1) (lst, jd, utc_range, utc_center, source_files, source_utc_range) = source2file(source_ra, duration=duration, offset=0.0, start_jd=JD, jd_files=uv_files, get_filetimes=True, verbose=True) utc_center = "'" + '/'.join(utc_center.split('/')[:-1]) + ' ' + utc_center.split('/')[-1] + "'" source_files = list(source_files) Nsf = len(source_files) # make flux model echo("making flux model", type=1) cmd = "casa --nologger --nocrashreport --nogui --agg -c {} --image --freqs 100,200,1024 --cell 150arcsec --imsize 512".format(complist) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("flux model exit {}".format(out)) # apply PB correction to flux model echo("applying PB to flux model") cmd = "pbcorr.py --beamfile {} --outdir ./ --pol {} --time {} --ext pbcorr --lon {} --lat {} {} --multiply {}.cl.fits"\ "".format(beamfile, pol, utc_center, lon, lat, overwrite, field) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("flux model PB corr exit {}".format(out)) # import to CASA image echo("importing model file to CASA image format") cmd = '''casa --nologger --nocrashreport --nogui --agg -c ''' \ '''"importfits('{}.cl.pbcorr.fits', '{}.cl.pbcorr.image', overwrite=True)"'''.format(field, field) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("flux model CASA import exit {}".format(out)) modelfile = field + '.cl.pbcorr.image' if rfi_flag: echo("RFI flagging data", type=1) for i, sf in enumerate(source_files): cmd = "xrfi_run.py --algorithm 'xrfi' --kf_size 13 --summary {}".format(sf) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("RFI flag on {} exit {}".format(sf, out)) echo("applying RFI flags") for i, sf in enumerate(source_files): cmd = "xrfi_apply.py --ext R {} --flag_file {}.flags.npz {}".format(overwrite, sf, sf) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("RFI apply on {} exit {}".format(sf, out)) # update source file(s) paths for i in range(Nsf): source_files[i] = source_files[i] + 'R' # convert to uvfits echo("converting miriad to uvfits", type=1) for i, sf in enumerate(source_files): cmd = "miriad_to_uvfits.py {} {}".format(overwrite, sf) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("miriad_to_uvfits on {} exit {}".format(sf, out)) source_uvfits = map(lambda x: x+'.uvfits', source_files) # renumber ants if renumber_uvfits: echo("renumbering uvfits", type=1) for i, sf in enumerate(source_uvfits): cmd = "renumber_ants.py --overwrite {} {}".format(sf, sf) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("renumber_ants on {} exit {}".format(sf, out)) # combine uvfits if len(source_uvfits) > 1: echo("combining uvfits", type=1) cmd = "combine_uvfits.py {} {}".format(overwrite, ' '.join(source_uvfits)) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("combine uvfits exit {}".format(out)) source_uvfile = source_files[0] source_uvfits = source_uvfits[0] # absolute calibration echo("absolutely calibrating", type=1) cmd = "casa --nologger --nocrashreport --nogui --agg -c sky_image.py " \ "--msin {} --source {} --model_im {} --refant {} {} --imsize {} --pxsize {} --niter {} --timerange {} " \ "--KGcal --KGsnr {} --Acal --Asnr {} --BPcal --BPsnr {} --image_mfs --image_model --plot_uvdist" \ "".format(source_uvfits, source, modelfile, refant, ex_ants, imsize, pxsize, niter, source_utc_range, KGsnr, Asnr, BPsnr) if casa_rflag: cmd += ' --rflag' out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("abscal exit {}".format(out)) # convert to calfits echo("converting CASA caltables to calfits", type=1) calfits_fname = source_uvfile + '.ms.abs.calfits' dly_file = source_uvfile + '.ms.K.cal.npz' phs_file = source_uvfile + '.ms.Gphs.cal.npz' amp_file = source_uvfile + '.ms.Gamp.cal.npz' bp_file = source_uvfile + '.ms.B.cal.npz' cmd = "skynpz2calfits.py --fname {} --uv_file {} --dly_file {} --phs_file {} --amp_file {} --bp_file {} " \ "--plot_bp --plot_phs --plot_amp --plot_dlys --bp_medfilt --medfilt_kernel 13 {} " \ "--bp_gp_max_dly {} --bp_gp_thin 4 {}".format(calfits_fname, source_uvfile, dly_file, phs_file, amp_file, bp_file, bp_gp_smooth, bp_gp_mx_dly, overwrite) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("skynpz2calfits exit {}".format(out)) # primary beam correct MFS image echo("pb correct mfs image", type=1) cmd = "pbcorr.py --beamfile {} --pol {} --time {} --ext pbcorr --lon {} --lat {} --spec_cube {} {}" \ "".format(beamfile, pol, utc_center, lon, lat, overwrite, source_uvfile+".ms.{}.fits".format(source)) out = subprocess.call(cmd, shell=True, stdout=abs_out, stderr=abs_err) echo("pb correction exit {}".format(out)) # plot source and model source source_im = source_uvfile + ".ms.{}".format(source) model_im = source_uvfile + ".ms.model.{}".format(source) vmin = -5 vmax = 40 fig = plt.figure(figsize=(14,10)) f1 = aplpy.FITSFigure(source_im+".fits", figure=fig, subplot=[0.0, 0.55, 0.45, 0.45]) f1.show_colorscale(cmap='nipy_spectral', vmin=vmin, vmax=vmax) f1.add_grid() f1.add_beam() f1.recenter(source_ra, source_dec, width=15, height=15) f1.add_colorbar() f1.colorbar.set_axis_label_text("Jy/beam") f1.set_title("{} {} MFS Image".format(source, polstr)) f2 = aplpy.FITSFigure(source_im+".pb.fits", figure=fig, subplot=[0.55, 0.55, 0.45, 0.45]) f2.show_colorscale(cmap='nipy_spectral', vmin=0, vmax=1) f2.add_grid() f2.recenter(source_ra, source_dec, width=15, height=15) f2.add_colorbar() f2.colorbar.set_axis_label_text("PB Beam Response") f2.set_title("Primary Beam") f3 = aplpy.FITSFigure(source_im+".pbcorr.fits", figure=fig, subplot=[0.0, 0.0, 0.45, 0.45]) f3.show_colorscale(cmap='nipy_spectral', vmin=vmin, vmax=vmax) f3.add_grid() f3.add_beam() f3.recenter(source_ra, source_dec, width=15, height=15) f3.add_colorbar() f3.colorbar.set_axis_label_text("Jy/beam") f3.set_title("{} {} MFS Image + PB Correction".format(source, polstr)) f4 = aplpy.FITSFigure(model_im+".fits", figure=fig, subplot=[0.55, 0.0, 0.45, 0.45]) f4.show_colorscale(cmap='nipy_spectral', vmin=vmin, vmax=vmax) f4.add_grid() f4.add_beam() f4.recenter(source_ra, source_dec, width=15, height=15) f4.add_colorbar() f4.colorbar.set_axis_label_text("Jy/beam") f4.set_title("Model MFS Image") fig.savefig("{}/{}_{}_MFS.png".format(data_path, source, polstr), dpi=150, bbox_inches='tight') plt.close() return calfits_fname
'13CO_m331_m338_m345.png', '13CO_346_333_345.png', '13CO_452_439_426.png', '13CO_505_492_479.png', '13CO_532_519_505.png', '13CO_592_578_565.png' ] # Legend labels lab_blue = ['-34.5', '31.9', '42.6', '47.9', '50.5', '56.5'] lab_green = ['-33.8', '33.3', '43.9', '49.2', '51.9', '57.8'] lab_red = ['-33.1', '34.6', '45.2', '50.5', '53.2', '59.2'] for png in pngs: t = os.path.splitext(png) filename = str(t[0]) index = pngs.index(png) if Path('./../rgb_figs/' + filename + '.pdf').exists() == False: f = aplpy.FITSFigure(png) f.show_rgb() f.add_scalebar(0.1 * pc_sc) f.scalebar.show(0.1 * pc_sc) f.scalebar.set_corner('bottom left') f.scalebar.set_color('white') f.scalebar.set_label('0.1 pc') f.scalebar.set_font(size=15) f.scalebar.set_linewidth(2) f.axis_labels.set_font(size=16) f.ticks.set_color('white') f.tick_labels.set_font(size=15) f.axis_labels.set_xtext('Right Ascension (J2000)') f.axis_labels.set_ytext('Declination (J2000)') f.axis_labels.set_ypad(-2) f.show_regions('./../../brick_regions_new.reg')
-5.412955261, -5.461988054, -5.510106789, -5.555931851, -5.605577113, -5.6519109, -5.701555547, -5.752730272, -5.801156183, -5.84927762, -5.897401317, -5.940943148, -5.986011267, -6.029551074, -6.068507208, -6.103567778, -6.135131552, -6.166692778, -6.195094167, -6.219704167, -6.240522195, -6.261336664 ] * u.deg) path4 = Path(fk, width=6 * u.arcmin) slice3 = extract_pv_slice( '/Users/shuokong/GoogleDrive/13co/products/regrid_12co_specsmooth_0p25_mask_imfit_13co_pix_2_Tmb.fits', path4) slice3.writeto('my_slice.fits') import aplpy import matplotlib.pyplot as plt fig = plt.figure() gc = aplpy.FITSFigure('my_slice.fits', dimensions=[0, 1], figure=fig, hdu=0) gc.show_colorscale(aspect='auto') gc.ticks.set_xspacing(21.) gc.ticks.set_minor_frequency(7) gc.axis_labels.set_ytext('Velocity (km/s)') gc.ticks.show() gc.ticks.set_color('black') gc.ticks.set_length(10) gc.ticks.set_linewidth(2) gc.add_colorbar() gc.set_theme('publication') gc.colorbar.set_width(0.2) gc.colorbar.set_axis_label_text('K') plt.savefig('pvKirkcores.pdf', bbox_inches='tight')
def aplpy_moments_grid(fitsimages, scaling, **kwargs): """ aplpy_moments_grid: plot moment maps side by side ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is being tested at the moment. No description yet. """ print("--> plotting map grid of these maps: ", fitsimages) # get keyword arguments main_figsize = kwargs.get('figsize', (8.27, 11.69)) # default: A4 recenter = kwargs.get('recenter', None) # default: do not recenter contours = kwargs.get('contour', ['' for im in fitsimages]) # default: no contours contours = kwargs.get('contours', ['' for im in fitsimages]) # default: no contours labels = kwargs.get('labels', [im[:-5].replace('_','$\_$') for im in fitsimages]) # default: file name without ending label_kwargs = kwargs.get('label_kwargs', {}) # default: no kwargs scalebar = kwargs.get('scalebar', None) # default: not displayed beam = kwargs.get('beam', None) # default: not displayed out = kwargs.get('out', 'moments.pdf') # default: generic figure name # check inputs if not ( len(contours) == len(fitsimages) ): raise ValueError("Number of contours dows not match number of images.") # set up main figure containing all subplots and calculate number of rows main_fig = __plt__.figure(figsize = main_figsize) ncols = 3.0 nrows = len(fitsimages)/3 # loop over rows if more than 3 images are given for row in __np__.arange(len(fitsimages)/3): this_row_fits = fitsimages[3*row:3*row+3] this_row_contours = contours[3*row:3*row+3] this_row_label = labels[3*row:3*row+3] # loop over moments 0 to 2 for mom in [0,1,2]: this_panel_fits = this_row_fits[mom] this_panel_contours = this_row_contours[mom] this_panel_label = this_row_label[mom] this_panel_scaling = scaling[mom] this_panel_size = (nrows,ncols,row*ncols+mom+1) # plot image fig = __aplpy__.FITSFigure(this_panel_fits, figure = main_fig, subplot = this_panel_size ) fig.show_colorscale(cmap = this_panel_scaling[4], vmin = this_panel_scaling[0], vmax = this_panel_scaling[1], stretch = this_panel_scaling[3] ) # recenter image if recenter is not None: if (len(recenter) == 2): fig.recenter(recenter[0].ra.degree, recenter[0].dec.degree, radius=recenter[1].to(__u__.degree).value) elif (len(recenter) == 3): fig.recenter(recenter[0].ra.degree, recenter[0].dec.degree, width=recenter[1].to(__u__.degree).value, height=recenter[2].to(__u__.degree).value) else: raise SyntaxWarning("--> Specify center as SkyCoord(x,y) and either radius or width, height. Not recentering") # overplot contours if not this_panel_contours is '': if ( len(this_panel_contours) == 3 ): fig.show_contour(data = this_panel_contours[0], levels = this_panel_contours[1], colors = this_panel_contours[2] ) else: raise SyntaxWarning("--> Wrong number or format of contour parameters. Not plotting contours") # panel label if not this_panel_label is None: fig.add_label(0.5,0.9, this_panel_label.replace('_','$\_$'), color='black', relative=True, size=ap._velo_fontsize, **label_kwargs) # colorbar settings # show colorbars only in top images if ( row == 0 ): fig.add_colorbar() fig.colorbar.set_location('top') fig.colorbar.set_width(0.2) fig.colorbar.set_axis_label_text(this_panel_scaling[2]) fig.colorbar.set_axis_label_font(size=ap._colorbar_fontsize) fig.colorbar.set_font(size=ap._colorbar_fontsize) fig.colorbar.set_frame_color(ap._frame_color) # set up panel ticks + labels fig.axis_labels.hide() fig.tick_labels.hide() fig.ticks.show() fig.ticks.set_xspacing(ap.ticks_xspacing.to(__u__.degree).value) fig.ticks.set_yspacing(ap.ticks_yspacing.to(__u__.degree).value) fig.ticks.set_minor_frequency(ap.ticks_minor_frequency) fig.ticks.set_color(ap._ticks_color) fig.frame.set_color(ap._frame_color) # add axis label and scale bar if bottom left plot if ( row == nrows-1 ) and ( mom == 0 ): fig.axis_labels.show() fig.tick_labels.show() fig.tick_labels.set_xformat(ap.tick_label_xformat) fig.tick_labels.set_yformat(ap.tick_label_yformat) fig.tick_labels.set_font(size=ap._tick_label_fontsize) fig.ticks.show() fig.ticks.set_xspacing(ap.ticks_xspacing.to(__u__.degree).value) fig.ticks.set_yspacing(ap.ticks_yspacing.to(__u__.degree).value) fig.ticks.set_minor_frequency(ap.ticks_minor_frequency) fig.ticks.set_color(ap._ticks_color) fig.axis_labels.set_font(size=ap._tick_label_fontsize) # add beam if not beam is None: fig.add_beam() fig.beam.show() fig.beam.set_corner(beam) fig.beam.set_frame(ap._beam_frame) fig.beam.set_color(ap._beam_color) # add scalebar if not scalebar is None: fig.add_scalebar(length = scalebar[0].to(__u__.degree).value, label = scalebar[1], corner = scalebar[2], frame = ap._scalebar_frame ) fig.scalebar.set_font(size = ap._scalebar_fontsize) fig.scalebar.set_linestyle(ap._scalebar_linestyle) fig.scalebar.set_linewidth(ap._scalebar_linewidth) fig.scalebar.set_color(ap._scalebar_color) __mpl__.pyplot.subplots_adjust(wspace=0.001, hspace=0.001) # __mpl__.pyplot.tight_layout() fig.save(out, dpi=300, transparent=True) print("--> saved file as "+out)
def show_overlay(lofarhdu,opthdu,ra,dec,size,firsthdu=None,rms_use=None,bmaj=None,bmin=None,bpa=None,title=None,save_name=None,plotpos=None,block=True,interactive=False,plot_coords=True,overlay_cat=None,lw=1.0,show_lofar=True,no_labels=False,show_grid=True,overlay_region=None,overlay_scale=1.0,circle_radius=None,coords_color='white',coords_lw=1,coords_ra=None,coords_dec=None,marker_ra=None,marker_dec=None,marker_color='white',marker_lw=3,noisethresh=1,lofarlevel=2.0,first_color='lightgreen',drlimit=500,interactive_handler=None,peak=None): if lofarhdu is None: print 'LOFAR HDU is missing, not showing it' show_lofar=False try: from matplotlib.cbook import MatplotlibDeprecationWarning import warnings warnings.simplefilter('ignore', MatplotlibDeprecationWarning) except: print 'Cannot hide warnings' print '========== Doing overlay at',ra,dec,'with size',size,'===========' print '========== Title is',title,'==========' if coords_ra is None: coords_ra=ra coords_dec=dec if show_lofar: if peak is None: lofarmax=np.nanmax(lofarhdu[0].data) else: print 'Using user-specified peak flux of',peak lofarmax=peak if rms_use is None: rms_use=find_noise_area(lofarhdu,ra,dec,size)[1] print 'Using LOFAR rms',rms_use print lofarmax/drlimit,rms_use*lofarlevel minlevel=max([lofarmax/drlimit,rms_use*lofarlevel]) levels=minlevel*2.0**np.linspace(0,14,30) hdu=opthdu mean,noise,vmax=find_noise_area(hdu,ra,dec,size) print 'Optical parameters are',mean,noise,vmax f = aplpy.FITSFigure(hdu,north=True) print 'centring on',ra,dec,size f.recenter(ra,dec,width=size,height=size) f.show_colorscale(vmin=mean+noisethresh*noise,vmax=vmax,stretch='log') #f.show_colorscale(vmin=0,vmax=1e-3) #f.show_colorscale(vmin=0,vmax=1.0) if bmaj is not None: f._header['BMAJ']=bmaj f._header['BMIN']=bmin f._header['BPA']=bpa if show_lofar: f.show_contour(lofarhdu,colors='yellow',linewidths=lw, levels=levels) if firsthdu is not None: firstrms=find_noise_area(firsthdu,ra,dec,size)[1] print 'Using FIRST rms',firstrms firstlevels=firstrms*3*2.0**np.linspace(0,14,30) f.show_contour(firsthdu,colors=first_color,linewidths=lw, levels=firstlevels) if bmaj is not None: f.add_beam() f.beam.set_corner('bottom left') f.beam.set_edgecolor('red') f.beam.set_facecolor('white') if plot_coords: f.show_markers(coords_ra,coords_dec,marker='+',facecolor=coords_color,edgecolor=coords_color,linewidth=coords_lw,s=1500,zorder=100) if marker_ra is not None: f.show_markers(marker_ra,marker_dec,marker='x',facecolor=marker_color,edgecolor=marker_color,linewidth=marker_lw,s=1500,zorder=100) if plotpos is not None: if not isinstance(plotpos,list): plotpos=[(plotpos,'x'),] for t,marker in plotpos: if len(t)>0: f.show_markers(t['ra'],t['dec'],marker=marker,facecolor='white',edgecolor='white',linewidth=2,s=750) if circle_radius is not None: f.show_circles([ra,],[dec,],[circle_radius,],facecolor='none',edgecolor='cyan',linewidth=5) if overlay_cat is not None: t=overlay_cat if len(t)>0: f.show_ellipses(t['RA'],t['DEC'],t['Maj']*2/overlay_scale,t['Min']*2/overlay_scale,angle=90+t['PA'],edgecolor='red',linewidth=3,zorder=100) if overlay_region is not None: f.show_regions(overlay_region) if no_labels: f.axis_labels.hide() f.tick_labels.hide() if show_grid: f.add_grid() f.grid.show() f.grid.set_xspacing(1.0/60.0) f.grid.set_yspacing(1.0/60.0) if title is not None: plt.title(title) plt.tight_layout() if save_name is None: plt.show(block=block) else: plt.savefig(save_name) def onclick(event): xp=event.xdata yp=event.ydata xw,yw=f.pixel2world(xp,yp) if event.button==2: print title,xw,yw if interactive: fig=plt.gcf() if interactive_handler is None: cid = fig.canvas.mpl_connect('button_press_event', onclick) else: I=interactive_handler(f) fig.canvas.mpl_connect('button_press_event', I.onclick) return f
(xcenter, ycenter), (mincolor, maxcolor)): import os import aplpy import matplotlib as mpl import matplotlib.pyplot as plt lletter = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ] colors = ['red', 'blue', 'green', 'white'] ypanels = 1 xpanels = 1 wid = (xmax - xmin) * cellsize / 3600. hei = (ymax - ymin) * cellsize / 3600. fig = plt.figure(figsize=(10., 10. / wid * hei)) ff = aplpy.FITSFigure(imagein, figure=fig) ff.recenter(xcenter, ycenter, width=wid, height=hei) ff.set_theme('publication') ff.set_system_latex(True) ff.set_tick_labels_font(size='x-small') ff.set_axis_labels_font(size='small') ff.tick_labels.set_yformat('dd.d') ff.tick_labels.set_xformat('ddd.d') ff.show_colorscale(vmin=mincolor, vmax=maxcolor, cmap='gray', stretch='sqrt', interpolation='none') ff.add_colorbar() for c in range(len(maskin)): ff.show_contour(maskin[c], levels=1, colors=colors[c], linewidths=0.4)
#! /usr/bin/env python # non-interactive mode import matplotlib matplotlib.use('Agg') import aplpy #ff = 'IRC_79448.fits' ff = 'IRC_79448.wt.fits' f = aplpy.FITSFigure(ff,slices=[0]) f.set_title("IRC_79448") f.show_grayscale() f.show_colorscale(aspect='auto') f.show_contour(ff, colors='white', levels=[24.0], smooth=3) rpd = 57.2958 #f.show_circles(146.9892/rpd,13.27877/rpd,0.003993056/rpd) f.show_circles([48],[48],2,coords_frame='pixel') #f.add_beam() f.add_colorbar() f.set_nan_color('white') f.save('IRC_79448.wt.png')
# 1. An $r$-band DECaLS fits image of HCG 16. # 2. A combined $grz$ jpeg image from DECaLS covering exactly the same field. # # These files were downloaded directly from the [DECaLS public website](http://legacysurvey.org/). The exact parameters defining the region and pixel size of these images is contained in the [pipeline.yml](pipeline.yml) file. # # 3. Moment 0 and 1 maps of each candidate tidal dwarf galaxy. # # The moment 0 and 1 maps of the galaxies were generated in the *imaging* step of the workflow using CASA. The exact steps are included in the [imaging.py](casa/imaging.py) script. The masks used to make these moment maps were constructed manually using the [SlicerAstro](http://github.com/Punzo/SlicerAstro) software package. They were downloaded along with the raw data from the EUDAT service [B2SHARE](http://b2share.eudat.eu) at the beginnning of the workflow execution. The exact location of the data are given in the [pipeline.yml](pipeline.yml) file. # Make moment 0 contour overlays and moment 1 maps. # In[ ]: #Initialise figure using DECaLS r-band image f = aplpy.FITSFigure(r_image_decals,figsize=(6.,4.3),dimensions=[0,1]) #Display DECaLS grz image f.show_rgb(grz_image_decals) #Recentre and resize f.recenter(32.356, -10.125, radius=1.5/60.) #Overlay HI contours f.show_contour(data='NW_clump'+'_mom0th.fits',dimensions=[0,1],slices=[0], colors='lime',levels=numpy.arange(0.1,5.,0.05)) #Add grid lines f.add_grid() f.grid.set_color('black')
import os import numpy as np import matplotlib.pyplot as plt from astropy.io import fits import sys hdu1 = fits.open('mom1_12co_pix_2_Tmb.fits')[0] xcenter = 84. ycenter = -6. wid = 1.5 hei = 2.4 xpanels = 1 ypanels = 1 fig = plt.figure(figsize=(3 * xpanels * 1.1 * (wid / (wid + hei)) * 10., 3 * ypanels / 1.1 * (hei / (wid + hei)) * 10.)) ff = aplpy.FITSFigure(hdu1, figure=fig) ff.recenter(xcenter, ycenter, width=wid, height=hei) ff.set_theme('publication') #ff.set_system_latex(True) maxcolor = np.nanmax(hdu1.data) ff.show_colorscale(cmap='jet', vmin=5, vmax=13, stretch='linear') ff.show_regions('olay2.reg') #ff.show_contour(mask_hdu, levels=1, colors='yellow', linewidths=0.1) ff.add_colorbar() ff.colorbar.set_font(size=12) ff.colorbar.set_pad(0.5) ff.colorbar.set_axis_label_text('km s$^{-1}$') ff.colorbar.set_font(size=12) ff.set_tick_labels_font(size=12) ff.set_axis_labels_font(size=12) ff.add_scalebar(0.286, corner='bottom right',
peak = 1 histogram = 0 #hdu1 = fits.open('mask_regrid_peak_regrid_12CO_specsmooth.fits')[0] hdu1 = fits.open('subregion_mask_regrid_peak_regrid_12CO_specsmooth.fits')[0] if peak == 1: xcenter = 84 ycenter = -6 wid = 1.5 hei = 2.4 xpanels = 1 ypanels = 1 #fig=plt.figure(figsize=(5*xpanels*1.*(wid/(wid+hei))*10.,5*ypanels/1.1*(hei/(wid+hei))*10.)) #ff = aplpy.FITSFigure(hdu1, figure=fig) ff = aplpy.FITSFigure(hdu1) #ff.recenter(xcenter,ycenter,width=wid,height=hei) ff.set_theme('publication') ff.set_title('NRO45', fontsize=20) #ff.set_system_latex(True) maxcolor = np.nanmax(hdu1.data) ff.show_colorscale(cmap='gist_heat', vmin=0, vmax=maxcolor, stretch='sqrt') ff.axis_labels.hide() ff.tick_labels.hide() ff.ticks.hide() #ff.show_regions('olay.reg') #ff.show_contour(mask_hdu, levels=1, colors='yellow', linewidths=0.1) #ff.add_colorbar() #ff.colorbar.set_font(size=16) #ff.colorbar.set_pad(0.5) ff.set_tick_labels_font(size='large')