pymakeplots 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymakeplots
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Home-page: https://github.com/TimothyADavis/pymakeplots
5
5
  Author: Timothy A. Davis
6
6
  Author-email: DavisT@cardiff.ac.uk
@@ -9,11 +9,11 @@ import matplotlib.pyplot as plt
9
9
  import matplotlib
10
10
  from pymakeplots.sauron_colormap import sauron
11
11
  from mpl_toolkits.axes_grid1 import make_axes_locatable
12
- from matplotlib.patches import Ellipse,Rectangle
12
+ from matplotlib.patches import Ellipse,Rectangle, Arrow
13
13
  from matplotlib import cm
14
14
  from matplotlib.colors import ListedColormap, LinearSegmentedColormap
15
15
  from matplotlib.offsetbox import AnchoredText,AuxTransformBox, AnchoredOffsetbox
16
- from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
16
+ from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar,AnchoredDirectionArrows
17
17
  from astropy.coordinates import ICRS
18
18
  import matplotlib.gridspec as gridspec
19
19
  from astropy.table import Table
@@ -40,7 +40,7 @@ def rotateImage(img, angle, pivot):
40
40
 
41
41
 
42
42
  class pymakeplots:
43
- def __init__(self,cube_flat=None,pb=None,cube=None,rest_value=None):
43
+ def __init__(self,cube_flat=None,pb=None,cube=None,rest_value=None,velocity_convention='radio',rotate=None):
44
44
  self.galname=None
45
45
  self.gal_distance=None
46
46
  self.posang=None
@@ -58,6 +58,8 @@ class pymakeplots:
58
58
  self.pbcorr_cube_trim=None
59
59
  self.mask_trim=None
60
60
  self.bmaj=None
61
+ self.rotate=rotate
62
+ self.smoothmask_spatial=1.5
61
63
  self.bmin=None
62
64
  self.bpa=None
63
65
  self.xcoord,self.ycoord,self.vcoord = None, None, None
@@ -67,6 +69,7 @@ class pymakeplots:
67
69
  self.silent=False # rig for silent running if true
68
70
  self.bardist=None
69
71
  self.rmsfac=3
72
+ self.velocity_convention=velocity_convention
70
73
  self.restfreq=None
71
74
  self.repfreq=None
72
75
  self.obj_ra=None
@@ -91,6 +94,8 @@ class pymakeplots:
91
94
  self.make_square=True
92
95
  self.useallpixels = False
93
96
  self.suppress_subbeam_artifacts=False
97
+ self.mom1_cmap=sauron
98
+ self.mom2_cmap=sauron
94
99
  #self.wcs=None
95
100
 
96
101
  if (cube != None)&(pb==None)&(cube_flat==None):
@@ -103,7 +108,7 @@ class pymakeplots:
103
108
 
104
109
  if (cube_flat != None)&(pb!=None):
105
110
  # flat cube and pb given
106
- if np.any(self.pbcorr_cube) == None: #check if the user gave all three cubes, in which case this call is redundant
111
+ if np.any(self.pbcorr_cube == None): #check if the user gave all three cubes, in which case this call is redundant
107
112
  self.input_cube_flat(cube_flat,pb,rest_value=rest_value)
108
113
 
109
114
  if (cube != None)&(pb==None)&(cube_flat!=None):
@@ -177,7 +182,7 @@ class pymakeplots:
177
182
  Apply a Gaussian blur, using sigma = 4 in the velocity direction (seems to work best), to the uncorrected cube.
178
183
  :return: (ndarray) mask to apply to the un-clipped cube
179
184
  """
180
- sigma = 1.5 * self.bmaj / self.cellsize
185
+ sigma = self.smoothmask_spatial * self.bmaj / self.cellsize
181
186
  smooth_cube = ndimage.uniform_filter(cube, size=[sigma, sigma,4], mode='constant') # mode='nearest'
182
187
  newrms= self.rms_estimate(smooth_cube,0,1)
183
188
  self.cliplevel=self.rms*self.rmsfac
@@ -320,21 +325,43 @@ class pymakeplots:
320
325
  def get_header_coord_arrays(self,hdr):
321
326
 
322
327
 
323
- cd1=self.spectralcube.wcs.pixel_scale_matrix[0,0]*3600
324
- cd2=self.spectralcube.wcs.pixel_scale_matrix[1,1]*3600
325
- x1=((np.arange(1,hdr['NAXIS1']+1)-(hdr['NAXIS1']//2))*cd1)# + hdr['CRVAL1']
328
+ cd1=self.spectralcube.header['CDELT1']*3600.
329
+ cd2=self.spectralcube.header['CDELT2']*3600.
330
+ x1=((np.arange(1,hdr['NAXIS1']+1)-(hdr['NAXIS1']//2))*(cd1))# + hdr['CRVAL1']
326
331
  y1=((np.arange(1,hdr['NAXIS2']+1)-(hdr['NAXIS1']//2))*cd2)# + hdr['CRVAL2']
327
332
 
328
333
  v1=self.spectralcube.spectral_axis.value
329
334
 
330
335
  cd3= np.median(np.diff(v1))
331
-
336
+ #breakpoint()
332
337
 
333
338
  return x1,y1,v1,np.abs(cd1),cd3
334
339
 
335
340
  def read_in_a_cube(self,path,rest_value=None,primary=False):
336
341
 
337
- scube=SpectralCube.read(path).with_spectral_unit(u.km/u.s, velocity_convention='radio',rest_value=rest_value)
342
+ if self.rotate !=None:
343
+ try:
344
+ h=fits.getheader(path.split('.fits')[0]+'_rotated.fits')
345
+ if float(h['ROTANGLE']) == self.rotate:
346
+ path=path.split('.fits')[0]+'_rotated.fits'
347
+ alreadyrotated=True
348
+ else:
349
+ alreadyrotated=False
350
+ except:
351
+ alreadyrotated=False
352
+
353
+
354
+ scube=SpectralCube.read(path).with_spectral_unit(u.km/u.s, velocity_convention=self.velocity_convention,rest_value=rest_value)
355
+
356
+ hdr=scube.header
357
+
358
+ if self.rotate !=None:
359
+ if alreadyrotated == False:
360
+ hdr['CROTA2']=self.rotate
361
+ hdr['CROTA3']=0
362
+ scube=scube.reproject(hdr)
363
+ scube.meta['ROTANGLE']=self.rotate
364
+ scube.write(path.split('.fits')[0]+'_rotated.fits',overwrite=True)
338
365
 
339
366
  hdr=scube.header
340
367
  cube = np.squeeze(scube.filled_data[:,:,:].T).value #squeeze to remove singular stokes axis if present
@@ -394,7 +421,6 @@ class pymakeplots:
394
421
  return xpix,ypix,xoffsetarc,yoffsetarc
395
422
 
396
423
  def prepare_cubes(self):
397
-
398
424
  self.centskycoord=self.spectralcube.wcs.celestial.pixel_to_world(self.xcoord.size//2,self.ycoord.size//2).transform_to('icrs')
399
425
  self.x_skycent=self.centskycoord.ra.value
400
426
  self.y_skycent=self.centskycoord.dec.value
@@ -413,10 +439,10 @@ class pymakeplots:
413
439
  pointingposes=SkyCoord(self.pointingsra,self.pointingsdec,frame='icrs',unit=(u.hourangle,u.deg))
414
440
  _,_,pointoffsetx,pointoffsety=self.calc_offset(pointingposes.ra,pointingposes.dec)
415
441
  self.points2plot=np.zeros((len(pointoffsetx),3))
416
- self.points2plot[:,0]=pointoffsetx-xoffsetarc
442
+ self.points2plot[:,0]=-pointoffsetx+xoffsetarc
417
443
  self.points2plot[:,1]=pointoffsety-yoffsetarc
418
444
  self.points2plot[:,2]=self.pointingsdiam.value
419
-
445
+ #breakpoint()
420
446
  self.clip_cube(xoffsetarc,yoffsetarc)
421
447
 
422
448
  self.mask_trim=self.smooth_mask(self.flat_cube_trim)
@@ -519,14 +545,14 @@ class pymakeplots:
519
545
  def make_moments(self,axes=None,mom=[0,1,2],pdf=False,fits=False):
520
546
  mom=np.array(mom)
521
547
  self.fits=fits
522
-
523
- if np.any(self.xc) == None:
548
+
549
+ if np.any(self.xc == None):
524
550
  self.prepare_cubes()
525
551
 
526
552
  self.set_rc_params()
527
553
 
528
554
  nplots=mom.size
529
- if np.any(axes) == None:
555
+ if np.any(axes == None):
530
556
  if self.make_square:
531
557
  fig,axes=plt.subplots(1,nplots,sharey=True,figsize=(7*nplots,7), gridspec_kw = {'wspace':0, 'hspace':0})
532
558
  else:
@@ -561,7 +587,7 @@ class pymakeplots:
561
587
  plt.show()
562
588
  plt.close()
563
589
 
564
- def scalebar(self,ax,loc='lower right'):
590
+ def scalebarlength(self):
565
591
  barlength_pc = np.ceil((np.abs(self.xc[-1]-self.xc[0])*4.84*self.gal_distance)/1000.)*100
566
592
  barlength_arc= barlength_pc/(4.84*self.gal_distance)
567
593
 
@@ -574,7 +600,11 @@ class pymakeplots:
574
600
  barlength_arc= barlength_pc/(4.84*self.gal_distance)
575
601
 
576
602
 
603
+ return barlength_arc,barlength_pc
604
+
605
+ def scalebar(self,ax,loc='lower right'):
577
606
 
607
+ barlength_arc,barlength_pc=self.scalebarlength()
578
608
  if np.log10(barlength_pc) > 3:
579
609
  label=(barlength_pc/1e3).astype(str)+ " kpc"
580
610
  else:
@@ -589,9 +619,6 @@ class pymakeplots:
589
619
 
590
620
  def clip_cube(self,xoffsetarc,yoffsetarc):
591
621
 
592
- #
593
-
594
-
595
622
 
596
623
  if np.any(self.chans2do == None):
597
624
 
@@ -619,7 +646,6 @@ class pymakeplots:
619
646
  if np.array(self.imagesize).size == 1:
620
647
  self.imagesize=[self.imagesize,self.imagesize]
621
648
 
622
-
623
649
  wx,=np.where(np.abs(self.xcoord-xoffsetarc) <= self.imagesize[0])
624
650
  wy,=np.where(np.abs(self.ycoord-yoffsetarc) <= self.imagesize[1])
625
651
  self.spatial_trim=[np.min(wx),np.max(wx),np.min(wy),np.max(wy)]
@@ -688,8 +714,67 @@ class pymakeplots:
688
714
  ax.add_artist(box)
689
715
 
690
716
 
691
-
717
+ def add_axis_labels(self,ax1,first=True):
718
+ if self.rotate !=None:
719
+ self._xlab='Offset'
720
+ self._ylab='Offset'
721
+ else:
722
+ self._xlab='RA Offset'
723
+ self._ylab='Dec Offset'
724
+
725
+ if self.all_axes_physical:
726
+ ax1.set_xlabel(self._xlab+' (kpc)')
727
+ if first: ax1.set_ylabel(self._ylab+' (kpc)')
728
+ else:
729
+ ax1.set_xlabel(self._xlab+' (")')
730
+ if first: ax1.set_ylabel(self._ylab+' (")')
731
+
732
+ def add_arrow(self,ax,first=True,last=True):
733
+ if first and last:
734
+ loc='upper right'
735
+ else:
736
+ loc="lower right"
737
+ # if self.all_axes_physical:
738
+ # length2use=self.ang2kpctrans(self.bmaj)
739
+ # else:
740
+ # length2use=self.bmaj
741
+ #
742
+ # rotated_arrow = AnchoredDirectionArrows(
743
+ # ax.transData,
744
+ # 'Dec', 'RA',
745
+ # loc=loc,
746
+ # length=-0.1,#length2use*2,
747
+ # aspect_ratio=-1,
748
+ # color='k',
749
+ # text_props={'ec': 'k', 'fc': 'k'},
750
+ # angle=self.rotate,
751
+ # )
752
+ # ax.add_artist(rotated_arrow)
692
753
 
754
+
755
+ aux_tr_box = AuxTransformBox(ax.transData)
756
+ barlength_arc,barlength_pc=self.scalebarlength()
757
+ if self.all_axes_physical:
758
+ length2use=self.ang2kpctrans(barlength_arc)
759
+ else:
760
+ length2use=barlength_arc
761
+
762
+ rotmat=np.array([[np.cos(np.deg2rad(self.rotate)),-np.sin(np.deg2rad(self.rotate))],[np.sin(np.deg2rad(self.rotate)),np.cos(np.deg2rad(self.rotate))]])
763
+ dx1,dx2=np.dot(rotmat,np.array([0,length2use]))
764
+ aux_tr_box.add_artist(Arrow(0, 0,dx1,dx2,color='k'))
765
+ box = AnchoredOffsetbox(child=aux_tr_box, loc=loc, frameon=False)
766
+ ax.add_artist(box)
767
+ #ax.text(3, y + 0.05, bracketstyle, ha="center", va="bottom", fontsize=14)
768
+
769
+ def add_second_axis(self,ax1):
770
+ if np.log10(self.ang2pctrans(np.max([np.max(self.xc),np.max(self.yc)]))) > 3:
771
+ secax = ax1.secondary_yaxis('right', functions=(self.ang2kpctrans, self.ang2kpctrans_inv))
772
+ secax.set_ylabel(self._ylab+' (kpc)')
773
+ else:
774
+ secax = ax1.secondary_yaxis('right', functions=(self.ang2pctrans, self.ang2pctrans_inv))
775
+ secax.set_ylabel(self._ylab+' (pc)')
776
+
777
+
693
778
  def mom0(self,ax1,first=True,last=True):
694
779
  mom0=(self.pbcorr_cube_trim*self.mask_trim).sum(axis=2)*self.dv
695
780
 
@@ -712,17 +797,10 @@ class pymakeplots:
712
797
  #breakpoint()
713
798
  im1=ax1.contourf(self.xc,self.yc,mom0.T,levels=levs,cmap=newcmp)
714
799
  #im1=ax1.pcolormesh(self.xc,self.yc,mom0.T,cmap=newcmp,vmin=minmom0,vmax=maxmom0)
715
-
716
- if self.all_axes_physical:
717
- ax1.set_xlabel('RA offset (kpc)')
718
- if first: ax1.set_ylabel('Dec offset (kpc)')
719
- else:
720
- ax1.set_xlabel('RA offset (")')
721
- if first: ax1.set_ylabel('Dec offset (")')
722
-
723
800
 
801
+
802
+ self.add_axis_labels(ax1,first=first)
724
803
 
725
-
726
804
 
727
805
  if maxmom0 > 0:
728
806
  vticks=np.linspace(0,(np.round((maxmom0 / 10**np.floor(np.log10(maxmom0))))*10**np.floor(np.log10(maxmom0))),4)
@@ -738,6 +816,8 @@ class pymakeplots:
738
816
 
739
817
 
740
818
  self.add_beam(ax1)
819
+ if self.rotate != None and first:
820
+ self.add_arrow(ax1,first=first,last=last)
741
821
 
742
822
  if np.any(self.points2plot != None):
743
823
  naca=0
@@ -764,15 +844,14 @@ class pymakeplots:
764
844
  if self.make_square:
765
845
  ax1.set_xlim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
766
846
  ax1.set_ylim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
847
+ else:
848
+ ax1.set_xlim(self.xc[0],self.xc[-1])
849
+ ax1.set_ylim(self.yc[0],self.yc[-1])
767
850
  ax1.set_aspect('equal')
768
851
 
852
+
769
853
  if last and not self.all_axes_physical:
770
- if np.log10(self.ang2pctrans(np.max([np.max(self.xc),np.max(self.yc)]))) > 3:
771
- secax = ax1.secondary_yaxis('right', functions=(self.ang2kpctrans, self.ang2kpctrans_inv))
772
- secax.set_ylabel(r'Dec offset (kpc)')
773
- else:
774
- secax = ax1.secondary_yaxis('right', functions=(self.ang2pctrans, self.ang2pctrans_inv))
775
- secax.set_ylabel(r'Dec offset (pc)')
854
+ self.add_second_axis(ax1)
776
855
 
777
856
 
778
857
  if self.fits:
@@ -788,14 +867,9 @@ class pymakeplots:
788
867
 
789
868
  vticks=np.linspace((-1)*np.ceil(np.max(np.abs(self.vcoord_trim-self.vsys))/10.)*10.,np.ceil(np.max(np.abs(self.vcoord_trim-self.vsys))/10.)*10.,5)
790
869
 
791
- im1=ax1.contourf(self.xc,self.yc,mom1.T-self.vsys,levels=self.vcoord_trim-self.vsys,cmap=sauron,vmin=vticks[0],vmax=vticks[-1])
870
+ im1=ax1.contourf(self.xc,self.yc,mom1.T-self.vsys,levels=self.vcoord_trim-self.vsys,cmap=self.mom1_cmap,vmin=vticks[0],vmax=vticks[-1])
792
871
 
793
- if self.all_axes_physical:
794
- ax1.set_xlabel('RA offset (kpc)')
795
- if first: ax1.set_ylabel('Dec offset (kpc)')
796
- else:
797
- ax1.set_xlabel('RA offset (")')
798
- if first: ax1.set_ylabel('Dec offset (")')
872
+ self.add_axis_labels(ax1,first=first)
799
873
 
800
874
 
801
875
  cb=self.colorbar(im1,ticks=vticks)
@@ -806,14 +880,15 @@ class pymakeplots:
806
880
  if self.make_square:
807
881
  ax1.set_xlim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
808
882
  ax1.set_ylim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
809
-
883
+ else:
884
+ ax1.set_xlim(self.xc[0],self.xc[-1])
885
+ ax1.set_ylim(self.yc[0],self.yc[-1])
886
+
887
+ if self.rotate != None and first:
888
+ self.add_arrow(ax1,first=first,last=last)
889
+
810
890
  if last and not self.all_axes_physical:
811
- if np.log10(self.ang2pctrans(np.max([np.max(self.xc),np.max(self.yc)]))) > 3:
812
- secax = ax1.secondary_yaxis('right', functions=(self.ang2kpctrans, self.ang2kpctrans_inv))
813
- secax.set_ylabel(r'Dec offset (kpc)')
814
- else:
815
- secax = ax1.secondary_yaxis('right', functions=(self.ang2pctrans, self.ang2pctrans_inv))
816
- secax.set_ylabel(r'Dec offset (pc)')
891
+ self.add_second_axis(ax1)
817
892
 
818
893
  if self.fits:
819
894
  self.write_fits(mom1.T,1)
@@ -838,14 +913,9 @@ class pymakeplots:
838
913
  self.maxvdisp=50.
839
914
  #breakpoint()
840
915
  mom2levs=np.linspace(0,self.maxvdisp,10)
841
- im1=ax1.contourf(self.xc,self.yc,mom2.T,levels=mom2levs,cmap=sauron,vmax=self.maxvdisp)
916
+ im1=ax1.contourf(self.xc,self.yc,mom2.T,levels=mom2levs,cmap=self.mom2_cmap,vmax=self.maxvdisp)
842
917
 
843
- if self.all_axes_physical:
844
- ax1.set_xlabel('RA offset (kpc)')
845
- if first: ax1.set_ylabel('Dec offset (kpc)')
846
- else:
847
- ax1.set_xlabel('RA offset (")')
848
- if first: ax1.set_ylabel('Dec offset (")')
918
+ self.add_axis_labels(ax1,first=first)
849
919
 
850
920
  if self.maxvdisp < 50:
851
921
  dvticks=10
@@ -866,14 +936,15 @@ class pymakeplots:
866
936
  if self.make_square:
867
937
  ax1.set_xlim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
868
938
  ax1.set_ylim(np.min([self.xc[0],self.yc[0]]),np.max([self.xc[-1],self.yc[-1]]))
939
+ else:
940
+ ax1.set_xlim(self.xc[0],self.xc[-1])
941
+ ax1.set_ylim(self.yc[0],self.yc[-1])
869
942
 
943
+ if self.rotate != None and first:
944
+ self.add_arrow(ax1,first=first,last=last)
945
+
870
946
  if last and not self.all_axes_physical:
871
- if np.log10(self.ang2pctrans(np.max([np.max(self.xc),np.max(self.yc)]))) > 3.3:
872
- secax = ax1.secondary_yaxis('right', functions=(self.ang2kpctrans, self.ang2kpctrans_inv))
873
- secax.set_ylabel(r'Dec offset (kpc)')
874
- else:
875
- secax = ax1.secondary_yaxis('right', functions=(self.ang2pctrans, self.ang2pctrans_inv))
876
- secax.set_ylabel(r'Dec offset (pc)',rotation=270,labelpad=10)
947
+ self.add_second_axis(ax1)
877
948
 
878
949
 
879
950
  if self.fits:
@@ -897,6 +968,12 @@ class pymakeplots:
897
968
  newhdu.header['CRPIX2']=self.spectralcube.header['CRPIX2']
898
969
  newhdu.header['CRVAL2']=self.spectralcube.header['CRVAL2']
899
970
  newhdu.header['CDELT2']=self.spectralcube.header['CDELT2']
971
+ if self.rotate!=None:
972
+ newhdu.header['PC1_1']=self.spectralcube.header['PC1_1']
973
+ newhdu.header['PC1_2']=self.spectralcube.header['PC1_2']
974
+ newhdu.header['PC2_1']=self.spectralcube.header['PC2_1']
975
+ newhdu.header['PC2_2']=self.spectralcube.header['PC2_2']
976
+
900
977
  try:
901
978
  newhdu.header['PV2_1']=self.spectralcube.header['PV2_1']
902
979
  newhdu.header['PV2_2']=self.spectralcube.header['PV2_2']
@@ -968,10 +1045,10 @@ class pymakeplots:
968
1045
 
969
1046
  def make_pvd(self,axes=None,fits=False,pdf=False):
970
1047
  self.fits=fits
971
- if np.any(self.xc) == None:
1048
+ if np.any(self.xc == None):
972
1049
  self.prepare_cubes()
973
1050
 
974
- if np.any(axes) == None:
1051
+ if np.any(axes == None):
975
1052
  self.set_rc_params(mult=0.75)
976
1053
  fig,axes=plt.subplots(1,figsize=(7,5))
977
1054
  outsideaxis=0
@@ -1123,8 +1200,8 @@ class pymakeplots:
1123
1200
  anchored_text = AnchoredText("PA: "+str(round(self.posang,1))+'$^{\\circ}$', loc=loc1,frameon=False)
1124
1201
  axes.add_artist(anchored_text)
1125
1202
 
1126
- if self.gal_distance != None and not self.all_axes_physical:
1127
- self.scalebar(axes,loc=loc2)
1203
+ #if self.gal_distance != None and not self.all_axes_physical:
1204
+ # self.scalebar(axes,loc=loc2)
1128
1205
 
1129
1206
  if self.fits:
1130
1207
  self.write_pvd_fits(pvdaxis,vaxis,pvd.T)
@@ -1137,19 +1214,25 @@ class pymakeplots:
1137
1214
 
1138
1215
  def make_spec(self,axes=None,fits=False,pdf=False,onlydata=False,nsum=False,highlight=False):
1139
1216
  self.fits=fits
1140
- if np.any(self.xc) == None:
1217
+ if np.any(self.xc == None):
1141
1218
  self.prepare_cubes()
1142
1219
 
1143
- if axes == None:
1220
+ if np.any(axes == None):
1144
1221
  self.set_rc_params(mult=0.75)
1145
1222
  fig,axes=plt.subplots(1,figsize=(7,5))
1146
1223
  outsideaxis=0
1147
1224
  else:
1148
1225
  outsideaxis=1
1149
- spec=self.pbcorr_cube[self.spatial_trim[0]:self.spatial_trim[1],self.spatial_trim[2]:self.spatial_trim[3],:].sum(axis=0).sum(axis=0)
1226
+ #spec=self.pbcorr_cube[self.spatial_trim[0]:self.spatial_trim[1],self.spatial_trim[2]:self.spatial_trim[3],:].sum(axis=0).sum(axis=0)
1227
+
1228
+ mask2d=self.mask_trim.sum(axis=2).reshape((self.mask_trim.shape[0],self.mask_trim.shape[1],1)).astype(bool)
1229
+ mask2d=ndimage.binary_dilation(mask2d,iterations=2)
1230
+ spec=(self.pbcorr_cube[self.spatial_trim[0]:self.spatial_trim[1],self.spatial_trim[2]:self.spatial_trim[3],:]*mask2d).sum(axis=0).sum(axis=0)
1231
+
1232
+
1150
1233
  spec_mask=(self.pbcorr_cube_trim*self.mask_trim).sum(axis=0).sum(axis=0)
1151
1234
  ylab="Unknown"
1152
- #breakpoint()
1235
+
1153
1236
  if (''.join(self.bunit.split())).lower() == "Jy/beam".lower():
1154
1237
 
1155
1238
  spec*=1/self.beam_area()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymakeplots
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Home-page: https://github.com/TimothyADavis/pymakeplots
5
5
  Author: Timothy A. Davis
6
6
  Author-email: DavisT@cardiff.ac.uk
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
 
7
7
  setup(name='pymakeplots',
8
- version='0.2.2',
8
+ version='0.2.4',
9
9
  description='',
10
10
  url='https://github.com/TimothyADavis/pymakeplots',
11
11
  author='Timothy A. Davis',
File without changes
File without changes
File without changes