plotastrodata 1.2.0__tar.gz → 1.2.1__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.2.0 → plotastrodata-1.2.1}/PKG-INFO +1 -1
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/plot_utils.py +38 -37
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/PKG-INFO +1 -1
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/LICENSE +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/README.md +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/analysis_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/fft_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/fitting_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata/other_utils.py +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/setup.cfg +0 -0
- {plotastrodata-1.2.0 → plotastrodata-1.2.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
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
|
|
@@ -290,24 +290,16 @@ def kwargs2PlotAxes2D(kw: dict) -> PlotAxes2D:
|
|
|
290
290
|
class PlotAstroData(AstroFrame):
|
|
291
291
|
"""Make a figure from 2D/3D FITS files or 2D/3D arrays.
|
|
292
292
|
|
|
293
|
-
Basic rules ---
|
|
294
|
-
with a velocity axis must be given to set up channels in each page.
|
|
295
|
-
For 2D/3D data, the spatial center can be read from a FITS file
|
|
296
|
-
or manually given.
|
|
293
|
+
Basic rules ---
|
|
294
|
+
For 3D data, a 1D velocity array or a FITS file with a velocity axis must be given to set up channels in each page.
|
|
295
|
+
For 2D/3D data, the spatial center can be read from a FITS file or manually given.
|
|
297
296
|
len(v)=1 (default) means to make a 2D figure.
|
|
298
297
|
Spatial lengths are in the unit of arcsec, or au if dist (!= 1) is given.
|
|
299
298
|
Angles are in the unit of degree.
|
|
300
|
-
For region, line, arrow, label, and marker,
|
|
301
|
-
a
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
like '01h23m45.6s 01d23m45.6s' or a list of relative x and y
|
|
305
|
-
like [0.2, 0.3] (0 is left or bottom, 1 is right or top).
|
|
306
|
-
Parameters for original methods in matplotlib.axes.Axes can be
|
|
307
|
-
used as kwargs; see the default _kw for reference.
|
|
308
|
-
Position-velocity diagrams (pv=True) does not yet suppot region, line,
|
|
309
|
-
arrow, and segment because the units of abscissa and ordinate
|
|
310
|
-
are different.
|
|
299
|
+
For region, line, arrow, label, and marker, a single input can be treated without a list, e.g., anglelist=60, as well as anglelist=[60].
|
|
300
|
+
Each element of poslist supposes a text coordinate like '01h23m45.6s 01d23m45.6s' or a list of relative x and y like [0.2, 0.3] (0 is left or bottom, 1 is right or top).
|
|
301
|
+
Parameters for original methods in matplotlib.axes.Axes can be used as kwargs; see the default _kw for reference.
|
|
302
|
+
Position-velocity diagrams (pv=True) does not yet suppot region, line, arrow, and segment because the units of abscissa and ordinate are different.
|
|
311
303
|
|
|
312
304
|
kwargs is the arguments of AstroFrame to define plotting ranges.
|
|
313
305
|
|
|
@@ -483,14 +475,14 @@ class PlotAstroData(AstroFrame):
|
|
|
483
475
|
def add_beam(self,
|
|
484
476
|
beam: list[float | None, float | None, float | None] = [None, None, None],
|
|
485
477
|
beamcolor: str = 'gray',
|
|
486
|
-
|
|
478
|
+
beampos: list[float, float] | None = None,
|
|
487
479
|
dv: float | None = None, pvpa: float | None = None) -> None:
|
|
488
480
|
"""Use add_region().
|
|
489
481
|
|
|
490
482
|
Args:
|
|
491
483
|
beam (list, optional): [bmaj, bmin, bpa]. Defaults to [None, None, None].
|
|
492
484
|
beamcolor (str, optional): matplotlib color. Defaults to 'gray'.
|
|
493
|
-
|
|
485
|
+
beampos (list, optional): relative position. Defaults to None.
|
|
494
486
|
dv (float, optional): velocity resolution for a PV diagram. Defaults to None.
|
|
495
487
|
pvpa (float, optional): position angle of the PV cut in the unit of degrees. Defaults to None.
|
|
496
488
|
"""
|
|
@@ -506,38 +498,42 @@ class PlotAstroData(AstroFrame):
|
|
|
506
498
|
p = np.radians(beam[2] - pvpa)
|
|
507
499
|
b = 1 / np.hypot(np.cos(p) / beam[0], np.sin(p) / beam[1]) / self.rmax
|
|
508
500
|
b = np.array([b, dv])
|
|
509
|
-
if
|
|
510
|
-
|
|
501
|
+
if beampos is None:
|
|
502
|
+
beampos = [max(0.35 * b[0], 0.1), 0.1]
|
|
511
503
|
if self.swapxy:
|
|
512
|
-
|
|
504
|
+
beampos = np.transpose(beampos)
|
|
513
505
|
b = np.transpose(b)
|
|
514
506
|
b = np.append(b, 0)
|
|
515
507
|
patch = 'rectangle'
|
|
516
508
|
else:
|
|
517
|
-
if
|
|
518
|
-
|
|
509
|
+
if beampos is None:
|
|
510
|
+
beampos = [max(0.35 * beam[0] / self.rmax, 0.1)] * 2
|
|
519
511
|
b = beam
|
|
520
512
|
patch = 'ellipse'
|
|
521
|
-
self.add_region(patch, poslist,
|
|
513
|
+
self.add_region(patch=patch, poslist=beampos,
|
|
514
|
+
majlist=b[0], minlist=b[1], palist=b[2],
|
|
522
515
|
include_chan=include_chan,
|
|
523
516
|
facecolor=beamcolor, edgecolor=None)
|
|
524
517
|
|
|
525
|
-
def _beam(self, show_beam: bool, beamcolor: str | list[str],
|
|
518
|
+
def _beam(self, show_beam: bool, beamcolor: str | list[str],
|
|
519
|
+
beampos: list[float, float] | None, d: AstroData) -> None:
|
|
526
520
|
"""Internal wrapper of add_beam().
|
|
527
521
|
|
|
528
522
|
Args:
|
|
529
523
|
show_beam (bool): Whether to show the beam(s).
|
|
530
524
|
beamcolor (str | list[str]): Color name.
|
|
525
|
+
beampos (list): Relative position.
|
|
531
526
|
d (AstroData): For reading the velocity resolution, beam, and pvpa.
|
|
532
527
|
"""
|
|
533
528
|
if show_beam:
|
|
534
529
|
dv = d.v[1] - d.v[0] if self.pv else None
|
|
535
530
|
c = type(beamcolor) is list
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
531
|
+
blist = d.beam if c or np.ndim(d.beam) == 2 else [d.beam]
|
|
532
|
+
bclist = beamcolor if c else [beamcolor]
|
|
533
|
+
bplist = beampos if c else [beampos]
|
|
534
|
+
palist = d.pvpa if c else [d.pvpa]
|
|
535
|
+
for b, bc, bp, pa in zip(blist, bclist, bplist, palist):
|
|
536
|
+
self.add_beam(beam=b, beamcolor=bc, beampos=bp, dv=dv, pvpa=pa)
|
|
541
537
|
|
|
542
538
|
def add_marker(self, poslist: list[str | list[float, float]] = [],
|
|
543
539
|
include_chan: list[int] | None = None, **kwargs) -> None:
|
|
@@ -675,7 +671,7 @@ class PlotAstroData(AstroFrame):
|
|
|
675
671
|
cbformat: float = '%.1e', cbticks: list[float] | None = None,
|
|
676
672
|
cbticklabels: list[str] | None = None, cblocation: str = 'right',
|
|
677
673
|
show_beam: bool = True, beamcolor: str = 'gray',
|
|
678
|
-
**kwargs) -> None:
|
|
674
|
+
beampos: list[float, float] | None = None, **kwargs) -> None:
|
|
679
675
|
"""Use Axes.pcolormesh of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted.
|
|
680
676
|
|
|
681
677
|
Args:
|
|
@@ -691,6 +687,7 @@ class PlotAstroData(AstroFrame):
|
|
|
691
687
|
cblocation (str, optional): 'left', 'top', 'left', 'right'. Only for 2D images. Defaults to 'right'.
|
|
692
688
|
show_beam (bool, optional): Defaults to True.
|
|
693
689
|
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
690
|
+
beampos (list, optional): Relative position. Defaults to None.
|
|
694
691
|
"""
|
|
695
692
|
_kw = {'cmap': 'cubehelix', 'alpha': 1, 'edgecolors': 'none', 'zorder': 1}
|
|
696
693
|
_kw.update(kwargs)
|
|
@@ -751,12 +748,12 @@ class PlotAstroData(AstroFrame):
|
|
|
751
748
|
ticklin = 1 + (1 - stretchpower) * np.log(10) * t
|
|
752
749
|
ticklin = cmin_org * ticklin**(1 / (1 - stretchpower))
|
|
753
750
|
cb.set_ticklabels([f'{d:{cbformat[1:]}}' for d in ticklin])
|
|
754
|
-
self._beam(show_beam, beamcolor, d)
|
|
751
|
+
self._beam(show_beam, beamcolor, beampos, d)
|
|
755
752
|
|
|
756
753
|
def add_contour(self, xskip: int = 1, yskip: int = 1,
|
|
757
754
|
levels: list[float] = [-12, -6, -3, 3, 6, 12, 24, 48, 96, 192, 384],
|
|
758
755
|
show_beam: bool = True, beamcolor: str = 'gray',
|
|
759
|
-
**kwargs) -> None:
|
|
756
|
+
beampos: list[float, float] | None = None, **kwargs) -> None:
|
|
760
757
|
"""Use Axes.contour of matplotlib. kwargs must include the arguments of AstroData to specify the data to be plotted.
|
|
761
758
|
|
|
762
759
|
Args:
|
|
@@ -764,6 +761,7 @@ class PlotAstroData(AstroFrame):
|
|
|
764
761
|
levels (list, optional): Contour levels in the unit of sigma. Defaults to [-12,-6,-3,3,6,12,24,48,96,192,384].
|
|
765
762
|
show_beam (bool, optional): Defaults to True.
|
|
766
763
|
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
764
|
+
beampos (list, optional): Relative position. Defaults to None.
|
|
767
765
|
"""
|
|
768
766
|
_kw = {'colors': 'gray', 'linewidths': 1.0, 'zorder': 2}
|
|
769
767
|
_kw.update(kwargs)
|
|
@@ -777,7 +775,7 @@ class PlotAstroData(AstroFrame):
|
|
|
777
775
|
c = [c[self.channelnumber]]
|
|
778
776
|
for axnow, cnow in zip(self.ax, c):
|
|
779
777
|
axnow.contour(x, y, cnow, np.sort(levels) * sigma, **_kw)
|
|
780
|
-
self._beam(show_beam, beamcolor, d)
|
|
778
|
+
self._beam(show_beam, beamcolor, beampos, d)
|
|
781
779
|
|
|
782
780
|
def add_segment(self, ampfits: str = None, angfits: str = None,
|
|
783
781
|
Ufits: str = None, Qfits: str = None,
|
|
@@ -790,7 +788,7 @@ class PlotAstroData(AstroFrame):
|
|
|
790
788
|
rotation: float = 0.,
|
|
791
789
|
cutoff: float = 3.,
|
|
792
790
|
show_beam: bool = True, beamcolor: str = 'gray',
|
|
793
|
-
**kwargs) -> None:
|
|
791
|
+
beampos: list[float, float] | None = None, **kwargs) -> None:
|
|
794
792
|
"""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].
|
|
795
793
|
|
|
796
794
|
Args:
|
|
@@ -809,6 +807,7 @@ class PlotAstroData(AstroFrame):
|
|
|
809
807
|
cutoff (float, optional): Used when amp and ang are calculated from Stokes U and Q. In the unit of sigma. Defaults to 3..
|
|
810
808
|
show_beam (bool, optional): Defaults to True.
|
|
811
809
|
beamcolor (str, optional): Matplotlib color. Defaults to 'gray'.
|
|
810
|
+
beampos (list, optional): Relative position. Defaults to None.
|
|
812
811
|
"""
|
|
813
812
|
_kw = {'angles': 'xy', 'scale_units': 'xy', 'color': 'gray',
|
|
814
813
|
'pivot': 'mid', 'headwidth': 0, 'headlength': 0,
|
|
@@ -843,7 +842,7 @@ class PlotAstroData(AstroFrame):
|
|
|
843
842
|
_kw['scale'] = 1 if len(x) == 1 else 1. / np.abs(x[1] - x[0])
|
|
844
843
|
for axnow, unow, vnow in zip(self.ax, U, V):
|
|
845
844
|
axnow.quiver(x, y, unow, vnow, **_kw)
|
|
846
|
-
self._beam(show_beam,
|
|
845
|
+
self._beam(show_beam, beamcolor, beampos, d)
|
|
847
846
|
|
|
848
847
|
def add_rgb(self, xskip: int = 1, yskip: int = 1,
|
|
849
848
|
stretch: list[str, str, str] = ['linear'] * 3,
|
|
@@ -851,6 +850,7 @@ class PlotAstroData(AstroFrame):
|
|
|
851
850
|
stretchpower: float = 0,
|
|
852
851
|
show_beam: bool = True,
|
|
853
852
|
beamcolor: list[str, str, str] = ['red', 'green', 'blue'],
|
|
853
|
+
beampos: list[list[float, float] | None] = [None, None, None],
|
|
854
854
|
**kwargs) -> None:
|
|
855
855
|
"""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.
|
|
856
856
|
|
|
@@ -860,7 +860,8 @@ class PlotAstroData(AstroFrame):
|
|
|
860
860
|
stretchscale (float, optional): color scale is asinh(data / stretchscale). Defaults to None.
|
|
861
861
|
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.
|
|
862
862
|
show_beam (bool, optional): Defaults to True.
|
|
863
|
-
beamcolor (
|
|
863
|
+
beamcolor (list, optional): Matplotlib color. Defaults to ['red', 'green', 'blue'].
|
|
864
|
+
beampos (list, optional): Relative position. Defaults to None.
|
|
864
865
|
"""
|
|
865
866
|
from PIL import Image
|
|
866
867
|
|
|
@@ -893,7 +894,7 @@ class PlotAstroData(AstroFrame):
|
|
|
893
894
|
im.putpixel((i, j), value)
|
|
894
895
|
axnow.imshow(im, extent=[x[0], x[-1], y[0], y[-1]])
|
|
895
896
|
axnow.set_aspect(np.abs((x[-1]-x[0]) / (y[-1]-y[0])))
|
|
896
|
-
self._beam(show_beam, beamcolor, d)
|
|
897
|
+
self._beam(show_beam, beamcolor, beampos, d)
|
|
897
898
|
|
|
898
899
|
def set_axis(self, title: dict | str | None = None, **kwargs) -> None:
|
|
899
900
|
"""Use Axes.set_* of matplotlib. kwargs can include the arguments of PlotAxes2D to adjust x and y axis.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
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
|