plotastrodata 1.8.2__tar.gz → 1.8.3__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.
Files changed (25) hide show
  1. {plotastrodata-1.8.2/plotastrodata.egg-info → plotastrodata-1.8.3}/PKG-INFO +1 -1
  2. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/noise_utils.py +2 -9
  4. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/other_utils.py +22 -0
  5. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/plot_utils.py +5 -29
  6. {plotastrodata-1.8.2 → plotastrodata-1.8.3/plotastrodata.egg-info}/PKG-INFO +1 -1
  7. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/LICENSE +0 -0
  8. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/MANIFEST.in +0 -0
  9. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/README.md +0 -0
  10. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/analysis_utils.py +0 -0
  11. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/const_utils.py +0 -0
  12. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/coord_utils.py +0 -0
  13. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/ext_utils.py +0 -0
  14. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/fft_utils.py +0 -0
  15. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/fits_utils.py +0 -0
  16. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/fitting_utils.py +0 -0
  17. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/los_utils.py +0 -0
  18. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata/matrix_utils.py +0 -0
  19. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata.egg-info/SOURCES.txt +0 -0
  20. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata.egg-info/dependency_links.txt +0 -0
  21. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata.egg-info/not-zip-safe +0 -0
  22. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata.egg-info/requires.txt +0 -0
  23. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/plotastrodata.egg-info/top_level.txt +0 -0
  24. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/setup.cfg +0 -0
  25. {plotastrodata-1.8.2 → plotastrodata-1.8.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.2
3
+ Version: 1.8.3
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,4 +1,4 @@
1
1
  import warnings
2
2
 
3
3
  warnings.simplefilter('ignore', FutureWarning)
4
- __version__ = '1.8.2'
4
+ __version__ = '1.8.3'
@@ -4,6 +4,7 @@ import matplotlib.pyplot as plt
4
4
  from scipy.special import erf
5
5
 
6
6
  from plotastrodata.fitting_utils import EmceeCorner
7
+ from plotastrodata.other_utils import close_figure
7
8
 
8
9
 
9
10
  def normalize(range: tuple = (-3.5, 3.5), bins: int = 100):
@@ -166,21 +167,13 @@ class Noise:
166
167
  savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
167
168
  show (bool, optional): True means doing plt.show(). Defaults to False.
168
169
  """
169
- savefig0 = {'bbox_inches': 'tight', 'transparent': True}
170
170
  fig = plt.figure()
171
171
  ax = fig.add_subplot(1, 1, 1)
172
172
  ax.plot(self.hbin, self.hist, drawstyle='steps-mid')
173
173
  ax.plot(self.hbin, self.model, '-')
174
174
  ax.set_xlabel('(noise - m0) / s0')
175
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()
176
+ close_figure(fig, savefig, show)
184
177
 
185
178
 
186
179
  def estimate_rms(data: np.ndarray,
@@ -1,4 +1,5 @@
1
1
  import numpy as np
2
+ import matplotlib.pyplot as plt
2
3
  from scipy.interpolate import RegularGridInterpolator as RGI
3
4
 
4
5
  from plotastrodata.matrix_utils import Mrot, dot2d
@@ -206,3 +207,24 @@ def gaussian2d(xy: np.ndarray,
206
207
  s, t = dot2d(Mrot(-pa), [xy[1] - yo, xy[0] - xo])
207
208
  g = amplitude * np.exp2(-4 * ((s / fwhm_major)**2 + (t / fwhm_minor)**2))
208
209
  return g
210
+
211
+
212
+ def close_figure(fig: object,
213
+ savefig: dict | str | None = None,
214
+ show: bool = False) -> None:
215
+ """Save, show, and close the figure.
216
+
217
+ Args:
218
+ fig (object): External plt.figure(). Defaults to None.
219
+ savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
220
+ show (bool, optional): True means doing plt.show(). Defaults to False.
221
+ """
222
+ savefig0 = {'bbox_inches': 'tight', 'transparent': True}
223
+ fig.tight_layout()
224
+ if savefig is not None:
225
+ s = {'fname': savefig} if type(savefig) is str else savefig
226
+ savefig0.update(s)
227
+ fig.savefig(**savefig0)
228
+ if show:
229
+ plt.show()
230
+ plt.close()
@@ -7,7 +7,7 @@ from dataclasses import dataclass
7
7
 
8
8
  from plotastrodata.coord_utils import coord2xy, xy2coord
9
9
  from plotastrodata.noise_utils import estimate_rms
10
- from plotastrodata.other_utils import listing
10
+ from plotastrodata.other_utils import listing, close_figure
11
11
  from plotastrodata.analysis_utils import AstroData, AstroFrame
12
12
 
13
13
 
@@ -1163,30 +1163,6 @@ class PlotAstroData(AstroFrame):
1163
1163
  return fig, self.ax[0]
1164
1164
 
1165
1165
 
1166
- def close_figure(fig: object,
1167
- savefig: dict | str | None = None,
1168
- show: bool = False) -> tuple[object, object]:
1169
- """Save, show, and close the figure.
1170
-
1171
- Args:
1172
- fig (optional): External plt.figure(). Defaults to None.
1173
- savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
1174
- show (bool, optional): True means doing plt.show(). Defaults to False.
1175
-
1176
- Returns:
1177
- tuple: (fig, ax), where ax is a list, if getfigax=True. Otherwise, no return.
1178
- """
1179
- savefig0 = {'bbox_inches': 'tight', 'transparent': True}
1180
- fig.tight_layout()
1181
- if savefig is not None:
1182
- s = {'fname': savefig} if type(savefig) is str else savefig
1183
- savefig0.update(s)
1184
- fig.savefig(**savefig0)
1185
- if show:
1186
- plt.show()
1187
- plt.close()
1188
-
1189
-
1190
1166
  def plotprofile(coords: list[str] | str = [],
1191
1167
  xlist: list[float] = [], ylist: list[float] = [],
1192
1168
  ellipse: list[float, float, float] | None = None,
@@ -1218,8 +1194,8 @@ def plotprofile(coords: list[str] | str = [],
1218
1194
  text (list, optional): For each plot. Defaults to None.
1219
1195
  nrows (int, optional): Used for channel maps. Defaults to 0.
1220
1196
  ncols (int, optional): Used for channel maps. Defaults to 1.
1221
- fig (optional): External plt.figure(). Defaults to None.
1222
- ax (optional): External fig.add_subplot(). Defaults to None.
1197
+ fig (object, optional): External plt.figure(). Defaults to None.
1198
+ ax (object, optional): External fig.add_subplot(). Defaults to None.
1223
1199
  getfigax (bool, optional): Defaults to False.
1224
1200
  savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
1225
1201
  show (bool, optional): True means doing plt.show(). Defaults to False.
@@ -1306,8 +1282,8 @@ def plotslice(length: float, dx: float | None = None, pa: float = 0,
1306
1282
  dx (float, optional): Grid increment. Defaults to None.
1307
1283
  pa (float, optional): Degree. Position angle. Defaults to 0.
1308
1284
  txtfile (str, optional): File name for numpy.savetxt(). Defaults to None.
1309
- fig (optional): External plt.figure(). Defaults to None.
1310
- ax (optional): External fig.add_subplot(). Defaults to None.
1285
+ fig (object, optional): External plt.figure(). Defaults to None.
1286
+ ax (object, optional): External fig.add_subplot(). Defaults to None.
1311
1287
  getfigax (bool, optional): Defaults to False.
1312
1288
  savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
1313
1289
  show (bool, optional): True means doing plt.show(). Defaults to False.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.2
3
+ Version: 1.8.3
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