plotastrodata 1.9.16__tar.gz → 1.9.18__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.
- {plotastrodata-1.9.16/plotastrodata.egg-info → plotastrodata-1.9.18}/PKG-INFO +1 -1
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/analysis_utils.py +17 -8
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/plot_utils.py +25 -12
- {plotastrodata-1.9.16 → plotastrodata-1.9.18/plotastrodata.egg-info}/PKG-INFO +1 -1
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/LICENSE +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/MANIFEST.in +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/README.md +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/coord_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/ext_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/fft_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/fitting_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/matrix_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/noise_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata/other_utils.py +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/setup.cfg +0 -0
- {plotastrodata-1.9.16 → plotastrodata-1.9.18}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.18
|
|
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
|
|
@@ -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
|
|
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
|
-
|
|
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)
|
|
@@ -344,14 +344,14 @@ class PlotAxes2D():
|
|
|
344
344
|
Args:
|
|
345
345
|
samexy (bool, optional): True supports same ticks between x and y. Defaults to True.
|
|
346
346
|
loglog (float, optional): If a float is given, plot on a log-log plane, and xim=(xmax / loglog, xmax) and so does ylim. Defaults to None.
|
|
347
|
-
xscale (str, optional): Defaults to
|
|
348
|
-
yscale (str, optional): Defaults to
|
|
347
|
+
xscale (str, optional): ``'log'`` labels decade ticks and ticks near the limits; other intermediate ticks are minor and unlabeled. Defaults to ``'linear'``.
|
|
348
|
+
yscale (str, optional): ``'log'`` labels decade ticks and ticks near the limits; other intermediate ticks are minor and unlabeled. Defaults to ``'linear'``.
|
|
349
349
|
xlim (list, optional): Defaults to None.
|
|
350
350
|
ylim (list, optional): Defaults to None.
|
|
351
351
|
xlabel (str, optional): Defaults to None.
|
|
352
352
|
ylabel (str, optional): Defaults to None.
|
|
353
|
-
xticks (list, optional): Defaults to None.
|
|
354
|
-
yticks (list, optional): Defaults to None.
|
|
353
|
+
xticks (list, optional): Explicit major ticks, overriding the default locator. Defaults to None.
|
|
354
|
+
yticks (list, optional): Explicit major ticks, overriding the default locator. Defaults to None.
|
|
355
355
|
xticklabels (list, optional): Defaults to None.
|
|
356
356
|
yticklabels (list, optional): Defaults to None.
|
|
357
357
|
xticksminor (list or int, optional): If int, int times more than xticks. Defaults to None.
|
|
@@ -393,16 +393,25 @@ class PlotAxes2D():
|
|
|
393
393
|
def _init_ticks(self, axis: str) -> None:
|
|
394
394
|
ax = self.ax
|
|
395
395
|
ticks_attr = f'{axis}ticks'
|
|
396
|
-
ticklabels_attr = f'{axis}ticklabels'
|
|
397
396
|
scale = getattr(self, f'{axis}scale')
|
|
398
|
-
lim = getattr(self, f'{axis}lim')
|
|
399
397
|
ticks = getattr(self, ticks_attr)
|
|
400
398
|
if ticks is None:
|
|
401
|
-
ticks = getattr(ax, f'get_{axis}ticks')()
|
|
402
399
|
if scale == 'log':
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
400
|
+
axis_obj = getattr(ax, f'{axis}axis')
|
|
401
|
+
lim = getattr(self, f'{axis}lim')
|
|
402
|
+
if lim is None:
|
|
403
|
+
lim = axis_obj.get_view_interval()
|
|
404
|
+
lim = np.sort(lim)
|
|
405
|
+
major_ticks = mpl.ticker.LogLocator(base=10).tick_values(*lim)
|
|
406
|
+
major_ticks, major_labels = logticks(major_ticks, lim)
|
|
407
|
+
axis_obj.set_ticks(major_ticks)
|
|
408
|
+
axis_obj.set_ticklabels(major_labels)
|
|
409
|
+
ll = mpl.ticker.LogLocator(base=10, subs=np.arange(2.0, 10.0))
|
|
410
|
+
axis_obj.set_minor_locator(ll)
|
|
411
|
+
axis_obj.set_minor_formatter(mpl.ticker.NullFormatter())
|
|
412
|
+
else:
|
|
413
|
+
ticks = getattr(ax, f'get_{axis}ticks')()
|
|
414
|
+
setattr(self, ticks_attr, ticks)
|
|
406
415
|
|
|
407
416
|
def _make_ticks(self, ticks: np.ndarray, ticksminor: int) -> np.ndarray:
|
|
408
417
|
dt = ticks[1] - ticks[0]
|
|
@@ -414,11 +423,15 @@ class PlotAxes2D():
|
|
|
414
423
|
ax = self.ax
|
|
415
424
|
attr = f'{axis}ticks'
|
|
416
425
|
ticks = getattr(self, attr)
|
|
417
|
-
|
|
426
|
+
if ticks is not None:
|
|
427
|
+
getattr(ax, f'set_{attr}')(ticks)
|
|
418
428
|
ticksminor = getattr(self, f'{attr}minor')
|
|
419
429
|
if ticksminor is not None:
|
|
420
430
|
if isinstance(ticksminor, int):
|
|
421
|
-
|
|
431
|
+
if ticks is None:
|
|
432
|
+
ticks = getattr(ax, f'get_{axis}ticks')()
|
|
433
|
+
major_ticks = (ticks)
|
|
434
|
+
ticksminor = self._make_ticks(major_ticks, ticksminor)
|
|
422
435
|
getattr(ax, f'set_{attr}')(ticksminor, minor=True)
|
|
423
436
|
|
|
424
437
|
def _apply_if_not_none(self, axis: str, attr: str) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.18
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|