plotastrodata 1.4.12__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.12 → plotastrodata-1.4.14}/PKG-INFO +4 -2
  2. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/analysis_utils.py +26 -27
  4. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/plot_utils.py +2 -1
  5. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/PKG-INFO +4 -2
  6. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/LICENSE +0 -0
  7. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/README.md +0 -0
  8. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/const_utils.py +0 -0
  9. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/coord_utils.py +0 -0
  10. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/ext_utils.py +0 -0
  11. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/fft_utils.py +0 -0
  12. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/fits_utils.py +0 -0
  13. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/fitting_utils.py +0 -0
  14. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/los_utils.py +0 -0
  15. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/matrix_utils.py +0 -0
  16. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata/other_utils.py +0 -0
  17. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/SOURCES.txt +0 -0
  18. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/dependency_links.txt +0 -0
  19. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/not-zip-safe +0 -0
  20. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/requires.txt +0 -0
  21. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/plotastrodata.egg-info/top_level.txt +0 -0
  22. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/setup.cfg +0 -0
  23. {plotastrodata-1.4.12 → plotastrodata-1.4.14}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.4.12
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
@@ -23,6 +23,8 @@ Requires-Dist: ptemcee
23
23
  Requires-Dist: scikit-image
24
24
  Requires-Dist: scipy
25
25
  Requires-Dist: tqdm
26
+ Dynamic: download-url
27
+ Dynamic: license-file
26
28
 
27
29
  # plotastrodata
28
30
  Python package to make figures from radio astronomical data by astropy and matplotlib.
@@ -1,4 +1,4 @@
1
1
  import warnings
2
2
 
3
3
  warnings.simplefilter('ignore', UserWarning)
4
- __version__ = '1.4.12'
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.
@@ -255,7 +255,7 @@ class AstroData():
255
255
  """
256
256
  d = self.data if chan is None else self.data[chan]
257
257
  x, y = np.meshgrid(self.x, self.y)
258
- if None not in self.beam:
258
+ if None not in self.beam and None not in [self.dx, self.dy]:
259
259
  Omega = np.pi * self.beam[0] * self.beam[1] / 4 / np.log(2)
260
260
  pixelperbeam = Omega / np.abs(self.dx * self.dy)
261
261
  else:
@@ -394,9 +394,12 @@ class AstroData():
394
394
  prof[i] = [np.sum(d[r <= 1]) for d in data]
395
395
  else:
396
396
  prof[i] = [np.mean(d[r <= 1]) for d in data]
397
- if flux and (None not in self.beam):
398
- Omega = np.pi * self.beam[0] * self.beam[1] / 4. / np.log(2.)
399
- prof *= np.abs(self.dx * self.dy) / Omega
397
+ if flux:
398
+ if None in self.beam or None in [self.dx, self.dy]:
399
+ print('None in beam, dx, or dy. Flux is not converted.')
400
+ else:
401
+ Omega = np.pi * self.beam[0] * self.beam[1] / 4. / np.log(2.)
402
+ prof *= np.abs(self.dx * self.dy) / Omega
400
403
  gfitres = {}
401
404
  if gaussfit:
402
405
  xmin, xmax = np.min(v), np.max(v)
@@ -458,7 +461,7 @@ class AstroData():
458
461
  d = {'data': self.data, 'x': self.x, 'y': self.y, 'v': self.v,
459
462
  'fitsimage': self.fitsimage, 'beam': self.beam, 'Tb': self.Tb,
460
463
  'restfreq': self.restfreq, 'cfactor': self.cfactor,
461
- 'sigma': self.sigma, 'center': self.center}
464
+ 'sigma': self.sigma, 'center': self.center, 'pv': self.pv}
462
465
  return d
463
466
 
464
467
  def writetofits(self, fitsimage: str = 'out.fits', header: dict = {}):
@@ -470,7 +473,8 @@ class AstroData():
470
473
  """
471
474
  fhd = self.fitsheader
472
475
  h = {}
473
- 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)
474
478
  h['NAXIS1'] = len(self.x)
475
479
  h['CRPIX1'] = np.argmin(np.abs(self.x)) + 1
476
480
  h['CRVAL1'] = cx
@@ -670,21 +674,19 @@ class AstroFrame():
670
674
  d.beam[i] = fd.get_beam(dist=self.dist)
671
675
  d.bunit[i] = fd.get_header('BUNIT')
672
676
  if d.data[i] is not None:
673
- d.pv[i] = self.pv
674
677
  d.sigma_org[i] = d.sigma[i]
675
678
  d.sigma[i] = estimate_rms(d.data[i], d.sigma[i])
676
679
  d.data[i], grid = trim(data=d.data[i],
677
680
  x=grid[0], y=grid[1], v=grid[2],
678
681
  xlim=self.xlim, ylim=self.ylim,
679
682
  vlim=self.vlim, pv=self.pv)
680
- if grid[2] is not None and len(grid[2]) > 1 and grid[2][1] < grid[2][0]:
681
- 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]
682
687
  print('Velocity has been inverted.')
683
- d.v = grid[2]
684
- if d.v is not None and len(d.v) > 1:
685
- d.dv = d.v[1] - d.v[0]
686
- else:
687
- d.dv = None
688
+ d.v = v
689
+ d.dv = v[1] - v[0] if has_v else None
688
690
  grid = grid[:3:2] if self.pv else grid[:2]
689
691
  if self.swapxy:
690
692
  grid = [grid[1], grid[0]]
@@ -696,15 +698,11 @@ class AstroFrame():
696
698
  a = a[::yskip, ::xskip]
697
699
  a = np.moveaxis(a, [0, 1], [-2, -1])
698
700
  d.data[i] = a
699
- d.x, d.y = grid
700
- if d.x is not None and len(d.x) > 1:
701
- d.dx = d.x[1] - d.x[0]
702
- else:
703
- d.dx = None
704
- if d.y is not None and len(d.y) > 1:
705
- d.dy = d.y[1] - d.y[0]
706
- else:
707
- 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
708
706
  if self.quadrants is not None:
709
707
  d.data[i], d.x, d.y \
710
708
  = quadrantmean(d.data[i], d.x, d.y, self.quadrants)
@@ -721,14 +719,15 @@ class AstroFrame():
721
719
  header['BMIN'] = d.beam[i][1] / 3600 / self.dist
722
720
  d.data[i] = d.data[i] * Jy2K(header=header)
723
721
  d.sigma[i] = d.sigma[i] * Jy2K(header=header)
724
- 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]:
725
723
  bmaj, bmin, bpa = d.beam_org[i] = d.beam[i]
726
724
  if d.pvpa[i] is None:
727
- d.pvpa[i] = bmaj
728
- print('pvpa is not specified. pvpa=bmaj is assumed.')
725
+ d.pvpa[i] = bpa
726
+ print('pvpa is not specified. pvpa=bpa is assumed.')
729
727
  p = np.radians(bpa - d.pvpa[i])
730
728
  b = 1 / np.hypot(np.cos(p) / bmaj, np.sin(p) / bmin)
731
729
  d.beam[i] = np.array([np.abs(d.dv), b, 0])
730
+ d.pv[i] = self.pv
732
731
  d.Tb[i] = False
733
732
  d.cfactor[i] = 1
734
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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.4.12
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
@@ -23,6 +23,8 @@ Requires-Dist: ptemcee
23
23
  Requires-Dist: scikit-image
24
24
  Requires-Dist: scipy
25
25
  Requires-Dist: tqdm
26
+ Dynamic: download-url
27
+ Dynamic: license-file
26
28
 
27
29
  # plotastrodata
28
30
  Python package to make figures from radio astronomical data by astropy and matplotlib.
File without changes
File without changes
File without changes
File without changes