plotastrodata 1.4.13__tar.gz → 1.4.14__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.
Files changed (23) hide show
  1. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/PKG-INFO +1 -1
  2. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/analysis_utils.py +17 -21
  4. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/plot_utils.py +2 -1
  5. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/PKG-INFO +1 -1
  6. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/LICENSE +0 -0
  7. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/README.md +0 -0
  8. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/const_utils.py +0 -0
  9. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/coord_utils.py +0 -0
  10. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/ext_utils.py +0 -0
  11. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/fft_utils.py +0 -0
  12. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/fits_utils.py +0 -0
  13. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/fitting_utils.py +0 -0
  14. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/los_utils.py +0 -0
  15. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/matrix_utils.py +0 -0
  16. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata/other_utils.py +0 -0
  17. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/SOURCES.txt +0 -0
  18. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/dependency_links.txt +0 -0
  19. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/not-zip-safe +0 -0
  20. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/requires.txt +0 -0
  21. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/plotastrodata.egg-info/top_level.txt +0 -0
  22. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/setup.cfg +0 -0
  23. {plotastrodata-1.4.13 → plotastrodata-1.4.14}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.4.13
3
+ Version: 1.4.14
4
4
  Summary: plotastrodata is a tool for astronomers to create figures from FITS files and perform fundamental data analyses with ease.
5
5
  Home-page: https://github.com/yusukeaso-astron/plotastrodata
6
6
  Download-URL: https://github.com/yusukeaso-astron/plotastrodata
@@ -1,4 +1,4 @@
1
1
  import warnings
2
2
 
3
3
  warnings.simplefilter('ignore', UserWarning)
4
- __version__ = '1.4.13'
4
+ __version__ = '1.4.14'
@@ -97,6 +97,7 @@ class AstroData():
97
97
  restfreq: float | None = None
98
98
  cfactor: float = 1
99
99
  pvpa: float | None = None
100
+ pv: bool = False
100
101
 
101
102
  def __post_init__(self):
102
103
  n = 0
@@ -124,7 +125,6 @@ class AstroData():
124
125
  self.sigma_org = None
125
126
  self.beam_org = None
126
127
  self.fitsheader = None
127
- self.pv = False
128
128
 
129
129
  def binning(self, width: list[int, int, int] = [1, 1, 1]):
130
130
  """Binning up neighboring pixels in the v, y, and x domain.
@@ -461,7 +461,7 @@ class AstroData():
461
461
  d = {'data': self.data, 'x': self.x, 'y': self.y, 'v': self.v,
462
462
  'fitsimage': self.fitsimage, 'beam': self.beam, 'Tb': self.Tb,
463
463
  'restfreq': self.restfreq, 'cfactor': self.cfactor,
464
- 'sigma': self.sigma, 'center': self.center}
464
+ 'sigma': self.sigma, 'center': self.center, 'pv': self.pv}
465
465
  return d
466
466
 
467
467
  def writetofits(self, fitsimage: str = 'out.fits', header: dict = {}):
@@ -473,7 +473,8 @@ class AstroData():
473
473
  """
474
474
  fhd = self.fitsheader
475
475
  h = {}
476
- cx, cy = (0, 0) if self.pv or self.center is None else coord2xy(self.center)
476
+ nocent = self.pv or self.center is None
477
+ cx, cy = (0, 0) if nocent else coord2xy(self.center)
477
478
  h['NAXIS1'] = len(self.x)
478
479
  h['CRPIX1'] = np.argmin(np.abs(self.x)) + 1
479
480
  h['CRVAL1'] = cx
@@ -673,21 +674,19 @@ class AstroFrame():
673
674
  d.beam[i] = fd.get_beam(dist=self.dist)
674
675
  d.bunit[i] = fd.get_header('BUNIT')
675
676
  if d.data[i] is not None:
676
- d.pv[i] = self.pv
677
677
  d.sigma_org[i] = d.sigma[i]
678
678
  d.sigma[i] = estimate_rms(d.data[i], d.sigma[i])
679
679
  d.data[i], grid = trim(data=d.data[i],
680
680
  x=grid[0], y=grid[1], v=grid[2],
681
681
  xlim=self.xlim, ylim=self.ylim,
682
682
  vlim=self.vlim, pv=self.pv)
683
- if grid[2] is not None and len(grid[2]) > 1 and grid[2][1] < grid[2][0]:
684
- d.data[i], grid[2] = d.data[i][::-1], grid[2][::-1]
683
+ v = grid[2]
684
+ has_v = v is not None and len(v) > 1
685
+ if has_v and v[1] < v[0]:
686
+ d.data[i], v = d.data[i][::-1], v[::-1]
685
687
  print('Velocity has been inverted.')
686
- d.v = grid[2]
687
- if d.v is not None and len(d.v) > 1:
688
- d.dv = d.v[1] - d.v[0]
689
- else:
690
- d.dv = None
688
+ d.v = v
689
+ d.dv = v[1] - v[0] if has_v else None
691
690
  grid = grid[:3:2] if self.pv else grid[:2]
692
691
  if self.swapxy:
693
692
  grid = [grid[1], grid[0]]
@@ -699,15 +698,11 @@ class AstroFrame():
699
698
  a = a[::yskip, ::xskip]
700
699
  a = np.moveaxis(a, [0, 1], [-2, -1])
701
700
  d.data[i] = a
702
- d.x, d.y = grid
703
- if d.x is not None and len(d.x) > 1:
704
- d.dx = d.x[1] - d.x[0]
705
- else:
706
- d.dx = None
707
- if d.y is not None and len(d.y) > 1:
708
- d.dy = d.y[1] - d.y[0]
709
- else:
710
- d.dy = None
701
+ x, y = d.x, d.y = grid
702
+ has_x = x is not None and len(x) > 1
703
+ d.dx = x[1] - x[0] if has_x else None
704
+ has_y = y is not None and len(y) > 1
705
+ d.dy = y[1] - y[0] if has_y else None
711
706
  if self.quadrants is not None:
712
707
  d.data[i], d.x, d.y \
713
708
  = quadrantmean(d.data[i], d.x, d.y, self.quadrants)
@@ -724,7 +719,7 @@ class AstroFrame():
724
719
  header['BMIN'] = d.beam[i][1] / 3600 / self.dist
725
720
  d.data[i] = d.data[i] * Jy2K(header=header)
726
721
  d.sigma[i] = d.sigma[i] * Jy2K(header=header)
727
- if self.pv and None not in d.beam[i]:
722
+ if self.pv and not d.pv[i] and None not in d.beam[i]:
728
723
  bmaj, bmin, bpa = d.beam_org[i] = d.beam[i]
729
724
  if d.pvpa[i] is None:
730
725
  d.pvpa[i] = bpa
@@ -732,6 +727,7 @@ class AstroFrame():
732
727
  p = np.radians(bpa - d.pvpa[i])
733
728
  b = 1 / np.hypot(np.cos(p) / bmaj, np.sin(p) / bmin)
734
729
  d.beam[i] = np.array([np.abs(d.dv), b, 0])
730
+ d.pv[i] = self.pv
735
731
  d.Tb[i] = False
736
732
  d.cfactor[i] = 1
737
733
  if d.fitsimage[i] is not None:
@@ -686,7 +686,8 @@ class PlotAstroData(AstroFrame):
686
686
  cbticklabels (list, optional): Ticklabels of colorbar. Defaults to None.
687
687
  cblocation (str, optional): 'left', 'top', 'left', 'right'. Only for 2D images. Defaults to 'right'.
688
688
  """
689
- _kw = {'cmap': 'cubehelix', 'alpha': 1, 'edgecolors': 'none', 'zorder': 1}
689
+ _kw = {'cmap': 'cubehelix', 'alpha': 1,
690
+ 'edgecolors': 'none', 'zorder': 1}
690
691
  beam_kwargs = kwargs2beamargs(kwargs)
691
692
  _kw.update(kwargs)
692
693
  d = kwargs2AstroData(_kw)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.4.13
3
+ Version: 1.4.14
4
4
  Summary: plotastrodata is a tool for astronomers to create figures from FITS files and perform fundamental data analyses with ease.
5
5
  Home-page: https://github.com/yusukeaso-astron/plotastrodata
6
6
  Download-URL: https://github.com/yusukeaso-astron/plotastrodata
File without changes
File without changes
File without changes
File without changes