plotastrodata 1.4.5__tar.gz → 1.4.6__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.4.5 → plotastrodata-1.4.6}/PKG-INFO +1 -1
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/plot_utils.py +39 -49
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/PKG-INFO +1 -1
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/LICENSE +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/README.md +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/analysis_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/coord_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/ext_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/fft_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/fitting_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/matrix_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata/other_utils.py +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/setup.cfg +0 -0
- {plotastrodata-1.4.5 → plotastrodata-1.4.6}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.6
|
|
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
|
|
@@ -293,6 +293,26 @@ def kwargs2PlotAxes2D(kw: dict) -> PlotAxes2D:
|
|
|
293
293
|
return d
|
|
294
294
|
|
|
295
295
|
|
|
296
|
+
def kwargs2beamargs(kw: dict) -> dict:
|
|
297
|
+
"""Get arguments for add_beam() from kwargs.
|
|
298
|
+
|
|
299
|
+
Args:
|
|
300
|
+
kw (dict): Parameters to make beam.
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
dict: Arguments for add_beam().
|
|
304
|
+
"""
|
|
305
|
+
tmp = {}
|
|
306
|
+
for k in ['show_beam', 'beamcolor', 'beampos']:
|
|
307
|
+
if k in kw:
|
|
308
|
+
tmp[k] = kw[k]
|
|
309
|
+
del kw[k]
|
|
310
|
+
if 'beam_kwargs' in kw:
|
|
311
|
+
tmp.update(kw['beam_kwargs'])
|
|
312
|
+
del kw['beam_kwargs']
|
|
313
|
+
return tmp
|
|
314
|
+
|
|
315
|
+
|
|
296
316
|
class PlotAstroData(AstroFrame):
|
|
297
317
|
"""Make a figure from 2D/3D FITS files or 2D/3D arrays.
|
|
298
318
|
|
|
@@ -478,7 +498,7 @@ class PlotAstroData(AstroFrame):
|
|
|
478
498
|
angle=angle * self.xdir, **_kw)
|
|
479
499
|
axnow.add_patch(p)
|
|
480
500
|
|
|
481
|
-
def add_beam(self,
|
|
501
|
+
def add_beam(self, show_beam: bool = True,
|
|
482
502
|
beam: list[float | None, float | None, float | None] = [None, None, None],
|
|
483
503
|
beamcolor: str = 'gray',
|
|
484
504
|
beampos: list[float, float] | None = None,
|
|
@@ -486,10 +506,13 @@ class PlotAstroData(AstroFrame):
|
|
|
486
506
|
"""Use add_region(). All the arguments may be a list of each format.
|
|
487
507
|
|
|
488
508
|
Args:
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
509
|
+
show_beam (bool, optional): Defaults to True.
|
|
510
|
+
beam (list, optional): [bmaj, bmin, bpa]. This may be a list of list. Defaults to [None, None, None].
|
|
511
|
+
beamcolor (str, optional): matplotlib color. This may be a list of str. Defaults to 'gray'.
|
|
512
|
+
beampos (list, optional): Relative position. This may be a list of list or a list of None. Defaults to None.
|
|
492
513
|
"""
|
|
514
|
+
if not show_beam:
|
|
515
|
+
return
|
|
493
516
|
include_chan = self.bottomleft if self.channelnumber is None else self.allchan
|
|
494
517
|
patch = 'rectangle' if self.pv else 'ellipse'
|
|
495
518
|
blist = [beam] if np.ndim(beam) == 1 else beam
|
|
@@ -648,11 +671,8 @@ class PlotAstroData(AstroFrame):
|
|
|
648
671
|
show_cbar: bool = True, cblabel: str | None = None,
|
|
649
672
|
cbformat: float = '%.1e', cbticks: list[float] | None = None,
|
|
650
673
|
cbticklabels: list[str] | None = None, cblocation: str = 'right',
|
|
651
|
-
show_beam: bool = True, beamcolor: str = 'gray',
|
|
652
|
-
beampos: list[float, float] | None = None,
|
|
653
|
-
beam_kwargs: dict = {},
|
|
654
674
|
**kwargs) -> None:
|
|
655
|
-
"""Use Axes.pcolormesh of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted.
|
|
675
|
+
"""Use Axes.pcolormesh of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted. kwargs may include arguments for add_beam() and a dict of beam_kwargs to specify the beam patch in more detail.
|
|
656
676
|
|
|
657
677
|
Args:
|
|
658
678
|
xskip, yskip (int, optional): Spatial pixel skip. Defaults to 1.
|
|
@@ -665,12 +685,9 @@ class PlotAstroData(AstroFrame):
|
|
|
665
685
|
cbticks (list, optional): Ticks of colorbar. Defaults to None.
|
|
666
686
|
cbticklabels (list, optional): Ticklabels of colorbar. Defaults to None.
|
|
667
687
|
cblocation (str, optional): 'left', 'top', 'left', 'right'. Only for 2D images. Defaults to 'right'.
|
|
668
|
-
show_beam (bool, optional): Defaults to True.
|
|
669
|
-
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
670
|
-
beampos (list, optional): Relative position. Defaults to None.
|
|
671
|
-
beam_kwargs (dict, optional): Keyword arguments for add_beam(). Defaults to {}.
|
|
672
688
|
"""
|
|
673
689
|
_kw = {'cmap': 'cubehelix', 'alpha': 1, 'edgecolors': 'none', 'zorder': 1}
|
|
690
|
+
beam_kwargs = kwargs2beamargs(kwargs)
|
|
674
691
|
_kw.update(kwargs)
|
|
675
692
|
d = kwargs2AstroData(_kw)
|
|
676
693
|
self.read(d, xskip, yskip)
|
|
@@ -729,27 +746,19 @@ class PlotAstroData(AstroFrame):
|
|
|
729
746
|
ticklin = 1 + (1 - stretchpower) * np.log(10) * t
|
|
730
747
|
ticklin = cmin_org * ticklin**(1 / (1 - stretchpower))
|
|
731
748
|
cb.set_ticklabels([f'{d:{cbformat[1:]}}' for d in ticklin])
|
|
732
|
-
|
|
733
|
-
self.add_beam(beam=beam, beamcolor=beamcolor, beampos=beampos,
|
|
734
|
-
**beam_kwargs)
|
|
749
|
+
self.add_beam(beam=beam, **beam_kwargs)
|
|
735
750
|
|
|
736
751
|
def add_contour(self, xskip: int = 1, yskip: int = 1,
|
|
737
752
|
levels: list[float] = [-12, -6, -3, 3, 6, 12, 24, 48, 96, 192, 384],
|
|
738
|
-
show_beam: bool = True, beamcolor: str = 'gray',
|
|
739
|
-
beampos: list[float, float] | None = None,
|
|
740
|
-
beam_kwargs: dict = {},
|
|
741
753
|
**kwargs) -> None:
|
|
742
|
-
"""Use Axes.contour of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted.
|
|
754
|
+
"""Use Axes.contour of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted. kwargs may include arguments for add_beam() and a dict of beam_kwargs to specify the beam patch in more detail.
|
|
743
755
|
|
|
744
756
|
Args:
|
|
745
757
|
xskip, yskip (int, optional): Spatial pixel skip. Defaults to 1.
|
|
746
758
|
levels (list, optional): Contour levels in the unit of sigma. Defaults to [-12,-6,-3,3,6,12,24,48,96,192,384].
|
|
747
|
-
show_beam (bool, optional): Defaults to True.
|
|
748
|
-
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
749
|
-
beampos (list, optional): Relative position. Defaults to None.
|
|
750
|
-
beam_kwargs (dict, optional): Keyword arguments for add_beam(). Defaults to {}.
|
|
751
759
|
"""
|
|
752
760
|
_kw = {'colors': 'gray', 'linewidths': 1.0, 'zorder': 2}
|
|
761
|
+
beam_kwargs = kwargs2beamargs(kwargs)
|
|
753
762
|
_kw.update(kwargs)
|
|
754
763
|
d = kwargs2AstroData(_kw)
|
|
755
764
|
self.read(d, xskip, yskip)
|
|
@@ -761,9 +770,7 @@ class PlotAstroData(AstroFrame):
|
|
|
761
770
|
c = [c[self.channelnumber]]
|
|
762
771
|
for axnow, cnow in zip(self.ax, c):
|
|
763
772
|
axnow.contour(x, y, cnow, np.sort(levels) * sigma, **_kw)
|
|
764
|
-
|
|
765
|
-
self.add_beam(beam=beam, beamcolor=beamcolor, beampos=beampos,
|
|
766
|
-
**beam_kwargs)
|
|
773
|
+
self.add_beam(beam=beam, **beam_kwargs)
|
|
767
774
|
|
|
768
775
|
def add_segment(self, ampfits: str = None, angfits: str = None,
|
|
769
776
|
Ufits: str = None, Qfits: str = None,
|
|
@@ -775,11 +782,8 @@ class PlotAstroData(AstroFrame):
|
|
|
775
782
|
ampfactor: float = 1., angonly: bool = False,
|
|
776
783
|
rotation: float = 0.,
|
|
777
784
|
cutoff: float = 3.,
|
|
778
|
-
show_beam: bool = True, beamcolor: str = 'gray',
|
|
779
|
-
beampos: list[float, float] | None = None,
|
|
780
|
-
beam_kwargs: dict = {},
|
|
781
785
|
**kwargs) -> None:
|
|
782
|
-
"""Use Axes.quiver of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted. fitsimage = [ampfits, angfits, Ufits, Qfits]. data = [amp, ang, stU, stQ].
|
|
786
|
+
"""Use Axes.quiver of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted. fitsimage = [ampfits, angfits, Ufits, Qfits]. data = [amp, ang, stU, stQ]. kwargs may include arguments for add_beam() and a dict of beam_kwargs to specify the beam patch in more detail.
|
|
783
787
|
|
|
784
788
|
Args:
|
|
785
789
|
ampfits (str, optional): In put fits name. Length of segment. Defaults to None.
|
|
@@ -795,14 +799,11 @@ class PlotAstroData(AstroFrame):
|
|
|
795
799
|
angonly (bool, optional): True means amp=1 for all. Defaults to False.
|
|
796
800
|
rotation (float, optional): Segment angle is ang + rotation. Defaults to 0..
|
|
797
801
|
cutoff (float, optional): Used when amp and ang are calculated from Stokes U and Q. In the unit of sigma. Defaults to 3..
|
|
798
|
-
show_beam (bool, optional): Defaults to True.
|
|
799
|
-
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
800
|
-
beampos (list, optional): Relative position. Defaults to None.
|
|
801
|
-
beam_kwargs (dict, optional): Keyword arguments for add_beam(). Defaults to {}.
|
|
802
802
|
"""
|
|
803
803
|
_kw = {'angles': 'xy', 'scale_units': 'xy', 'color': 'gray',
|
|
804
804
|
'pivot': 'mid', 'headwidth': 0, 'headlength': 0,
|
|
805
805
|
'headaxislength': 0, 'width': 0.007, 'zorder': 3}
|
|
806
|
+
beam_kwargs = kwargs2beamargs(kwargs)
|
|
806
807
|
_kw.update(kwargs)
|
|
807
808
|
_kw['data'] = [amp, ang, stU, stQ]
|
|
808
809
|
_kw['fitsimage'] = [ampfits, angfits, Ufits, Qfits]
|
|
@@ -833,34 +834,25 @@ class PlotAstroData(AstroFrame):
|
|
|
833
834
|
_kw['scale'] = 1 if len(x) == 1 else 1. / np.abs(x[1] - x[0])
|
|
834
835
|
for axnow, unow, vnow in zip(self.ax, U, V):
|
|
835
836
|
axnow.quiver(x, y, unow, vnow, **_kw)
|
|
836
|
-
|
|
837
|
-
self.add_beam(beam=beam, beamcolor=beamcolor, beampos=beampos,
|
|
838
|
-
**beam_kwargs)
|
|
837
|
+
self.add_beam(beam=beam, **beam_kwargs)
|
|
839
838
|
|
|
840
839
|
def add_rgb(self, xskip: int = 1, yskip: int = 1,
|
|
841
840
|
stretch: list[str, str, str] = ['linear'] * 3,
|
|
842
841
|
stretchscale: list[float | None, float | None, float | None] = [None] * 3,
|
|
843
842
|
stretchpower: float = 0,
|
|
844
|
-
show_beam: bool = True,
|
|
845
|
-
beamcolor: list[str, str, str] = ['red', 'green', 'blue'],
|
|
846
|
-
beampos: list[list[float, float] | None] = [None, None, None],
|
|
847
|
-
beam_kwargs: dict = {},
|
|
848
843
|
**kwargs) -> None:
|
|
849
|
-
"""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.
|
|
844
|
+
"""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 arguments for add_beam() and a dict of beam_kwargs to specify the beam patch in more detail.
|
|
850
845
|
|
|
851
846
|
Args:
|
|
852
847
|
xskip, yskip (int, optional): Spatial pixel skip. Defaults to 1.
|
|
853
848
|
stretch (str, optional): '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'.
|
|
854
849
|
stretchscale (float, optional): color scale is asinh(data / stretchscale). Defaults to None.
|
|
855
850
|
stretchpower (float, optional): color scale is ((data / vmin)**(1 - stretchpower) - 1) / (1 - stretchpower) / ln(10). 0 means the linear scale. 1 means the logarithmic scale. Defaults to 0.
|
|
856
|
-
show_beam (bool, optional): Defaults to True.
|
|
857
|
-
beamcolor (list, optional): Matplotlib color. Defaults to ['red', 'green', 'blue'].
|
|
858
|
-
beampos (list, optional): Relative position. Defaults to None.
|
|
859
|
-
beam_kwargs (dict, optional): Keyword arguments for add_beam(). Defaults to {}.
|
|
860
851
|
"""
|
|
861
852
|
from PIL import Image
|
|
862
853
|
|
|
863
854
|
_kw = {}
|
|
855
|
+
beam_kwargs = kwargs2beamargs(kwargs)
|
|
864
856
|
_kw.update(kwargs)
|
|
865
857
|
d = kwargs2AstroData(_kw)
|
|
866
858
|
self.read(d, xskip, yskip)
|
|
@@ -889,9 +881,7 @@ class PlotAstroData(AstroFrame):
|
|
|
889
881
|
im.putpixel((i, j), value)
|
|
890
882
|
axnow.imshow(im, extent=[x[0], x[-1], y[0], y[-1]])
|
|
891
883
|
axnow.set_aspect(np.abs((x[-1]-x[0]) / (y[-1]-y[0])))
|
|
892
|
-
|
|
893
|
-
self.add_beam(beam=beam, beamcolor=beamcolor, beampos=beampos,
|
|
894
|
-
**beam_kwargs)
|
|
884
|
+
self.add_beam(beam=beam, **beam_kwargs)
|
|
895
885
|
|
|
896
886
|
def _set_axis_shared(self, pa2: PlotAxes2D, title: dict | str | None):
|
|
897
887
|
"""Internal method used in set_axis() and set_axis_radec().
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.6
|
|
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
|