plotastrodata 1.9.15__tar.gz → 1.9.17__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 (25) hide show
  1. {plotastrodata-1.9.15/plotastrodata.egg-info → plotastrodata-1.9.17}/PKG-INFO +1 -1
  2. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/analysis_utils.py +17 -8
  4. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/plot_utils.py +13 -0
  5. {plotastrodata-1.9.15 → plotastrodata-1.9.17/plotastrodata.egg-info}/PKG-INFO +1 -1
  6. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/LICENSE +0 -0
  7. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/MANIFEST.in +0 -0
  8. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/README.md +0 -0
  9. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/const_utils.py +0 -0
  10. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/coord_utils.py +0 -0
  11. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/ext_utils.py +0 -0
  12. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/fft_utils.py +0 -0
  13. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/fits_utils.py +0 -0
  14. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/fitting_utils.py +0 -0
  15. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/los_utils.py +0 -0
  16. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/matrix_utils.py +0 -0
  17. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/noise_utils.py +0 -0
  18. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata/other_utils.py +0 -0
  19. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata.egg-info/SOURCES.txt +0 -0
  20. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata.egg-info/dependency_links.txt +0 -0
  21. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata.egg-info/not-zip-safe +0 -0
  22. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata.egg-info/requires.txt +0 -0
  23. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/plotastrodata.egg-info/top_level.txt +0 -0
  24. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/setup.cfg +0 -0
  25. {plotastrodata-1.9.15 → plotastrodata-1.9.17}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.9.15
3
+ Version: 1.9.17
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.9.15'
4
+ __version__ = '1.9.17'
@@ -81,12 +81,19 @@ def _need_multipixels(method: Callable) -> Callable:
81
81
  return wrapper
82
82
 
83
83
 
84
+ def _is_data_list(value: Any) -> bool:
85
+ c1 = isinstance(value, list)
86
+ c2 = any(a is not None for a in value)
87
+ c3 = all(a is None or isinstance(a, np.ndarray) for a in value)
88
+ return c1 and c2 and c3
89
+
90
+
84
91
  @dataclass
85
92
  class AstroData():
86
93
  """Data to be processed and parameters for processing the data.
87
94
 
88
95
  Args:
89
- data (np.ndarray, optional): 2D or 3D array. Defaults to None.
96
+ data (np.ndarray, array-like, or list of np.ndarray, optional): A single 2D or 3D dataset, or a list of arrays for multiple datasets. Nested numeric lists are treated as one array-like dataset. Defaults to None.
90
97
  x (np.ndarray, optional): 1D array. Defaults to None.
91
98
  y (np.ndarray, optional): 1D array. Defaults to None.
92
99
  v (np.ndarray, optional): 1D array. Defaults to None.
@@ -101,7 +108,7 @@ class AstroData():
101
108
  pv (bool, optional): True means the data array is a position-velocity diagram. Defaults to False.
102
109
  bunit (str, optional): The unit of the data array. Defaults to ''.
103
110
  """
104
- data: np.ndarray | None = None
111
+ data: np.ndarray | list[Any] | None = None
105
112
  x: np.ndarray | None = None
106
113
  y: np.ndarray | None = None
107
114
  v: np.ndarray | None = None
@@ -128,12 +135,14 @@ class AstroData():
128
135
  if n > 0:
129
136
  self.data = None
130
137
  if self.data is not None:
131
- if not isinstance(self.data, list):
132
- n = 1
133
- elif any(a is not None for a in self.data):
138
+ if _is_data_list(self.data):
134
139
  n = len(self.data)
135
- else:
140
+ elif (isinstance(self.data, list)
141
+ and not any(a is not None for a in self.data)):
136
142
  n = 0
143
+ else:
144
+ self.data = np.asarray(self.data)
145
+ n = 1
137
146
  if n == 0:
138
147
  print('Either data or fitsimage must be given.')
139
148
  self.n = n
@@ -319,7 +328,7 @@ class AstroData():
319
328
  pixelperbeam = Omega / np.abs(self.dx * self.dy)
320
329
  else:
321
330
  pixelperbeam = 1.
322
- s = 'sigma is multiplied by sqrt(pixel-per-beam)' \
331
+ s = 'In the fitting, sigma is multiplied by sqrt(pixel-per-beam)' \
323
332
  + ' to consider the noise correlation in a beam.' \
324
333
  + ' This correction is relatively conservative.'
325
334
  warnings.warn(s, UserWarning)
@@ -360,7 +369,7 @@ class AstroData():
360
369
  z = self.data if chan is None else self.data[chan]
361
370
  Omega = np.pi * self.beam[0] * self.beam[1] / 4 / np.log(2)
362
371
  pixelperbeam = Omega / np.abs(self.dx * self.dy)
363
- s = 'sigma is multiplied by sqrt(pixel-per-beam)' \
372
+ s = 'In the fitting, sigma is multiplied by sqrt(pixel-per-beam)' \
364
373
  + ' to consider the noise correlation in a beam.' \
365
374
  + ' This correction is relatively conservative.'
366
375
  warnings.warn(s, UserWarning)
@@ -324,6 +324,11 @@ class Beam():
324
324
  self.beam_kwargs = beam_kwargs
325
325
 
326
326
  def todict(self) -> dict[str, Any]:
327
+ """Return beam display settings as a dictionary.
328
+
329
+ Returns:
330
+ dict: Keyword arguments for PlotAstroData.add_beam().
331
+ """
327
332
  tmp = {'show_beam': self.show_beam,
328
333
  'beam': self.beam,
329
334
  'beamcolor': self.beamcolor,
@@ -427,8 +432,16 @@ class PlotAxes2D():
427
432
  method(value)
428
433
 
429
434
  def set_xyaxes(self, ax: Any) -> None:
435
+ """Apply stored x- and y-axis settings to a Matplotlib axes object.
436
+
437
+ Args:
438
+ ax (object): Matplotlib axes object.
439
+ """
430
440
  self.ax = ax
431
441
  self._set_scale()
442
+ for axis in ['x', 'y']:
443
+ # Applying 'lim' is required before and after the ticks.
444
+ self._apply_if_not_none(axis, 'lim')
432
445
  if self.samexy:
433
446
  ax.set_xticks(ax.get_yticks())
434
447
  ax.set_yticks(ax.get_xticks())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.9.15
3
+ Version: 1.9.17
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