plotastrodata 1.8.12__tar.gz → 1.8.14__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.8.12/plotastrodata.egg-info → plotastrodata-1.8.14}/PKG-INFO +1 -1
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/analysis_utils.py +7 -10
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/fitting_utils.py +2 -1
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/plot_utils.py +86 -114
- {plotastrodata-1.8.12 → plotastrodata-1.8.14/plotastrodata.egg-info}/PKG-INFO +1 -1
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/LICENSE +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/MANIFEST.in +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/README.md +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/coord_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/ext_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/fft_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/matrix_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/noise_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata/other_utils.py +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/setup.cfg +0 -0
- {plotastrodata-1.8.12 → plotastrodata-1.8.14}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.14
|
|
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
|
|
@@ -438,15 +438,15 @@ class AstroData():
|
|
|
438
438
|
print('Data must be 3D with the v, y, and x axes.')
|
|
439
439
|
return
|
|
440
440
|
|
|
441
|
-
if len(coords) > 0:
|
|
442
|
-
xlist, ylist = coord2xy(coords, self.center) * 3600.
|
|
443
|
-
nprof = len(xlist)
|
|
444
441
|
v = self.v
|
|
445
442
|
data, xf, yf = filled2d(self.data, self.x, self.y, ninterp)
|
|
446
443
|
x, y = np.meshgrid(xf, yf)
|
|
444
|
+
if len(coords) > 0:
|
|
445
|
+
xlist, ylist = coord2xy(coords, self.center) * 3600.
|
|
446
|
+
nprof = len(xlist)
|
|
447
447
|
prof = np.empty((nprof, len(v)))
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
ellipse = ellipse or [[0, 0, 0]] * nprof
|
|
449
|
+
calc = np.sum if flux else np.mean
|
|
450
450
|
for i, (xc, yc, e) in enumerate(zip(xlist, ylist, ellipse)):
|
|
451
451
|
major, minor, pa = e
|
|
452
452
|
z = dot2d(Mrot(-pa), [y - yc, x - xc])
|
|
@@ -455,11 +455,8 @@ class AstroData():
|
|
|
455
455
|
idx = np.unravel_index(np.argmin(r), np.shape(r))
|
|
456
456
|
prof[i] = [d[idx] for d in data]
|
|
457
457
|
else:
|
|
458
|
-
r = np.hypot(*dot2d(Mfac(2/major, 2/minor), z))
|
|
459
|
-
|
|
460
|
-
prof[i] = [np.sum(d[r <= 1]) for d in data]
|
|
461
|
-
else:
|
|
462
|
-
prof[i] = [np.mean(d[r <= 1]) for d in data]
|
|
458
|
+
r = np.hypot(*dot2d(Mfac(2 / major, 2 / minor), z))
|
|
459
|
+
prof[i] = [calc(d[r <= 1]) for d in data]
|
|
463
460
|
if flux:
|
|
464
461
|
if None in self.beam or None in [self.dx, self.dy]:
|
|
465
462
|
print('None in beam, dx, or dy. Flux is not converted.')
|
|
@@ -438,7 +438,8 @@ def gaussfit1d(xdata: np.ndarray, ydata: np.ndarray,
|
|
|
438
438
|
plow = fitter.plow
|
|
439
439
|
phigh = fitter.phigh
|
|
440
440
|
perr = (phigh - plow) / 2
|
|
441
|
+
pars = 'peak, center, FWHM' + (', lnsigma' if sigma is None else '')
|
|
441
442
|
if show:
|
|
442
|
-
print('Gauss (
|
|
443
|
+
print(f'Gauss ({pars}):', popt)
|
|
443
444
|
print('Gauss uncertainties:', perr)
|
|
444
445
|
return {'popt': popt, 'perr': perr}
|
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
|
4
4
|
import warnings
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from matplotlib.patches import Ellipse, Rectangle
|
|
7
|
+
from typing import TypeVar
|
|
7
8
|
|
|
8
9
|
from plotastrodata.analysis_utils import AstroData, AstroFrame
|
|
9
10
|
from plotastrodata.coord_utils import coord2xy, xy2coord
|
|
@@ -13,6 +14,8 @@ from plotastrodata.other_utils import close_figure, listing
|
|
|
13
14
|
|
|
14
15
|
plt.ioff() # force to turn off interactive mode
|
|
15
16
|
|
|
17
|
+
T = TypeVar('T')
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
def set_rcparams(fontsize: int = 18, nancolor: str = 'w',
|
|
18
21
|
dpi: int = 256) -> None:
|
|
@@ -98,7 +101,7 @@ def logcbticks(vmin: float = 1e-3, vmax: float = 1e3
|
|
|
98
101
|
|
|
99
102
|
@dataclass
|
|
100
103
|
class Stretcher():
|
|
101
|
-
"""
|
|
104
|
+
"""Arguments and methods related to the stretch in PlotAstroData.add_color() and add_rgb().
|
|
102
105
|
|
|
103
106
|
Args:
|
|
104
107
|
stretch (str, optional): 'log', 'asinh', 'power', or 'linear'. Any other means 'linear'. 'log' means the mapped data are logarithmic. 'asinh' means the mapped data are arc sin hyperbolic. 'power' means the mapped data are power-law (see also stretchpower). Defaults to 'linear'.
|
|
@@ -202,6 +205,37 @@ class Stretcher():
|
|
|
202
205
|
return dataout, vminout, vmaxout
|
|
203
206
|
|
|
204
207
|
|
|
208
|
+
class Beam():
|
|
209
|
+
"""Arguments for PlotAstroData.add_beam().
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
show_beam (bool, optional): Defaults to True.
|
|
213
|
+
beam (list, optional): [bmaj, bmin, bpa]. This may be a list of list. Defaults to [None, None, None].
|
|
214
|
+
beamcolor (str, optional): matplotlib color. This may be a list of str. Defaults to 'gray'.
|
|
215
|
+
beampos (list, optional): Relative position. This may be a list of list or a list of None. Defaults to None.
|
|
216
|
+
beam_kwargs (dict, optional): Additional arguments for matplotlib.patches. Defaults to {}.
|
|
217
|
+
"""
|
|
218
|
+
def __init__(self,
|
|
219
|
+
show_beam: bool = True,
|
|
220
|
+
beam: list[float | None] = [None] * 3,
|
|
221
|
+
beamcolor: str = 'gray',
|
|
222
|
+
beampos: list[float] | None = None,
|
|
223
|
+
beam_kwargs: dict = {}):
|
|
224
|
+
self.show_beam = show_beam
|
|
225
|
+
self.beam = beam
|
|
226
|
+
self.beamcolor = beamcolor
|
|
227
|
+
self.beampos = beampos
|
|
228
|
+
self.beam_kwargs = beam_kwargs
|
|
229
|
+
|
|
230
|
+
def todict(self):
|
|
231
|
+
tmp = {'show_beam': self.show_beam,
|
|
232
|
+
'beam': self.beam,
|
|
233
|
+
'beamcolor': self.beamcolor,
|
|
234
|
+
'beampos': self.beampos}
|
|
235
|
+
tmp.update(self.beam_kwargs)
|
|
236
|
+
return tmp
|
|
237
|
+
|
|
238
|
+
|
|
205
239
|
@dataclass
|
|
206
240
|
class PlotAxes2D():
|
|
207
241
|
"""Use Axes.set_* to adjust x and y axes.
|
|
@@ -305,81 +339,29 @@ class PlotAxes2D():
|
|
|
305
339
|
ax.set_aspect(self.aspect)
|
|
306
340
|
|
|
307
341
|
|
|
308
|
-
def
|
|
309
|
-
"""Get
|
|
310
|
-
|
|
311
|
-
Args:
|
|
312
|
-
kw (dict): Parameters to make AstroData.
|
|
313
|
-
|
|
314
|
-
Returns:
|
|
315
|
-
AstroData: AstroData made from the parameters in kwargs.
|
|
316
|
-
"""
|
|
317
|
-
tmp = {}
|
|
318
|
-
d = AstroData(data=np.zeros((2, 2)))
|
|
319
|
-
for k in vars(d):
|
|
320
|
-
if k in kw:
|
|
321
|
-
tmp[k] = kw.pop(k)
|
|
322
|
-
if tmp == {}:
|
|
323
|
-
print('No argument given.')
|
|
324
|
-
return None
|
|
325
|
-
else:
|
|
326
|
-
d = AstroData(**tmp)
|
|
327
|
-
return d
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
def kwargs2AstroFrame(kw: dict) -> AstroFrame:
|
|
331
|
-
"""Get AstroFrame from kwargs.
|
|
332
|
-
|
|
333
|
-
Args:
|
|
334
|
-
kw (dict): Parameters to make AstroFrame.
|
|
335
|
-
|
|
336
|
-
Returns:
|
|
337
|
-
AstroFrame: AstroFrame made from the parameters in kwargs.
|
|
338
|
-
"""
|
|
339
|
-
tmp = {}
|
|
340
|
-
f = AstroFrame()
|
|
341
|
-
for k in vars(f):
|
|
342
|
-
if k in kw:
|
|
343
|
-
tmp[k] = kw[k]
|
|
344
|
-
if k not in ['fitsimage', 'center']:
|
|
345
|
-
del kw[k]
|
|
346
|
-
f = AstroFrame(**tmp)
|
|
347
|
-
return f
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
def kwargs2PlotAxes2D(kw: dict) -> PlotAxes2D:
|
|
351
|
-
"""Get PlotAxes2D and remove its arguments from kwargs.
|
|
342
|
+
def kwargs2instance(cls: type[T], kw: dict) -> T:
|
|
343
|
+
"""Get an instance and remove its arguments from kwargs.
|
|
352
344
|
|
|
353
345
|
Args:
|
|
354
|
-
|
|
346
|
+
cls (class): Class to make the instance.
|
|
347
|
+
kw (dict): Parameters to make Stretcher.
|
|
355
348
|
|
|
356
349
|
Returns:
|
|
357
|
-
|
|
350
|
+
instance: an instance of cls made from the parameters in kwargs.
|
|
358
351
|
"""
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
kw (dict): Parameters to make beam.
|
|
373
|
-
|
|
374
|
-
Returns:
|
|
375
|
-
dict: Arguments for add_beam().
|
|
376
|
-
"""
|
|
377
|
-
tmp = {}
|
|
378
|
-
for k in ['show_beam', 'beamcolor', 'beampos']:
|
|
379
|
-
if k in kw:
|
|
380
|
-
tmp[k] = kw.pop(k)
|
|
381
|
-
tmp.update(kw.pop('beam_kwargs', {}))
|
|
382
|
-
return tmp
|
|
352
|
+
kw0 = {}
|
|
353
|
+
if cls == AstroData:
|
|
354
|
+
kw0 = {'data': np.zeros((2, 2))}
|
|
355
|
+
exkeys = {}
|
|
356
|
+
if cls == AstroFrame:
|
|
357
|
+
exkeys = {'fitsimage', 'center'}
|
|
358
|
+
elif cls == Stretcher:
|
|
359
|
+
exkeys = {'vmin', 'vmax'}
|
|
360
|
+
keys = vars(cls(**kw0)).keys()
|
|
361
|
+
tmp = {k: kw[k] for k in keys if k in kw}
|
|
362
|
+
for k in keys - exkeys:
|
|
363
|
+
kw.pop(k, None)
|
|
364
|
+
return cls(**tmp)
|
|
383
365
|
|
|
384
366
|
|
|
385
367
|
class PlotAstroData(AstroFrame):
|
|
@@ -563,17 +545,21 @@ class PlotAstroData(AstroFrame):
|
|
|
563
545
|
Returns:
|
|
564
546
|
tuple: Data and parameters used in each method.
|
|
565
547
|
"""
|
|
566
|
-
|
|
548
|
+
b = kwargs2instance(Beam, kw)
|
|
567
549
|
self._kw.update(kw)
|
|
568
550
|
xskip = self._kw.pop('xskip', 1)
|
|
569
551
|
yskip = self._kw.pop('yskip', 1)
|
|
570
|
-
d =
|
|
552
|
+
d = kwargs2instance(AstroData, self._kw)
|
|
571
553
|
self.read(d, xskip, yskip)
|
|
572
|
-
self.beam = d.beam
|
|
573
554
|
self.sigma = d.sigma
|
|
574
555
|
singlepix = d.dx is None or d.dy is None
|
|
575
|
-
|
|
576
|
-
|
|
556
|
+
if len(d.beam) == 4:
|
|
557
|
+
b.beam = self.beam = next(b for b in d.beam if None not in b)
|
|
558
|
+
else:
|
|
559
|
+
b.beam = self.beam = d.beam
|
|
560
|
+
self.add_beam(**b.todict())
|
|
561
|
+
return (d.data, d.x, d.y, d.v, d.sigma, d.bunit,
|
|
562
|
+
self._kw, singlepix)
|
|
577
563
|
|
|
578
564
|
def add_region(self, patch: str = 'ellipse',
|
|
579
565
|
poslist: list[str | list[float, float]] = [],
|
|
@@ -622,7 +608,7 @@ class PlotAstroData(AstroFrame):
|
|
|
622
608
|
axnow.add_patch(p)
|
|
623
609
|
|
|
624
610
|
def add_beam(self, show_beam: bool = True,
|
|
625
|
-
beam: list[float | None
|
|
611
|
+
beam: list[float | None] = [None] * 3,
|
|
626
612
|
beamcolor: str = 'gray',
|
|
627
613
|
beampos: list[float, float] | None = None,
|
|
628
614
|
**kwargs) -> None:
|
|
@@ -853,21 +839,15 @@ class PlotAstroData(AstroFrame):
|
|
|
853
839
|
self._kw = {'cmap': 'cubehelix', 'alpha': 1,
|
|
854
840
|
'edgecolors': 'none', 'zorder': 1,
|
|
855
841
|
'vmin': None, 'vmax': None}
|
|
856
|
-
c, x, y, v,
|
|
857
|
-
= self._map_init(kwargs)
|
|
842
|
+
c, x, y, v, sigma, bunit, _kw, singlepix = self._map_init(kwargs)
|
|
858
843
|
if singlepix:
|
|
859
844
|
print('No pixel size. Skip add_color.')
|
|
860
845
|
return
|
|
861
846
|
|
|
862
|
-
if cblabel is None
|
|
863
|
-
cblabel = bunit
|
|
847
|
+
cblabel = bunit if cblabel is None else cblabel
|
|
864
848
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if k in _kw:
|
|
868
|
-
stretch_params[k] = _kw.pop(k)
|
|
869
|
-
st = Stretcher(vmin=_kw['vmin'], vmax=_kw['vmax'],
|
|
870
|
-
sigma=sigma, **stretch_params)
|
|
849
|
+
_kw['sigma'] = sigma
|
|
850
|
+
st = kwargs2instance(Stretcher, _kw)
|
|
871
851
|
c, cmin, cmax = st.set_minmax(c)
|
|
872
852
|
_kw['vmin'] = cmin
|
|
873
853
|
_kw['vmax'] = cmax
|
|
@@ -882,7 +862,6 @@ class PlotAstroData(AstroFrame):
|
|
|
882
862
|
for ch in self.bottomleft:
|
|
883
863
|
self._set_colorbar(p, ch, show_cbar, cblabel, cbformat,
|
|
884
864
|
cbticks, cbticklabels, cblocation, st)
|
|
885
|
-
self.add_beam(beam=beam, **beam_kwargs)
|
|
886
865
|
|
|
887
866
|
def add_contour(self,
|
|
888
867
|
levels: list[float] = [-12, -6, -3, 3, 6, 12, 24, 48, 96, 192, 384],
|
|
@@ -893,8 +872,7 @@ class PlotAstroData(AstroFrame):
|
|
|
893
872
|
levels (list, optional): Contour levels in the unit of sigma. Defaults to [-12,-6,-3,3,6,12,24,48,96,192,384].
|
|
894
873
|
"""
|
|
895
874
|
self._kw = {'colors': 'gray', 'linewidths': 1.0, 'zorder': 2}
|
|
896
|
-
c, x, y, v,
|
|
897
|
-
= self._map_init(kwargs)
|
|
875
|
+
c, x, y, v, sigma, _, _kw, singlepix = self._map_init(kwargs)
|
|
898
876
|
if singlepix:
|
|
899
877
|
print('No pixel size. Skip add_contour.')
|
|
900
878
|
return
|
|
@@ -904,7 +882,6 @@ class PlotAstroData(AstroFrame):
|
|
|
904
882
|
c = [c[self.channelnumber]]
|
|
905
883
|
for axnow, cnow in zip(self.ax, c):
|
|
906
884
|
axnow.contour(x, y, cnow, np.sort(levels) * sigma, **_kw)
|
|
907
|
-
self.add_beam(beam=beam, **beam_kwargs)
|
|
908
885
|
|
|
909
886
|
def add_segment(self,
|
|
910
887
|
ampfits: str = None, angfits: str = None,
|
|
@@ -938,16 +915,13 @@ class PlotAstroData(AstroFrame):
|
|
|
938
915
|
'headaxislength': 0, 'width': 0.007, 'zorder': 3,
|
|
939
916
|
'fitsimage': [ampfits, angfits, Ufits, Qfits],
|
|
940
917
|
'data': [amp, ang, stU, stQ]}
|
|
941
|
-
c, x, y, v,
|
|
942
|
-
= self._map_init(kwargs)
|
|
918
|
+
c, x, y, v, sigma, _, _kw, singlepix = self._map_init(kwargs)
|
|
943
919
|
if singlepix:
|
|
944
920
|
print('No pixel size. Skip add_segment.')
|
|
945
921
|
return
|
|
946
922
|
|
|
947
923
|
amp, ang, stU, stQ = c
|
|
948
924
|
sigmaU, sigmaQ = sigma[2:]
|
|
949
|
-
beam = [beam[i] for i in range(4) if beam[i][0] is not None][0]
|
|
950
|
-
self.beam = beam
|
|
951
925
|
if stU is not None and stQ is not None:
|
|
952
926
|
self.sigma = sigma = (sigmaU + sigmaQ) / 2.
|
|
953
927
|
ang = np.degrees(np.arctan2(stU, stQ) / 2.)
|
|
@@ -968,12 +942,11 @@ class PlotAstroData(AstroFrame):
|
|
|
968
942
|
_kw['scale'] = 1. / np.abs(x[1] - x[0])
|
|
969
943
|
for axnow, unow, vnow in zip(self.ax, U, V):
|
|
970
944
|
axnow.quiver(x, y, unow, vnow, **_kw)
|
|
971
|
-
self.add_beam(beam=beam, **beam_kwargs)
|
|
972
945
|
|
|
973
946
|
def add_rgb(self,
|
|
974
|
-
stretch: list[str
|
|
975
|
-
stretchscale: list[float | None
|
|
976
|
-
stretchpower: list[float
|
|
947
|
+
stretch: list[str] = ['linear'] * 3,
|
|
948
|
+
stretchscale: list[float | None] = [None] * 3,
|
|
949
|
+
stretchpower: list[float] = [0.5] * 3,
|
|
977
950
|
**kwargs) -> None:
|
|
978
951
|
"""Use PIL.Image and imshow of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted. A three-element array ([red, green, blue]) is supposed for all arguments, except for xskip, yskip and show_beam, including vmax and vmin. kwargs may include the arguments for Stretcher (stretch, stretchscale, and stretchpower; three-element array for each) to specify the stretch parameters. kwargs may include arguments for add_beam() and a dict of beam_kwargs to specify the beam patch in more detail. kwargs may include xskiip and yskip.
|
|
979
952
|
|
|
@@ -984,9 +957,10 @@ class PlotAstroData(AstroFrame):
|
|
|
984
957
|
"""
|
|
985
958
|
from PIL import Image
|
|
986
959
|
|
|
987
|
-
self._kw = {'vmin': [None] * 3, 'vmax': [None] * 3
|
|
988
|
-
|
|
989
|
-
|
|
960
|
+
self._kw = {'vmin': [None] * 3, 'vmax': [None] * 3,
|
|
961
|
+
'stretch': stretch, 'stretchscale': stretchscale,
|
|
962
|
+
'stretchpower': stretchpower}
|
|
963
|
+
c, x, y, v, _, _, _kw, singlepix = self._map_init(kwargs)
|
|
990
964
|
if singlepix:
|
|
991
965
|
print('No pixel size. Skip add_rgb.')
|
|
992
966
|
return
|
|
@@ -995,8 +969,7 @@ class PlotAstroData(AstroFrame):
|
|
|
995
969
|
print('RGB shapes mismatch. Skip add_rgb.')
|
|
996
970
|
return
|
|
997
971
|
|
|
998
|
-
st = Stretcher
|
|
999
|
-
_kw['vmin'], _kw['vmax'], sigma)
|
|
972
|
+
st = kwargs2instance(Stretcher, _kw)
|
|
1000
973
|
c, cmin, cmax = st.set_minmax(c)
|
|
1001
974
|
for i in range(st.n):
|
|
1002
975
|
if cmax[i] > cmin[i]:
|
|
@@ -1012,7 +985,6 @@ class PlotAstroData(AstroFrame):
|
|
|
1012
985
|
im.putpixel((i, j), value)
|
|
1013
986
|
axnow.imshow(im, extent=[x[0], x[-1], y[0], y[-1]])
|
|
1014
987
|
axnow.set_aspect(np.abs((x[-1]-x[0]) / (y[-1]-y[0])))
|
|
1015
|
-
self.add_beam(beam=beam, **beam_kwargs)
|
|
1016
988
|
|
|
1017
989
|
def _set_axis_shared(self, pa2: PlotAxes2D, title: dict | str | None):
|
|
1018
990
|
"""Internal method used in set_axis() and set_axis_radec().
|
|
@@ -1072,7 +1044,7 @@ class PlotAstroData(AstroFrame):
|
|
|
1072
1044
|
_kw['xlim'] = self.Xlim
|
|
1073
1045
|
if 'ylim' not in _kw:
|
|
1074
1046
|
_kw['ylim'] = self.Ylim
|
|
1075
|
-
pa2 =
|
|
1047
|
+
pa2 = kwargs2instance(PlotAxes2D, _kw)
|
|
1076
1048
|
self._set_axis_shared(pa2=pa2, title=title)
|
|
1077
1049
|
|
|
1078
1050
|
def set_axis_radec(self, center: str | None = None,
|
|
@@ -1265,8 +1237,8 @@ def plotprofile(coords: list[str] | str = [],
|
|
|
1265
1237
|
_kwgauss.update(gauss_kwargs)
|
|
1266
1238
|
if type(coords) is str:
|
|
1267
1239
|
coords = [coords]
|
|
1268
|
-
f =
|
|
1269
|
-
d =
|
|
1240
|
+
f = kwargs2instance(AstroFrame, _kw)
|
|
1241
|
+
d = kwargs2instance(AstroData, _kw)
|
|
1270
1242
|
f.read(d)
|
|
1271
1243
|
d.binning([width, 1, 1])
|
|
1272
1244
|
v, prof, gfitres = d.profile(coords=coords, xlist=xlist, ylist=ylist,
|
|
@@ -1301,7 +1273,7 @@ def plotprofile(coords: list[str] | str = [],
|
|
|
1301
1273
|
if 'xlim' not in _kw:
|
|
1302
1274
|
_kw['xlim'] = [v.min(), v.max()]
|
|
1303
1275
|
_kw['samexy'] = False
|
|
1304
|
-
pa2 =
|
|
1276
|
+
pa2 = kwargs2instance(PlotAxes2D, _kw)
|
|
1305
1277
|
for i in range(nprof):
|
|
1306
1278
|
sharex = None if i < nrows - 1 else ax[i - 1]
|
|
1307
1279
|
ax[i] = fig.add_subplot(nrows, ncols, i + 1, sharex=sharex)
|
|
@@ -1350,8 +1322,8 @@ def plotslice(length: float, dx: float | None = None, pa: float = 0,
|
|
|
1350
1322
|
_kw = {'linestyle': '-', 'marker': 'o'}
|
|
1351
1323
|
_kw.update(kwargs)
|
|
1352
1324
|
_kw['rmax'] = length / 2
|
|
1353
|
-
f =
|
|
1354
|
-
d =
|
|
1325
|
+
f = kwargs2instance(AstroFrame, _kw)
|
|
1326
|
+
d = kwargs2instance(AstroData, _kw)
|
|
1355
1327
|
f.read(d)
|
|
1356
1328
|
if np.ndim(d.data) > 2:
|
|
1357
1329
|
print('Only 2D map is supported.')
|
|
@@ -1378,7 +1350,7 @@ def plotslice(length: float, dx: float | None = None, pa: float = 0,
|
|
|
1378
1350
|
fig = plt.figure()
|
|
1379
1351
|
if ax is None:
|
|
1380
1352
|
ax = fig.add_subplot(1, 1, 1)
|
|
1381
|
-
pa2 =
|
|
1353
|
+
pa2 = kwargs2instance(PlotAxes2D, _kw)
|
|
1382
1354
|
ax.plot(r, z, **_kw)
|
|
1383
1355
|
if d.sigma is not None:
|
|
1384
1356
|
ax.plot(r, r * 0 + 3 * d.sigma, 'k--')
|
|
@@ -1431,8 +1403,8 @@ def plot3d(levels: list[float] = [3, 6, 12],
|
|
|
1431
1403
|
import plotly.graph_objs as go
|
|
1432
1404
|
from skimage import measure
|
|
1433
1405
|
|
|
1434
|
-
f =
|
|
1435
|
-
d =
|
|
1406
|
+
f = kwargs2instance(AstroFrame, kwargs)
|
|
1407
|
+
d = kwargs2instance(AstroData, kwargs)
|
|
1436
1408
|
f.read(d, xskip, yskip)
|
|
1437
1409
|
volume, x, y, v, sigma = d.data, d.x, d.y, d.v, d.sigma
|
|
1438
1410
|
dx, dy, dv = d.dx, d.dy, d.dv
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.14
|
|
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
|