plotastrodata 1.8.0__tar.gz → 1.8.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.8.0/plotastrodata.egg-info → plotastrodata-1.8.1}/PKG-INFO +1 -1
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/__init__.py +1 -1
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/noise_utils.py +27 -2
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/plot_utils.py +31 -6
- {plotastrodata-1.8.0 → plotastrodata-1.8.1/plotastrodata.egg-info}/PKG-INFO +1 -1
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/LICENSE +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/MANIFEST.in +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/README.md +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/analysis_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/const_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/coord_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/ext_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/fft_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/fits_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/fitting_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/los_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/matrix_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata/other_utils.py +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata.egg-info/SOURCES.txt +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/setup.cfg +0 -0
- {plotastrodata-1.8.0 → plotastrodata-1.8.1}/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.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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
import numpy as np
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
3
4
|
from scipy.special import erf
|
|
4
5
|
|
|
5
6
|
from plotastrodata.fitting_utils import EmceeCorner
|
|
@@ -157,12 +158,36 @@ class Noise:
|
|
|
157
158
|
self.std = float(self.popt[0] * self.s0)
|
|
158
159
|
self.model = model(self.hbin, *self.popt)
|
|
159
160
|
|
|
161
|
+
def plot_histogram(self, savefig: dict | str | None = None,
|
|
162
|
+
show: bool = False):
|
|
163
|
+
"""Make a simple figure of the histogram and model.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
|
|
167
|
+
show (bool, optional): True means doing plt.show(). Defaults to False.
|
|
168
|
+
"""
|
|
169
|
+
savefig0 = {'bbox_inches': 'tight', 'transparent': True}
|
|
170
|
+
fig = plt.figure()
|
|
171
|
+
ax = fig.add_subplot(1, 1, 1)
|
|
172
|
+
ax.plot(self.hbin, self.hist, drawstyle='steps-mid')
|
|
173
|
+
ax.plot(self.hbin, self.model, '-')
|
|
174
|
+
ax.set_xlabel('(noise - m0) / s0')
|
|
175
|
+
ax.set_ylabel('Probability density')
|
|
176
|
+
fig.tight_layout()
|
|
177
|
+
if savefig is not None:
|
|
178
|
+
s = {'fname': savefig} if type(savefig) is str else savefig
|
|
179
|
+
savefig0.update(s)
|
|
180
|
+
fig.savefig(**savefig0)
|
|
181
|
+
if show:
|
|
182
|
+
plt.show()
|
|
183
|
+
plt.close()
|
|
184
|
+
|
|
160
185
|
|
|
161
186
|
def estimate_rms(data: np.ndarray,
|
|
162
187
|
sigma: float | str | None = 'hist'
|
|
163
188
|
) -> float:
|
|
164
|
-
"""Estimate a noise level of a
|
|
165
|
-
When a float number or None is given, this function just outputs it.
|
|
189
|
+
"""Estimate a noise level of a data array.
|
|
190
|
+
When a float number or None is given as sigma, this function just outputs it.
|
|
166
191
|
|
|
167
192
|
Args:
|
|
168
193
|
data (np.ndarray): Data array whose noise is estimated.
|
|
@@ -88,7 +88,7 @@ class PlotAxes2D():
|
|
|
88
88
|
aspect (dict or float, optional): Defaults to None.
|
|
89
89
|
"""
|
|
90
90
|
samexy: bool = True
|
|
91
|
-
loglog:
|
|
91
|
+
loglog: float | None = None
|
|
92
92
|
xscale: str = 'linear'
|
|
93
93
|
yscale: str = 'linear'
|
|
94
94
|
xlim: list | None = None
|
|
@@ -99,8 +99,8 @@ class PlotAxes2D():
|
|
|
99
99
|
yticks: list | None = None
|
|
100
100
|
xticklabels: list | None = None
|
|
101
101
|
yticklabels: list | None = None
|
|
102
|
-
xticksminor: list | int = None
|
|
103
|
-
yticksminor: list | int = None
|
|
102
|
+
xticksminor: list | int | None = None
|
|
103
|
+
yticksminor: list | int | None = None
|
|
104
104
|
grid: dict | None = None
|
|
105
105
|
aspect: dict | float | None = None
|
|
106
106
|
|
|
@@ -1170,9 +1170,12 @@ def plotprofile(coords: list[str] | str = [],
|
|
|
1170
1170
|
title: list[str] | None = None,
|
|
1171
1171
|
text: list[str] | None = None,
|
|
1172
1172
|
dist: float = 1., vsys: float = 0.,
|
|
1173
|
-
nrows: int = 0, ncols: int = 1,
|
|
1173
|
+
nrows: int = 0, ncols: int = 1,
|
|
1174
|
+
fig: object | None = None,
|
|
1175
|
+
ax: object | None = None,
|
|
1174
1176
|
getfigax: bool = False,
|
|
1175
|
-
savefig: dict
|
|
1177
|
+
savefig: dict | str | None = None,
|
|
1178
|
+
show: bool = False,
|
|
1176
1179
|
**kwargs) -> tuple[object, object]:
|
|
1177
1180
|
"""Use Axes.plot of matplotlib to plot line profiles at given coordinates. kwargs must include the arguments of AstroData to specify the data to be plotted. kwargs can include the arguments of PlotAxes2D to adjust x and y axes.
|
|
1178
1181
|
|
|
@@ -1188,6 +1191,15 @@ def plotprofile(coords: list[str] | str = [],
|
|
|
1188
1191
|
gauss_kwargs (dict, optional): Kwargs for Axes.plot. Defaults to {}.
|
|
1189
1192
|
title (list, optional): For each plot. Defaults to None.
|
|
1190
1193
|
text (list, optional): For each plot. Defaults to None.
|
|
1194
|
+
dist (float, optional): Change x and y in arcsec to au. Defaults to 1..
|
|
1195
|
+
vsys (float, optional): Each channel shows v-vsys. Defaults to 0..
|
|
1196
|
+
nrows (int, optional): Used for channel maps. Defaults to 0.
|
|
1197
|
+
ncols (int, optional): Used for channel maps. Defaults to 1.
|
|
1198
|
+
fig (optional): External plt.figure(). Defaults to None.
|
|
1199
|
+
ax (optional): External fig.add_subplot(). Defaults to None.
|
|
1200
|
+
getfigax (bool, optional): Defaults to False.
|
|
1201
|
+
savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
|
|
1202
|
+
show (bool, optional): True means doing plt.show(). Defaults to False.
|
|
1191
1203
|
|
|
1192
1204
|
Returns:
|
|
1193
1205
|
tuple: (fig, ax), where ax is a list, if getfigax=True. Otherwise, no return.
|
|
@@ -1281,7 +1293,20 @@ def plotslice(length: float, dx: float | None = None, pa: float = 0,
|
|
|
1281
1293
|
length (float): Slice length.
|
|
1282
1294
|
dx (float, optional): Grid increment. Defaults to None.
|
|
1283
1295
|
pa (float, optional): Degree. Position angle. Defaults to 0.
|
|
1284
|
-
|
|
1296
|
+
dist (float, optional): For AstroFrame. Defaults to 1.
|
|
1297
|
+
xoff (float, optional): For AstroFrame. Defaults to 0.
|
|
1298
|
+
yoff (float, optional): For AstroFrame. Defaults to 0.
|
|
1299
|
+
xflip (bool, optional): For AstroFrame. Defaults to True.
|
|
1300
|
+
yflip (bool, optional): For AstroFrame. Defaults to False.
|
|
1301
|
+
txtfile (str, optional): File name for numpy.savetxt(). Defaults to None.
|
|
1302
|
+
fig (optional): External plt.figure(). Defaults to None.
|
|
1303
|
+
ax (optional): External fig.add_subplot(). Defaults to None.
|
|
1304
|
+
getfigax (bool, optional): Defaults to False.
|
|
1305
|
+
savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
|
|
1306
|
+
show (bool, optional): True means doing plt.show(). Defaults to False.
|
|
1307
|
+
|
|
1308
|
+
Returns:
|
|
1309
|
+
tuple: (fig, ax), where ax is a list, if getfigax=True. Otherwise, no return.
|
|
1285
1310
|
"""
|
|
1286
1311
|
_kw = {'linestyle': '-', 'marker': 'o'}
|
|
1287
1312
|
_kw.update(kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|