plotastrodata 1.8.9__tar.gz → 1.8.10__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.9/plotastrodata.egg-info → plotastrodata-1.8.10}/PKG-INFO +1 -1
  2. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/plot_utils.py +27 -62
  4. {plotastrodata-1.8.9 → plotastrodata-1.8.10/plotastrodata.egg-info}/PKG-INFO +1 -1
  5. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/LICENSE +0 -0
  6. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/MANIFEST.in +0 -0
  7. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/README.md +0 -0
  8. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/analysis_utils.py +0 -0
  9. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/const_utils.py +0 -0
  10. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/coord_utils.py +0 -0
  11. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/ext_utils.py +0 -0
  12. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/fft_utils.py +0 -0
  13. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/fits_utils.py +0 -0
  14. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/fitting_utils.py +0 -0
  15. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/los_utils.py +0 -0
  16. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/matrix_utils.py +0 -0
  17. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/noise_utils.py +0 -0
  18. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata/other_utils.py +0 -0
  19. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata.egg-info/SOURCES.txt +0 -0
  20. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata.egg-info/dependency_links.txt +0 -0
  21. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata.egg-info/not-zip-safe +0 -0
  22. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata.egg-info/requires.txt +0 -0
  23. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/plotastrodata.egg-info/top_level.txt +0 -0
  24. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/setup.cfg +0 -0
  25. {plotastrodata-1.8.9 → plotastrodata-1.8.10}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.9
3
+ Version: 1.8.10
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.9'
4
+ __version__ = '1.8.10'
@@ -95,36 +95,6 @@ def logcbticks(vmin: float = -3.01, vmax: float = 3.01
95
95
  return ticks, ticklabels
96
96
 
97
97
 
98
- def pow10(x: np.ndarray, stretchpower: float) -> np.ndarray:
99
- """A power-law function scaled by xmin. This function is used for the case of stretch='power' in PlotAstroData.add_color().
100
-
101
- Args:
102
- x (np.ndarray): Input in the linear scale.
103
- stretchpower (float, optional): The output is (data**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale.
104
-
105
- Returns:
106
- np.ndarray: Output values.
107
- """
108
- p = 1e-6 if stretchpower == 0 else stretchpower
109
- y = (x**p - 1) / p / np.log(10)
110
- return y
111
-
112
-
113
- def ipow10(x: np.ndarray, stretchpower: float) -> np.ndarray:
114
- """The inverse function of pow10. This function is used for the case of stretch='power' in PlotAstroData.add_color().
115
-
116
- Args:
117
- x (np.ndarray): Input values.
118
- stretchpower (float, optional): The input is (data**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale.
119
-
120
- Returns:
121
- np.ndarray: Output values in the linear scale.
122
- """
123
- p = 1e-6 if stretchpower == 0 else stretchpower
124
- y = (1 + p * np.log(10) * x)**(1 / p)
125
- return y
126
-
127
-
128
98
  def do_stretch(x: list | np.ndarray,
129
99
  stretch: str, stretchscale: float,
130
100
  stretchpower: float) -> np.ndarray:
@@ -133,8 +103,8 @@ def do_stretch(x: list | np.ndarray,
133
103
  Args:
134
104
  x (list | np.ndarray): Input array in the linear scale.
135
105
  stretch (str): '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'.
136
- stretchscale (float, optional): The output is asinh(data / stretchscale). Defaults to None.
137
- stretchpower (float, optional): The output is ((data / stretchscale)**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale.
106
+ stretchscale (float): The output is asinh(data / stretchscale).
107
+ stretchpower (float): The output is data**stretchpower / stretchpower. 1 means the linear scale, while 0 means the logarithmic scale.
138
108
 
139
109
  Returns:
140
110
  np.ndarray: Output stretched array.
@@ -146,7 +116,8 @@ def do_stretch(x: list | np.ndarray,
146
116
  case 'asinh':
147
117
  t = np.arcsinh(t / stretchscale)
148
118
  case 'power':
149
- t = pow10(t / stretchscale, stretchpower)
119
+ p = 1e-6 if stretchpower == 0 else stretchpower
120
+ t = t**p / p
150
121
  return t
151
122
 
152
123
 
@@ -158,8 +129,8 @@ def undo_stretch(x: list | np.ndarray,
158
129
  Args:
159
130
  x (list | np.ndarray): Input stretched array.
160
131
  stretch (str): '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'.
161
- stretchscale (float, optional): The input is asinh(data / stretchscale). Defaults to None.
162
- stretchpower (float, optional): The input is ((data / stretchscale)**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale.
132
+ stretchscale (float): The input is asinh(data / stretchscale).
133
+ stretchpower (float): The input is data**stretchpower / stretchpower. 1 means the linear scale, while 0 means the logarithmic scale.
163
134
 
164
135
  Returns:
165
136
  np.ndarray: Output array in the linear scale.
@@ -171,7 +142,8 @@ def undo_stretch(x: list | np.ndarray,
171
142
  case 'asinh':
172
143
  t = np.sinh(t) * stretchscale
173
144
  case 'power':
174
- t = ipow10(t, stretchpower) * stretchscale
145
+ p = 1e-6 if stretchpower == 0 else stretchpower
146
+ t = (t * p)**(1 / p)
175
147
  return t
176
148
 
177
149
 
@@ -285,9 +257,9 @@ def set_minmax(data: np.ndarray, stretch: str, stretchscale: float,
285
257
 
286
258
  Args:
287
259
  data (np.ndarray): Plotted data.
288
- stretch (str): 'log', 'asinh', 'power'. Any other means linear.
289
- stretchscale (float): For the arcsinh strech and the power stretch.
290
- stretchpower (float): For the power strech.
260
+ stretch (str): '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'.
261
+ stretchscale (float): The input is asinh(data / stretchscale).
262
+ stretchpower (float): The input is data**stretchpower / stretchpower. 1 means the linear scale, while 0 means the logarithmic scale.
291
263
  sigma (float): Noise level.
292
264
  kw (dict): Probably like {'vmin':0, 'vmax':1}.
293
265
 
@@ -346,8 +318,7 @@ def kwargs2AstroData(kw: dict) -> AstroData:
346
318
  d = AstroData(data=np.zeros((2, 2)))
347
319
  for k in vars(d):
348
320
  if k in kw:
349
- tmp[k] = kw[k]
350
- del kw[k]
321
+ tmp[k] = kw.pop(k)
351
322
  if tmp == {}:
352
323
  print('No argument given.')
353
324
  return None
@@ -389,8 +360,7 @@ def kwargs2PlotAxes2D(kw: dict) -> PlotAxes2D:
389
360
  d = PlotAxes2D()
390
361
  for k in vars(d):
391
362
  if k in kw:
392
- tmp[k] = kw[k]
393
- del kw[k]
363
+ tmp[k] = kw.pop(k)
394
364
  d = PlotAxes2D(**tmp)
395
365
  return d
396
366
 
@@ -407,11 +377,8 @@ def kwargs2beamargs(kw: dict) -> dict:
407
377
  tmp = {}
408
378
  for k in ['show_beam', 'beamcolor', 'beampos']:
409
379
  if k in kw:
410
- tmp[k] = kw[k]
411
- del kw[k]
412
- if 'beam_kwargs' in kw:
413
- tmp.update(kw['beam_kwargs'])
414
- del kw['beam_kwargs']
380
+ tmp[k] = kw.pop(k)
381
+ tmp.update(kw.pop('beam_kwargs', {}))
415
382
  return tmp
416
383
 
417
384
 
@@ -598,16 +565,8 @@ class PlotAstroData(AstroFrame):
598
565
  """
599
566
  beam_kwargs = kwargs2beamargs(kw)
600
567
  self._kw.update(kw)
601
- if 'xskip' in self._kw:
602
- xskip = self._kw['xskip']
603
- del self._kw['xskip']
604
- else:
605
- xskip = 1
606
- if 'yskip' in self._kw:
607
- yskip = self._kw['yskip']
608
- del self._kw['yskip']
609
- else:
610
- yskip = 1
568
+ xskip = self._kw.pop('xskip', 1)
569
+ yskip = self._kw.pop('yskip', 1)
611
570
  d = kwargs2AstroData(self._kw)
612
571
  self.read(d, xskip, yskip)
613
572
  self.beam = d.beam
@@ -736,6 +695,11 @@ class PlotAstroData(AstroFrame):
736
695
  """
737
696
  _kw = {'color': 'gray', 'fontsize': 15, 'ha': 'center',
738
697
  'va': 'center', 'zorder': 10}
698
+ subkeys = {'ha': 'horizontalalignment',
699
+ 'va': 'verticalalignment'}
700
+ for short, long in subkeys.items():
701
+ if long in kwargs:
702
+ kwargs[short] = kwargs.pop(long)
739
703
  _kw.update(kwargs)
740
704
  if include_chan is None:
741
705
  include_chan = self.allchan
@@ -820,7 +784,7 @@ class PlotAstroData(AstroFrame):
820
784
  linewidth (float, optional): Width of the bar. Defaults to 3.
821
785
  """
822
786
  if length == 0:
823
- print('Please input length to add_scalebar().')
787
+ print('No length is given. Skip add_scalebar().')
824
788
  return
825
789
  if fontsize is None:
826
790
  fontsize = 20 if len(self.ax) == 1 else 15
@@ -890,7 +854,7 @@ class PlotAstroData(AstroFrame):
890
854
  Args:
891
855
  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'.
892
856
  stretchscale (float, optional): Color scale is asinh(data / stretchscale). Defaults to None.
893
- stretchpower (float, optional): Color scale is ((data / stretchscale)**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale. Defaults to 0.5.
857
+ stretchpower (float, optional): Color scale is data**stretchpower / stretchpower. 1 means the linear scale, while 0 means the logarithmic scale. Defaults to 0.5.
894
858
  show_cbar (bool, optional): Show color bar. Defaults to True.
895
859
  cblabel (str, optional): Colorbar label. Defaults to None.
896
860
  cbformat (float, optional): Format for ticklabels of colorbar. Defaults to '%.1e'.
@@ -1023,7 +987,7 @@ class PlotAstroData(AstroFrame):
1023
987
  Args:
1024
988
  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'.
1025
989
  stretchscale (float, optional): Color scale is asinh(data / stretchscale). Defaults to None.
1026
- stretchpower (float, optional): Color scale is ((data / stretchscale)**stretchpower - 1) / stretchpower / ln(10). 1 means the linear scale, while 0 means the logarithmic scale. Defaults to 1.
990
+ stretchpower (float, optional): Color scale is data**stretchpower / stretchpower. 1 means the linear scale, while 0 means the logarithmic scale. Defaults to 1.
1027
991
  """
1028
992
  from PIL import Image
1029
993
 
@@ -1253,7 +1217,8 @@ class PlotAstroData(AstroFrame):
1253
1217
  tuple: (fig, ax)
1254
1218
  """
1255
1219
  if len(self.ax) > 1:
1256
- print('get_figax is not supported with channel maps')
1220
+ print('PlotAstroData.get_figax() is not supported'
1221
+ + ' with channel maps')
1257
1222
  return
1258
1223
 
1259
1224
  fig = plt.figure(0) if self.fig is None else self.fig
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.9
3
+ Version: 1.8.10
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