plotastrodata 1.7.8__tar.gz → 1.7.10__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.8/plotastrodata.egg-info → plotastrodata-1.7.10}/PKG-INFO +1 -1
  2. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/analysis_utils.py +2 -1
  4. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/fits_utils.py +1 -1
  5. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/other_utils.py +20 -11
  6. {plotastrodata-1.7.8 → plotastrodata-1.7.10/plotastrodata.egg-info}/PKG-INFO +1 -1
  7. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/LICENSE +0 -0
  8. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/MANIFEST.in +0 -0
  9. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/README.md +0 -0
  10. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/const_utils.py +0 -0
  11. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/coord_utils.py +0 -0
  12. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/ext_utils.py +0 -0
  13. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/fft_utils.py +0 -0
  14. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/fitting_utils.py +0 -0
  15. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/los_utils.py +0 -0
  16. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/matrix_utils.py +0 -0
  17. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata/plot_utils.py +0 -0
  18. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata.egg-info/SOURCES.txt +0 -0
  19. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata.egg-info/dependency_links.txt +0 -0
  20. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata.egg-info/not-zip-safe +0 -0
  21. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata.egg-info/requires.txt +0 -0
  22. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/plotastrodata.egg-info/top_level.txt +0 -0
  23. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/setup.cfg +0 -0
  24. {plotastrodata-1.7.8 → plotastrodata-1.7.10}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.8
3
+ Version: 1.7.10
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.8'
4
+ __version__ = '1.7.10'
@@ -379,7 +379,8 @@ class AstroData():
379
379
  Returns:
380
380
  tuple: (bins, histogram)
381
381
  """
382
- hist, hbin = np.histogram(self.data, **kwargs)
382
+ hist, hbin = np.histogram(self.data[~np.isnan(self.data)],
383
+ **kwargs)
383
384
  hbin = (hbin[:-1] + hbin[1:]) / 2
384
385
  return hbin, hist
385
386
 
@@ -267,7 +267,7 @@ class FitsData:
267
267
  vaxis = '2' if pv else '3'
268
268
  key = f'CUNIT{vaxis}'
269
269
  cunitv = h[key]
270
- match cunitv:
270
+ match cunitv.strip():
271
271
  case 'Hz':
272
272
  if freq == 0:
273
273
  print('v is frequency because restfreq=0.')
@@ -1,7 +1,7 @@
1
1
  import warnings
2
2
  import numpy as np
3
3
  from scipy.optimize import curve_fit, OptimizeWarning
4
- from scipy.special import erf
4
+ from scipy.special import exp1
5
5
  from scipy.interpolate import RegularGridInterpolator as RGI
6
6
 
7
7
  from plotastrodata.matrix_utils import Mrot, dot2d
@@ -104,21 +104,30 @@ def estimate_rms(data: np.ndarray, sigma: float | str | None = 'hist'
104
104
  m0, s0 = np.nanmean(data), np.nanstd(data)
105
105
  hist, hbin = np.histogram(data[~np.isnan(data)],
106
106
  bins=100, density=True,
107
- range=(m0 - s0 * 5, m0 + s0 * 5))
107
+ range=(m0 - s0 * 3.5,
108
+ m0 + s0 * 3.5))
108
109
  hist, hbin = hist * s0, (hbin[:-1] + hbin[1:]) / 2 / s0
109
110
  if sigma[4:] == '-pbcor':
110
- def g(x, s, c, R):
111
- xn = (x - c) / np.sqrt(2) / s
112
- return (erf(xn) - erf(xn * np.exp(-R**2))) / (2 * (x-c) * R**2)
111
+ def g(x, s, R):
112
+ xn = x / np.sqrt(2) / s
113
+ pbcor = np.exp2(R**2)
114
+ y1 = xn**2
115
+ y2 = y1 / pbcor**2
116
+ area = 2 * np.sqrt(2 * np.pi) * s * (pbcor - 1)
117
+ p = (exp1(y2) - exp1(y1)) / area
118
+ return p
119
+ popt, _ = curve_fit(g, hbin, hist, p0=[1, 1],
120
+ bounds=[[0.001, 0.001], [2, 2]])
121
+ ave = 0
122
+ noise = popt[0]
113
123
  else:
114
- def g(x, s, c, _):
124
+ def g(x, s, c):
115
125
  xn = (x - c) / np.sqrt(2) / s
116
126
  return np.exp(-xn**2) / np.sqrt(2 * np.pi) / s
117
- with warnings.catch_warnings():
118
- warnings.simplefilter('ignore', OptimizeWarning)
119
- popt, _ = curve_fit(g, hbin, hist, p0=[1, 0, 1])
120
- ave = popt[1]
121
- noise = popt[0]
127
+ popt, _ = curve_fit(g, hbin, hist, p0=[1, 0],
128
+ bounds=[[0.001, -2], [2, 2]])
129
+ ave = popt[1]
130
+ noise = popt[0]
122
131
  warning_offset(ave, noise)
123
132
  noise = noise * s0
124
133
  return noise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.8
3
+ Version: 1.7.10
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