plotastrodata 1.4.3__tar.gz → 1.4.4__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.3 → plotastrodata-1.4.4}/PKG-INFO +1 -1
  2. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/fits_utils.py +29 -21
  4. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/PKG-INFO +1 -1
  5. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/LICENSE +0 -0
  6. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/README.md +0 -0
  7. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/analysis_utils.py +0 -0
  8. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/const_utils.py +0 -0
  9. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/coord_utils.py +0 -0
  10. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/ext_utils.py +0 -0
  11. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/fft_utils.py +0 -0
  12. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/fitting_utils.py +0 -0
  13. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/los_utils.py +0 -0
  14. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/matrix_utils.py +0 -0
  15. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/other_utils.py +0 -0
  16. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata/plot_utils.py +0 -0
  17. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/SOURCES.txt +0 -0
  18. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/dependency_links.txt +0 -0
  19. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/not-zip-safe +0 -0
  20. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/requires.txt +0 -0
  21. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/plotastrodata.egg-info/top_level.txt +0 -0
  22. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/setup.cfg +0 -0
  23. {plotastrodata-1.4.3 → plotastrodata-1.4.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plotastrodata
3
- Version: 1.4.3
3
+ Version: 1.4.4
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.3'
4
+ __version__ = '1.4.4'
@@ -189,33 +189,24 @@ class FitsData:
189
189
  pv (bool, optional): Mode for position-velocity diagram. Defaults to False.
190
190
  """
191
191
  h = self.get_header()
192
- # spatial center
193
- if center is not None:
194
- c0 = xy2coord([h['CRVAL1'], h['CRVAL2']])
195
- if 'RADESYS' in h:
196
- radesys = h['RADESYS']
197
- c0 = f'{radesys} {c0}'
198
- cx, cy = coord2xy(center, c0)
199
- else:
200
- cx, cy = 0, 0
201
- # rest frequency
202
- if restfreq is None:
203
- if 'RESTFRQ' in h:
204
- restfreq = h['RESTFRQ']
205
- if 'RESTFREQ' in h:
206
- restfreq = h['RESTFREQ']
207
- self.x, self.y, self.v = None, None, None
208
- self.dx, self.dy, self.dv = None, None, None
209
192
  # WCS rotation (Calabretta & Greisen 2002, Astronomy & Astrophysics, 395, 1077)
210
193
  self.wcsrot = False
211
194
  cdij = ['CD1_1', 'CD1_2', 'CD2_1', 'CD2_2']
212
195
  if np.all([s in list(h.keys()) for s in cdij]):
213
196
  self.wcsrot = True
214
197
  cd11, cd12, cd21, cd22 = [h[s] for s in cdij]
215
- cdelt1cdelt2 = cd11 * cd22 - cd12 * cd21
216
- sin_2rho = 2 * cd21 * cd22 / cdelt1cdelt2
217
- cos_2rho = (cd11 * cd22 + cd12 * cd21) / cdelt1cdelt2
218
- crota2 = np.arctan2(sin_2rho, cos_2rho) / 2.
198
+ if cd21 == 0:
199
+ rho_a = 0
200
+ else:
201
+ rho_a = np.arctan2(np.abs(cd21), np.sign(cd21) * cd11)
202
+ if cd12 == 0:
203
+ rho_b = 0
204
+ else:
205
+ rho_b = np.arctan2(np.abs(cd12), -np.sign(cd12) * cd22)
206
+ if (drho := np.abs(np.degrees(rho_a - rho_b))) > 1.0:
207
+ print('Angles from (CD21, CD11) and (CD12, CD22)'
208
+ + f' are different by {drho:.2} degrees.')
209
+ crota2 = (rho_a + rho_b) / 2.
219
210
  sin_rho = np.sin(crota2)
220
211
  cos_rho = np.cos(crota2)
221
212
  cdelt1 = cd11 * cos_rho + cd21 * sin_rho
@@ -228,6 +219,23 @@ class FitsData:
228
219
  del h['CD2_1']
229
220
  del h['CD2_2']
230
221
  print(f'WCS rotation was found (CROTA2 = {crota2:f} deg).')
222
+ # spatial center
223
+ if center is None or self.wcsrot:
224
+ cx, cy = 0, 0
225
+ else:
226
+ c0 = xy2coord([h['CRVAL1'], h['CRVAL2']])
227
+ if 'RADESYS' in h:
228
+ radesys = h['RADESYS']
229
+ c0 = f'{radesys} {c0}'
230
+ cx, cy = coord2xy(center, c0)
231
+ # rest frequency
232
+ if restfreq is None:
233
+ if 'RESTFRQ' in h:
234
+ restfreq = h['RESTFRQ']
235
+ if 'RESTFREQ' in h:
236
+ restfreq = h['RESTFREQ']
237
+ self.x, self.y, self.v = None, None, None
238
+ self.dx, self.dy, self.dv = None, None, None
231
239
 
232
240
  def get_list(i: int, crval=False) -> np.ndarray:
233
241
  s = np.arange(h[f'NAXIS{i:d}'])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plotastrodata
3
- Version: 1.4.3
3
+ Version: 1.4.4
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