plotastrodata 1.9.11__tar.gz → 1.9.13__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.11/plotastrodata.egg-info → plotastrodata-1.9.13}/PKG-INFO +1 -1
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/analysis_utils.py +2 -1
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/fft_utils.py +163 -23
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/fitting_utils.py +5 -3
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/noise_utils.py +1 -1
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/other_utils.py +3 -2
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/plot_utils.py +4 -4
- {plotastrodata-1.9.11 → plotastrodata-1.9.13/plotastrodata.egg-info}/PKG-INFO +1 -1
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/LICENSE +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/MANIFEST.in +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/README.md +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/coord_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/ext_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata/matrix_utils.py +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/setup.cfg +0 -0
- {plotastrodata-1.9.11 → plotastrodata-1.9.13}/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.13
|
|
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
|
|
@@ -3,6 +3,7 @@ import warnings
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from scipy.interpolate import RegularGridInterpolator as RGI
|
|
5
5
|
from scipy.signal import convolve
|
|
6
|
+
from typing import Callable
|
|
6
7
|
|
|
7
8
|
from plotastrodata import const_utils as cu
|
|
8
9
|
from plotastrodata.coord_utils import coord2xy, rel2abs, xy2coord
|
|
@@ -290,7 +291,7 @@ class AstroData():
|
|
|
290
291
|
self.beam = np.array([bmaj_new, bmin_new, bpa_new])
|
|
291
292
|
|
|
292
293
|
@_need_multipixels
|
|
293
|
-
def fit2d(self, model:
|
|
294
|
+
def fit2d(self, model: Callable, bounds: np.ndarray,
|
|
294
295
|
progressbar: bool = False,
|
|
295
296
|
kwargs_fit: dict = {}, kwargs_plotcorner: dict = {},
|
|
296
297
|
chan: int | None = None):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import matplotlib.pyplot as plt
|
|
2
2
|
import numpy as np
|
|
3
|
+
from typing import Callable
|
|
3
4
|
|
|
4
5
|
from plotastrodata.fits_utils import fits2data
|
|
5
6
|
from plotastrodata.other_utils import close_figure
|
|
@@ -11,7 +12,7 @@ def shiftphase(F: np.ndarray, u: np.ndarray,
|
|
|
11
12
|
|
|
12
13
|
Args:
|
|
13
14
|
F (np.ndarray): 1D FFT.
|
|
14
|
-
u (np.ndarray): 1D array. The
|
|
15
|
+
u (np.ndarray): 1D array. The frequency coordinate.
|
|
15
16
|
xoff (float): From old to new center. Defaults to 0.
|
|
16
17
|
|
|
17
18
|
Returns:
|
|
@@ -27,7 +28,7 @@ def shiftphase2(F: np.ndarray, u: np.ndarray, v: np.ndarray,
|
|
|
27
28
|
Args:
|
|
28
29
|
F (np.ndarray): 2D FFT.
|
|
29
30
|
u (np.ndarray): 1D or 2D array. The first frequency coordinate.
|
|
30
|
-
v (np.ndarray): 1D or 2D array. The second frequency coordinate.
|
|
31
|
+
v (np.ndarray): 1D or 2D array. The second frequency coordinate.
|
|
31
32
|
xoff (float): From old to new center. Defaults to 0.
|
|
32
33
|
yoff (float): From old to new center. Defaults to 0.
|
|
33
34
|
|
|
@@ -39,7 +40,7 @@ def shiftphase2(F: np.ndarray, u: np.ndarray, v: np.ndarray,
|
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
def fftcentering(f: np.ndarray, x: np.ndarray | None = None,
|
|
42
|
-
xcenter: float = 0
|
|
43
|
+
xcenter: float = 0, rfft: bool = False
|
|
43
44
|
) -> tuple[np.ndarray, np.ndarray]:
|
|
44
45
|
"""FFT with the phase referring to a specific point.
|
|
45
46
|
|
|
@@ -47,6 +48,7 @@ def fftcentering(f: np.ndarray, x: np.ndarray | None = None,
|
|
|
47
48
|
f (np.ndarray): 1D array for FFT.
|
|
48
49
|
x (np.ndarray, optional): 1D array. The spatial coordinate. Defaults to None.
|
|
49
50
|
xcenter (float, optional): x of phase reference. Defaults to 0.
|
|
51
|
+
rfft (bool, optional): True means using rFFT. Defaults to False.
|
|
50
52
|
|
|
51
53
|
Returns:
|
|
52
54
|
tuple: (F, u). F is FFT of f. u is a 1D array of the frequency coordinate.
|
|
@@ -56,15 +58,19 @@ def fftcentering(f: np.ndarray, x: np.ndarray | None = None,
|
|
|
56
58
|
x = np.arange(nx)
|
|
57
59
|
X = x[0, :] if np.ndim(x) == 2 else x
|
|
58
60
|
dx = X[1] - X[0]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
if rfft:
|
|
62
|
+
u = np.fft.rfftfreq(nx, d=dx)
|
|
63
|
+
F = np.fft.rfft(f)
|
|
64
|
+
else:
|
|
65
|
+
u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
|
|
66
|
+
F = np.fft.fftshift(np.fft.fft(f))
|
|
61
67
|
F = shiftphase(F, u=u, xoff=xcenter - X[0])
|
|
62
68
|
return F, u
|
|
63
69
|
|
|
64
70
|
|
|
65
71
|
def fftcentering2(f: np.ndarray,
|
|
66
72
|
x: np.ndarray | None = None, y: np.ndarray | None = None,
|
|
67
|
-
xcenter: float = 0, ycenter: float = 0
|
|
73
|
+
xcenter: float = 0, ycenter: float = 0, rfft: bool = False
|
|
68
74
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
69
75
|
"""FFT with the phase referring to a specific point.
|
|
70
76
|
|
|
@@ -74,6 +80,7 @@ def fftcentering2(f: np.ndarray,
|
|
|
74
80
|
y (np.ndarray, optional): 1D or 2D array. The second spatial coordinate. Defaults to None.
|
|
75
81
|
xcenter (float, optional): x of phase reference. Defaults to 0.
|
|
76
82
|
ycenter (float, optional): y of phase reference. Defaults to 0.
|
|
83
|
+
rfft (bool, optional): True means using rFFT. Defaults to False.
|
|
77
84
|
|
|
78
85
|
Returns:
|
|
79
86
|
tuple: (F, u, v). F is FFT of f. u and v are 1D arrays of the frequency coordinates.
|
|
@@ -85,39 +92,60 @@ def fftcentering2(f: np.ndarray,
|
|
|
85
92
|
y = np.arange(ny)
|
|
86
93
|
X = x[0, :] if np.ndim(x) == 2 else x
|
|
87
94
|
Y = y[:, 0] if np.ndim(y) == 2 else y
|
|
88
|
-
dx
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
dx = X[1] - X[0]
|
|
96
|
+
dy = Y[1] - Y[0]
|
|
97
|
+
if rfft:
|
|
98
|
+
u = np.fft.rfftfreq(nx, d=dx)
|
|
99
|
+
v = np.fft.fftshift(np.fft.fftfreq(ny, d=dy))
|
|
100
|
+
F = np.fft.fftshift(np.fft.rfft2(f), axes=0)
|
|
101
|
+
else:
|
|
102
|
+
u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
|
|
103
|
+
v = np.fft.fftshift(np.fft.fftfreq(ny, d=dy))
|
|
104
|
+
F = np.fft.fftshift(np.fft.fft2(f))
|
|
92
105
|
F = shiftphase2(F, u, v, xcenter - X[0], ycenter - Y[0])
|
|
93
106
|
return F, u, v
|
|
94
107
|
|
|
95
108
|
|
|
96
109
|
def ifftcentering(F: np.ndarray, u: np.ndarray | None = None,
|
|
97
|
-
xcenter: float = 0,
|
|
98
|
-
|
|
99
|
-
outreal: bool =
|
|
110
|
+
xcenter: float = 0, x0: float = None,
|
|
111
|
+
dx: float = 1,
|
|
112
|
+
outreal: bool = False, rfft: bool = False
|
|
100
113
|
) -> tuple[np.ndarray, np.ndarray]:
|
|
101
114
|
"""inverse FFT with the phase referring to a specific point.
|
|
102
115
|
|
|
103
116
|
Args:
|
|
104
|
-
F (np.ndarray): 1D array.
|
|
117
|
+
F (np.ndarray): 1D array. An FFT result in the frequency domain.
|
|
105
118
|
u (np.ndarray, optional): 1D array. The frequency coordinate. Defaults to None.
|
|
106
119
|
xcenter (float, optional): x of phase reference (used in fftcentering). Defaults to 0.
|
|
107
120
|
x0 (float, optional): spatial coordinate of x[0]. Defaults to None.
|
|
108
|
-
|
|
121
|
+
dx (float, optional): spatial interval. Defaults to 1.
|
|
122
|
+
outreal (bool, optional): whether output only the real part. Defaults to False.
|
|
123
|
+
rfft (bool, optional): True means using rFFT. Defaults to False.
|
|
109
124
|
|
|
110
125
|
Returns:
|
|
111
126
|
tuple: (f, x). f is iFFT of F. x is a 1D array of the spatial coordinate.
|
|
112
127
|
"""
|
|
113
128
|
nx = np.shape(F)[0]
|
|
114
129
|
if u is None:
|
|
115
|
-
|
|
130
|
+
if rfft:
|
|
131
|
+
nx = 2 * (nx - 1) # Follow numpy.fft.irfft behavior.
|
|
132
|
+
u = np.fft.rfftfreq(nx, d=dx)
|
|
133
|
+
else:
|
|
134
|
+
u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
|
|
135
|
+
else:
|
|
136
|
+
if rfft:
|
|
137
|
+
if np.isclose(u[-1], 1 / (2 * dx)):
|
|
138
|
+
nx = 2 * (nx - 1)
|
|
139
|
+
else:
|
|
140
|
+
nx = 2 * (nx - 1) + 1
|
|
116
141
|
x = (np.arange(nx) - (nx-1)/2.) / (u[1]-u[0]) / nx + xcenter
|
|
117
142
|
if x0 is not None:
|
|
118
143
|
x = x - x[0] + x0
|
|
119
144
|
F = shiftphase(F, u=u, xoff=x[0] - xcenter)
|
|
120
|
-
|
|
145
|
+
if rfft:
|
|
146
|
+
f = np.fft.irfft(F, n=nx)
|
|
147
|
+
else:
|
|
148
|
+
f = np.fft.ifft(np.fft.ifftshift(F))
|
|
121
149
|
if outreal:
|
|
122
150
|
f = np.real(f)
|
|
123
151
|
return f, x
|
|
@@ -127,28 +155,42 @@ def ifftcentering2(F: np.ndarray,
|
|
|
127
155
|
u: np.ndarray | None = None, v: np.ndarray | None = None,
|
|
128
156
|
xcenter: float = 0, ycenter: float = 0,
|
|
129
157
|
x0: float | None = None, y0: float | None = None,
|
|
130
|
-
|
|
158
|
+
dx: float = 1, dy: float = 1,
|
|
159
|
+
outreal: bool = False, rfft: bool = False
|
|
131
160
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
132
161
|
"""inverse FFT with the phase referring to a specific point.
|
|
133
162
|
|
|
134
163
|
Args:
|
|
135
|
-
F (np.ndarray): 2D array.
|
|
164
|
+
F (np.ndarray): 2D array. An FFT result in the frequency domain.
|
|
136
165
|
u (np.ndarray, optional): 1D or 2D array. The first frequency coordinate. Defaults to None.
|
|
137
166
|
v (np.ndarray, optional): 1D or 2D array. The second frequency cooridnate. Defaults to None.
|
|
138
167
|
xcenter (float, optional): x of phase reference (used in fftcentering2). Defaults to 0.
|
|
139
168
|
ycenter (float, optional): y of phase reference (used in fftcentering2). Defaults to 0.
|
|
140
169
|
x0 (float, optional): spatial coordinate of x[0]. Defaults to None.
|
|
141
170
|
y0 (float, optional): spatial coordinate of y[0]. Defaults to None.
|
|
142
|
-
|
|
171
|
+
dx (float, optional): spatial interval. Defaults to 1.
|
|
172
|
+
dy (float, optional): spatial interval. Defaults to 1.
|
|
173
|
+
outreal (bool, optional): whether output only the real part. Defaults to False.
|
|
174
|
+
rfft (bool, optional): True means using rFFT. Defaults to False.
|
|
143
175
|
|
|
144
176
|
Returns:
|
|
145
177
|
tuple: (f, x, y). f is iFFT of F. x and y are 1D arrays of the spatial coordinates.
|
|
146
178
|
"""
|
|
147
179
|
ny, nx = np.shape(F)
|
|
148
180
|
if u is None:
|
|
149
|
-
|
|
181
|
+
if rfft:
|
|
182
|
+
nx = 2 * (nx - 1) # Follow numpy.fft.irfft behavior.
|
|
183
|
+
u = np.fft.rfftfreq(nx, d=dx)
|
|
184
|
+
else:
|
|
185
|
+
u = np.fft.fftshift(np.fft.fftfreq(nx, d=dy))
|
|
186
|
+
else:
|
|
187
|
+
if rfft:
|
|
188
|
+
if np.isclose(u[-1], 1 / (2 * dx)):
|
|
189
|
+
nx = 2 * (nx - 1)
|
|
190
|
+
else:
|
|
191
|
+
nx = 2 * (nx - 1) + 1
|
|
150
192
|
if v is None:
|
|
151
|
-
v = np.fft.fftshift(np.fft.fftfreq(ny, d=
|
|
193
|
+
v = np.fft.fftshift(np.fft.fftfreq(ny, d=dy))
|
|
152
194
|
x = (np.arange(nx) - (nx-1)/2.) / (u[1]-u[0]) / nx + xcenter
|
|
153
195
|
y = (np.arange(ny) - (ny-1)/2.) / (v[1]-v[0]) / ny + ycenter
|
|
154
196
|
if x0 is not None:
|
|
@@ -156,12 +198,110 @@ def ifftcentering2(F: np.ndarray,
|
|
|
156
198
|
if y0 is not None:
|
|
157
199
|
y = y - y[0] + y0
|
|
158
200
|
F = shiftphase2(F, u, v, x[0] - xcenter, y[0] - ycenter)
|
|
159
|
-
|
|
201
|
+
if rfft:
|
|
202
|
+
f = np.fft.irfft2(np.fft.ifftshift(F, axes=0), s=(ny, nx))
|
|
203
|
+
else:
|
|
204
|
+
f = np.fft.ifft2(np.fft.ifftshift(F))
|
|
160
205
|
if outreal:
|
|
161
206
|
f = np.real(f)
|
|
162
207
|
return f, x, y
|
|
163
208
|
|
|
164
209
|
|
|
210
|
+
class FftCentering():
|
|
211
|
+
"""Set FFT conditions and functions.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
x (np.ndarray): 1D array.
|
|
215
|
+
y (np.ndarray, optional): 1D array. Defaults to None.
|
|
216
|
+
xcenter (float, optional): x of phase reference. Defaults to 0.
|
|
217
|
+
ycenter (float, optional): y of phase reference. Defaults to 0.
|
|
218
|
+
rfft (bool, optional): True means using rFFT. Defaults to False.
|
|
219
|
+
"""
|
|
220
|
+
def __init__(self, x: np.ndarray,
|
|
221
|
+
y: np.ndarray | None = None,
|
|
222
|
+
xcenter: float = 0,
|
|
223
|
+
ycenter: float = 0,
|
|
224
|
+
rfft: bool = False):
|
|
225
|
+
nx = len(x)
|
|
226
|
+
self.x = x
|
|
227
|
+
self.dx = dx = x[1] - x[0]
|
|
228
|
+
self.xcenter = xcenter
|
|
229
|
+
self.ndim = 2 if isinstance(y, np.ndarray) else 1
|
|
230
|
+
self.rfft = rfft
|
|
231
|
+
if rfft:
|
|
232
|
+
u = np.fft.rfftfreq(nx, d=dx)
|
|
233
|
+
else:
|
|
234
|
+
u = np.fft.fftshift(np.fft.fftfreq(nx, d=dx))
|
|
235
|
+
self.u = u
|
|
236
|
+
if self.ndim == 2:
|
|
237
|
+
ny = len(y)
|
|
238
|
+
self.y = y
|
|
239
|
+
self.dy = dy = y[1] - y[0]
|
|
240
|
+
self.ycenter = ycenter
|
|
241
|
+
v = np.fft.fftshift(np.fft.fftfreq(ny, d=dy))
|
|
242
|
+
self.v = v
|
|
243
|
+
|
|
244
|
+
def fft(self, f: np.ndarray | None = None
|
|
245
|
+
) -> np.ndarray | Callable:
|
|
246
|
+
"""FFT calculation done by considering 1D/2D and fft/rfft.
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
f (np.ndarray | None, optional): 1D or 2D array. Defaults to None.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
np.ndarray: FFT result. When f is None, the return is the FFT function.
|
|
253
|
+
"""
|
|
254
|
+
if self.ndim == 1:
|
|
255
|
+
def func(f: np.ndarray):
|
|
256
|
+
F, _ = fftcentering(f=f, x=self.x,
|
|
257
|
+
xcenter=self.xcenter,
|
|
258
|
+
rfft=self.rfft)
|
|
259
|
+
return F
|
|
260
|
+
|
|
261
|
+
else:
|
|
262
|
+
def func(f: np.ndarray):
|
|
263
|
+
F, _, _ = fftcentering2(f=f, x=self.x, y=self.y,
|
|
264
|
+
xcenter=self.xcenter,
|
|
265
|
+
ycenter=self.ycenter,
|
|
266
|
+
rfft=self.rfft)
|
|
267
|
+
return F
|
|
268
|
+
|
|
269
|
+
return func if f is None else func(f)
|
|
270
|
+
|
|
271
|
+
def ifft(self, F: np.ndarray | None = None, outreal: bool = False
|
|
272
|
+
) -> np.ndarray | Callable:
|
|
273
|
+
"""iFFT calculation done by considering 1D/2D and fft/rfft.
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
F (np.ndarray | None, optional): An FFT result. Defaults to None.
|
|
277
|
+
|
|
278
|
+
Returns:
|
|
279
|
+
np.ndarray: iFFT result. When F is None, the return is the iFFT function.
|
|
280
|
+
"""
|
|
281
|
+
if self.ndim == 1:
|
|
282
|
+
def func(F: np.ndarray):
|
|
283
|
+
f, _ = ifftcentering(F=F, u=self.u,
|
|
284
|
+
xcenter=self.xcenter,
|
|
285
|
+
x0=self.x[0],
|
|
286
|
+
dx=self.dx,
|
|
287
|
+
outreal=outreal,
|
|
288
|
+
rfft=self.rfft)
|
|
289
|
+
return f
|
|
290
|
+
|
|
291
|
+
else:
|
|
292
|
+
def func(F: np.ndarray):
|
|
293
|
+
f, _, _ = ifftcentering2(F=F, u=self.u, v=self.v,
|
|
294
|
+
xcenter=self.xcenter,
|
|
295
|
+
ycenter=self.ycenter,
|
|
296
|
+
x0=self.x[0], y0=self.y[0],
|
|
297
|
+
dx=self.dx, dy=self.dy,
|
|
298
|
+
outreal=outreal,
|
|
299
|
+
rfft=self.rfft)
|
|
300
|
+
return f
|
|
301
|
+
|
|
302
|
+
return func if F is None else func(F)
|
|
303
|
+
|
|
304
|
+
|
|
165
305
|
def zeropadding(f: np.ndarray, x: np.ndarray, y: np.ndarray,
|
|
166
306
|
xlim: list, ylim: list
|
|
167
307
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
@@ -7,6 +7,7 @@ import warnings
|
|
|
7
7
|
from dynesty import DynamicNestedSampler as DNS
|
|
8
8
|
from multiprocessing import Pool
|
|
9
9
|
from tqdm import tqdm
|
|
10
|
+
from typing import Callable
|
|
10
11
|
|
|
11
12
|
from plotastrodata.matrix_utils import Mrot, dot2d
|
|
12
13
|
from plotastrodata.other_utils import close_figure
|
|
@@ -63,8 +64,8 @@ def _check_GR(samples: np.ndarray, nwalkers: int, ndata: int, dim: int,
|
|
|
63
64
|
class EmceeCorner():
|
|
64
65
|
warnings.simplefilter('ignore', RuntimeWarning)
|
|
65
66
|
|
|
66
|
-
def __init__(self, bounds: np.ndarray, logl:
|
|
67
|
-
model:
|
|
67
|
+
def __init__(self, bounds: np.ndarray, logl: Callable | None = None,
|
|
68
|
+
model: Callable | None = None,
|
|
68
69
|
xdata: np.ndarray | None = None,
|
|
69
70
|
ydata: np.ndarray | None = None,
|
|
70
71
|
sigma: np.ndarray = 1, progressbar: bool = False,
|
|
@@ -111,7 +112,8 @@ class EmceeCorner():
|
|
|
111
112
|
|
|
112
113
|
def _run_sampler(self, pos0: np.ndarray, pt: bool,
|
|
113
114
|
ncores: int, ntemps: int,
|
|
114
|
-
nsteps: int, nwalkers: int
|
|
115
|
+
nsteps: int, nwalkers: int
|
|
116
|
+
) -> ptemcee.Sampler | emcee.EnsembleSampler:
|
|
115
117
|
"""Create and run the sampler, then return it."""
|
|
116
118
|
if pt:
|
|
117
119
|
sampler_cls = ptemcee.Sampler
|
|
@@ -3,6 +3,7 @@ import numbers
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import warnings
|
|
5
5
|
from scipy.interpolate import RegularGridInterpolator as RGI
|
|
6
|
+
from typing import Callable
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def listing(*args) -> list:
|
|
@@ -217,7 +218,7 @@ def reform_data(c: np.ndarray, v_in: np.ndarray | None,
|
|
|
217
218
|
|
|
218
219
|
def RGIxy(y: np.ndarray, x: np.ndarray, data: np.ndarray,
|
|
219
220
|
yxnew: tuple[np.ndarray, np.ndarray] | None = None,
|
|
220
|
-
**kwargs) ->
|
|
221
|
+
**kwargs) -> Callable | np.ndarray:
|
|
221
222
|
"""RGI for x and y at each channel.
|
|
222
223
|
|
|
223
224
|
Args:
|
|
@@ -252,7 +253,7 @@ def RGIxy(y: np.ndarray, x: np.ndarray, data: np.ndarray,
|
|
|
252
253
|
|
|
253
254
|
def RGIxyv(v: np.ndarray, y: np.ndarray, x: np.ndarray, data: np.ndarray,
|
|
254
255
|
vyxnew: tuple[np.ndarray, np.ndarray, np.ndarray] | None = None,
|
|
255
|
-
**kwargs) ->
|
|
256
|
+
**kwargs) -> Callable | np.ndarray:
|
|
256
257
|
"""RGI in the x-y-v space.
|
|
257
258
|
|
|
258
259
|
Args:
|
|
@@ -3,7 +3,7 @@ import matplotlib.pyplot as plt
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from matplotlib.patches import Ellipse, Rectangle
|
|
6
|
-
from typing import TypeVar
|
|
6
|
+
from typing import TypeVar, Callable
|
|
7
7
|
|
|
8
8
|
from plotastrodata.analysis_utils import AstroData, AstroFrame
|
|
9
9
|
from plotastrodata.coord_utils import (coord2xy, xy2coord,
|
|
@@ -162,13 +162,13 @@ def _get_v(p, v: np.ndarray | None = None,
|
|
|
162
162
|
return v
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
def _get_nij2ch(nrows: int = 1, ncols: int = 1) ->
|
|
165
|
+
def _get_nij2ch(nrows: int = 1, ncols: int = 1) -> Callable:
|
|
166
166
|
def nij2ch(n: int, i: int, j: int) -> int:
|
|
167
167
|
return n*nrows*ncols + i*ncols + j
|
|
168
168
|
return nij2ch
|
|
169
169
|
|
|
170
170
|
|
|
171
|
-
def _get_ch2nij(nrows: int = 1, ncols: int = 1) ->
|
|
171
|
+
def _get_ch2nij(nrows: int = 1, ncols: int = 1) -> Callable:
|
|
172
172
|
def ch2nij(ch: int) -> tuple[int, int, int]:
|
|
173
173
|
n = ch // (nrows*ncols)
|
|
174
174
|
i = (ch - n*nrows*ncols) // ncols
|
|
@@ -178,7 +178,7 @@ def _get_ch2nij(nrows: int = 1, ncols: int = 1) -> object:
|
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
def _get_vskipfill(nv: float, v_org: np.ndarray, vskip: int,
|
|
181
|
-
channelnumber: int) ->
|
|
181
|
+
channelnumber: int) -> Callable:
|
|
182
182
|
def vskipfill(c: np.ndarray, v_in: np.ndarray) -> np.ndarray:
|
|
183
183
|
c = reform_data(c=c, v_in=v_in, nv=nv, v_org=v_org, vskip=vskip)
|
|
184
184
|
if isinstance(channelnumber, int):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.13
|
|
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
|