plotastrodata 1.7.4__tar.gz → 1.7.6__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 (24) hide show
  1. plotastrodata-1.7.6/MANIFEST.in +6 -0
  2. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/PKG-INFO +1 -1
  3. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/__init__.py +1 -1
  4. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/analysis_utils.py +38 -30
  5. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/fits_utils.py +2 -0
  6. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/PKG-INFO +1 -1
  7. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/SOURCES.txt +1 -0
  8. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/LICENSE +0 -0
  9. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/README.md +0 -0
  10. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/const_utils.py +0 -0
  11. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/coord_utils.py +0 -0
  12. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/ext_utils.py +0 -0
  13. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/fft_utils.py +0 -0
  14. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/fitting_utils.py +0 -0
  15. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/los_utils.py +0 -0
  16. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/matrix_utils.py +0 -0
  17. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/other_utils.py +0 -0
  18. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata/plot_utils.py +0 -0
  19. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/dependency_links.txt +0 -0
  20. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/not-zip-safe +0 -0
  21. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/requires.txt +0 -0
  22. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/plotastrodata.egg-info/top_level.txt +0 -0
  23. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/setup.cfg +0 -0
  24. {plotastrodata-1.7.4 → plotastrodata-1.7.6}/setup.py +0 -0
@@ -0,0 +1,6 @@
1
+ global-exclude .DS_Store
2
+ global-exclude */.DS_Store
3
+ global-exclude __pycache__
4
+ global-exclude *.pyc
5
+ global-exclude *.pyo
6
+ global-exclude *.swp
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.4
3
+ Version: 1.7.6
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', FutureWarning)
4
- __version__ = '1.7.4'
4
+ __version__ = '1.7.6'
@@ -524,7 +524,8 @@ class AstroData():
524
524
  return d
525
525
 
526
526
  @_need_multipixels
527
- def writetofits(self, fitsimage: str = 'out.fits', header: dict = {}):
527
+ def writetofits(self, fitsimage: str = 'out.fits',
528
+ header: dict = {}) -> None:
528
529
  """Write out the AstroData to a FITS file.
529
530
 
530
531
  Args:
@@ -533,43 +534,50 @@ class AstroData():
533
534
  """
534
535
  fhd = self.fitsheader
535
536
  h = {}
536
- nocent = self.pv or self.center is None
537
537
  ci = np.argmin(np.abs(self.x))
538
- cj = np.argmin(np.abs(self.y))
539
- if nocent:
540
- cx, cy = 0, 0
541
- else:
542
- xy = [self.x[ci] / 3600, self.y[cj] / 3600]
543
- cx, cy = coord2xy(xy2coord(xy, self.center))
538
+ cx = 0
539
+ if not self.pv:
540
+ cj = np.argmin(np.abs(self.y))
541
+ if self.center is None:
542
+ cx, cy = self.x[ci], self.x[cj]
543
+ else:
544
+ xy = [self.x[ci] / 3600, self.y[cj] / 3600]
545
+ cx, cy = coord2xy(xy2coord(xy, self.center))
546
+
547
+ def indeg(s):
548
+ u = f'CUNIT{s}'
549
+ return fhd is None or u not in fhd or isdeg(fhd[u])
550
+
544
551
  h['NAXIS1'] = len(self.x)
545
- h['CRPIX1'] = ci + 1
546
- h['CRVAL1'] = cx
547
- h['CDELT1'] = self.dx
548
- if fhd is None or 'CUNIT1' not in fhd or isdeg(fhd['CUNIT1']):
549
- h['CDELT1'] = h['CDELT1'] / 3600
552
+ h['CRPIX1'] = int(ci + 1)
553
+ h['CRVAL1'] = float(cx)
554
+ h['CDELT1'] = float(self.dx / (3600 if indeg('1') else 1))
550
555
  if self.dv is not None:
551
556
  vaxis = '2' if self.pv else '3'
557
+ ck = np.argmin(np.abs(self.v))
558
+ cv = self.v[ck]
559
+ dv = self.dv
560
+ if self.restfreq is None or self.restfreq == 0:
561
+ s = 'No valid restfreq.' \
562
+ + f' Axis {vaxis} is saved as is.'
563
+ warnings.warn(s, UserWarning)
564
+ else:
565
+ cv = (1 - cv / cu.c_kms) * self.restfreq
566
+ dv = -dv / cu.c_kms * self.restfreq
552
567
  h[f'NAXIS{vaxis}'] = len(self.v)
553
- k_vmin = np.argmin(np.abs(self.v))
554
- h[f'CRPIX{vaxis}'] = k_vmin + 1
555
- h[f'CRVAL{vaxis}'] = (1 - self.v[k_vmin]/cu.c_kms) * self.restfreq
556
- h[f'CDELT{vaxis}'] = -self.dv / cu.c_kms * self.restfreq
568
+ h[f'CRPIX{vaxis}'] = int(ck + 1)
569
+ h[f'CRVAL{vaxis}'] = float(cv)
570
+ h[f'CDELT{vaxis}'] = float(dv)
557
571
  if not self.pv:
558
572
  h['NAXIS2'] = len(self.y)
559
- h['CRPIX2'] = cj + 1
560
- h['CRVAL2'] = cy
561
- h['CDELT2'] = self.dy
562
- if fhd is None or 'CUNIT2' not in fhd or isdeg(fhd['CUNIT2']):
563
- h['CDELT2'] = h['CDELT2'] / 3600
573
+ h['CRPIX2'] = int(cj + 1)
574
+ h['CRVAL2'] = float(cy)
575
+ h['CDELT2'] = float(self.dy / (3600 if indeg('2') else 1))
564
576
  if None not in self.beam:
565
- if self.pv:
566
- h['BMAJ'] = self.beam_org[0] / 3600
567
- h['BMIN'] = self.beam_org[1] / 3600
568
- h['BPA'] = self.beam_org[2]
569
- else:
570
- h['BMAJ'] = self.beam[0] / 3600
571
- h['BMIN'] = self.beam[1] / 3600
572
- h['BPA'] = self.beam[2]
577
+ beam = self.beam_org if self.pv else self.beam
578
+ h['BMAJ'] = float(beam[0] / 3600)
579
+ h['BMIN'] = float(beam[1] / 3600)
580
+ h['BPA'] = float(beam[2])
573
581
  h.update(header)
574
582
  data2fits(d=self.data, h=h, templatefits=self.fitsimage_org,
575
583
  fitsimage=fitsimage)
@@ -271,11 +271,13 @@ class FitsData:
271
271
  case 'Hz':
272
272
  if freq == 0:
273
273
  print('v is frequency because restfreq=0.')
274
+ s = s_in * 1
274
275
  else:
275
276
  s = (1 - s_in / freq) * cu.c_kms - vsys
276
277
  case 'HZ':
277
278
  if freq == 0:
278
279
  print('v is frequency because restfreq=0.')
280
+ s = s_in * 1
279
281
  else:
280
282
  s = (1 - s_in / freq) * cu.c_kms - vsys
281
283
  case 'm/s':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.4
3
+ Version: 1.7.6
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,5 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  setup.cfg
4
5
  setup.py
File without changes
File without changes
File without changes
File without changes