plotastrodata 1.7.6__tar.gz → 1.7.8__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/plotastrodata.egg-info → plotastrodata-1.7.8}/PKG-INFO +1 -1
  2. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/analysis_utils.py +16 -8
  4. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/fft_utils.py +4 -6
  5. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/fits_utils.py +4 -2
  6. {plotastrodata-1.7.6 → plotastrodata-1.7.8/plotastrodata.egg-info}/PKG-INFO +1 -1
  7. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/LICENSE +0 -0
  8. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/MANIFEST.in +0 -0
  9. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/README.md +0 -0
  10. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/const_utils.py +0 -0
  11. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/coord_utils.py +0 -0
  12. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/ext_utils.py +0 -0
  13. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/fitting_utils.py +0 -0
  14. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/los_utils.py +0 -0
  15. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/matrix_utils.py +0 -0
  16. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/other_utils.py +0 -0
  17. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata/plot_utils.py +0 -0
  18. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata.egg-info/SOURCES.txt +0 -0
  19. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata.egg-info/dependency_links.txt +0 -0
  20. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata.egg-info/not-zip-safe +0 -0
  21. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata.egg-info/requires.txt +0 -0
  22. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/plotastrodata.egg-info/top_level.txt +0 -0
  23. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/setup.cfg +0 -0
  24. {plotastrodata-1.7.6 → plotastrodata-1.7.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.6
3
+ Version: 1.7.8
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.6'
4
+ __version__ = '1.7.8'
@@ -90,12 +90,14 @@ class AstroData():
90
90
  v (np.ndarray, optional): 1D array. Defaults to None.
91
91
  beam (np.ndarray, optional): [bmaj, bmin, bpa]. Defaults ot [None, None, None].
92
92
  fitsimage (str, optional): Input fits name. Defaults to None.
93
- Tb (bool, optional): True means the mapped data are brightness T. Defaults to False.
93
+ Tb (bool, optional): True means the data array is brightness temperature. Defaults to False.
94
94
  sigma (float or str, optional): Noise level or method for measuring it. Defaults to 'hist'.
95
95
  center (str, optional): Text coordinates. 'common' means initialized value. Defaults to 'common'.
96
- restfreq (float, optional): Used for velocity and brightness T. Defaults to None.
97
- cfactor (float, optional): Output data times cfactor. Defaults to 1.
96
+ restfreq (float, optional): Used for velocity and brightness temperature. Defaults to None.
97
+ cfactor (float, optional): The data array is multiplied by cfactor. Defaults to 1.
98
98
  pvpa (float, optional): Position angle of the PV cut. Defaults to None.
99
+ pv (bool, optional): True means the data array is a position-velocity diagram. Defaults to False.
100
+ bunit (str, optional): The unit of the data array. Defaults to ''.
99
101
  """
100
102
  data: np.ndarray | None = None
101
103
  x: np.ndarray | None = None
@@ -110,6 +112,7 @@ class AstroData():
110
112
  cfactor: float = 1
111
113
  pvpa: float | None = None
112
114
  pv: bool = False
115
+ bunit: str = ''
113
116
 
114
117
  def __post_init__(self):
115
118
  n = 0
@@ -132,7 +135,6 @@ class AstroData():
132
135
  if n == 0:
133
136
  print('Either data or fitsimage must be given.')
134
137
  self.n = n
135
- self.bunit = ''
136
138
  self.fitsimage_org = None
137
139
  self.sigma_org = None
138
140
  self.beam_org = None
@@ -159,8 +161,10 @@ class AstroData():
159
161
  if w[n] == 1 or grid[n] is None:
160
162
  continue
161
163
  if dgrid[n] is None:
162
- s = ['v', 'y', 'x'][n - 1]
163
- print(f'Skip binning in the {s}-axis because d{s} is None.')
164
+ t = ['v', 'y', 'x'][n - 1]
165
+ s = f'Skip binning in the {t}-axis' \
166
+ + f' because d{t} is None.'
167
+ warnings.warn(s, UserWarning)
164
168
  continue
165
169
  size[n] = newsize[n]
166
170
  olddata = np.moveaxis(d, n, 0)
@@ -177,8 +181,11 @@ class AstroData():
177
181
  self.data = np.squeeze(d)
178
182
  _, self.v, self.y, self.x = grid
179
183
  _, self.dv, self.dy, self.dx = dgrid
184
+ s = 'AstroData.sigma is not updated by AstroData.binning().'
185
+ warnings.warn(s, UserWarning)
180
186
 
181
- def centering(self, includexy: bool = True, includev: bool = False,
187
+ def centering(self, includexy: bool = True,
188
+ includev: bool = False,
182
189
  **kwargs):
183
190
  """Spatial regridding to set the center at (x,y,v)=(0,0,0).
184
191
 
@@ -520,7 +527,8 @@ class AstroData():
520
527
  d = {'data': self.data, 'x': self.x, 'y': self.y, 'v': self.v,
521
528
  'fitsimage': self.fitsimage, 'beam': self.beam, 'Tb': self.Tb,
522
529
  'restfreq': self.restfreq, 'cfactor': self.cfactor,
523
- 'sigma': self.sigma, 'center': self.center, 'pv': self.pv}
530
+ 'sigma': self.sigma, 'center': self.center, 'pv': self.pv,
531
+ 'bunit': self.bunit}
524
532
  return d
525
533
 
526
534
  @_need_multipixels
@@ -58,7 +58,7 @@ def fftcentering(f: np.ndarray, x: np.ndarray | None = None,
58
58
  dx = X[1] - X[0]
59
59
  u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
60
60
  F = np.fft.fftshift(np.fft.fft(f))
61
- F = shiftphase(F, u=u, xoff=xcenter - X[-1] - dx)
61
+ F = shiftphase(F, u=u, xoff=xcenter - X[0])
62
62
  return F, u
63
63
 
64
64
 
@@ -89,7 +89,7 @@ def fftcentering2(f: np.ndarray,
89
89
  u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
90
90
  v = np.fft.fftshift(np.fft.fftfreq(ny, d=dy))
91
91
  F = np.fft.fftshift(np.fft.fft2(f))
92
- F = shiftphase2(F, u, v, xcenter - X[-1] - dx, ycenter - Y[-1] - dy)
92
+ F = shiftphase2(F, u, v, xcenter - X[0], ycenter - Y[0])
93
93
  return F, u, v
94
94
 
95
95
 
@@ -116,8 +116,7 @@ def ifftcentering(F: np.ndarray, u: np.ndarray | None = None,
116
116
  x = (np.arange(nx) - (nx-1)/2.) / (u[1]-u[0]) / nx + xcenter
117
117
  if x0 is not None:
118
118
  x = x - x[0] + x0
119
- dx = x[1] - x[0]
120
- F = shiftphase(F, u=u, xoff=x[-1] + dx - xcenter)
119
+ F = shiftphase(F, u=u, xoff=x[0] - xcenter)
121
120
  f = np.fft.ifft(np.fft.ifftshift(F))
122
121
  if outreal:
123
122
  f = np.real(f)
@@ -156,8 +155,7 @@ def ifftcentering2(F: np.ndarray,
156
155
  x = x - x[0] + x0
157
156
  if y0 is not None:
158
157
  y = y - y[0] + y0
159
- dx, dy = x[1] - x[0], y[1] - y[0]
160
- F = shiftphase2(F, u, v, x[-1] + dx - xcenter, y[-1] + dy - ycenter)
158
+ F = shiftphase2(F, u, v, x[0] - xcenter, y[0] - ycenter)
161
159
  f = np.fft.ifft2(np.fft.ifftshift(F))
162
160
  if outreal:
163
161
  f = np.real(f)
@@ -314,8 +314,10 @@ class FitsData:
314
314
  yc = self.y[jc] / self.dy
315
315
  Mcd = [[cd11, cd12], [cd21, cd22]]
316
316
  xc, yc = dot2d(Mcd, [xc, yc])
317
- newcenter = xy2coord(xy=[xc, yc], coordorg=self.get_center())
318
- xc, yc = coord2xy(coords=newcenter, coordorg='00h00m00s 00d00m00s')
317
+ newcenter = xy2coord(xy=[xc, yc],
318
+ coordorg=self.get_center())
319
+ xc, yc = coord2xy(coords=newcenter,
320
+ coordorg='00h00m00s 00d00m00s')
319
321
  self.header['CRVAL1'] = xc
320
322
  self.header['CRVAL2'] = yc
321
323
  self.x = self.x - self.x[ic]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.7.6
3
+ Version: 1.7.8
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
File without changes