plotastrodata 1.8.4__tar.gz → 1.8.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.
Files changed (25) hide show
  1. {plotastrodata-1.8.4/plotastrodata.egg-info → plotastrodata-1.8.6}/PKG-INFO +1 -1
  2. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/analysis_utils.py +6 -2
  4. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/noise_utils.py +6 -0
  5. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/plot_utils.py +34 -1
  6. {plotastrodata-1.8.4 → plotastrodata-1.8.6/plotastrodata.egg-info}/PKG-INFO +1 -1
  7. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/LICENSE +0 -0
  8. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/MANIFEST.in +0 -0
  9. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/README.md +0 -0
  10. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/const_utils.py +0 -0
  11. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/coord_utils.py +0 -0
  12. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/ext_utils.py +0 -0
  13. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/fft_utils.py +0 -0
  14. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/fits_utils.py +0 -0
  15. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/fitting_utils.py +0 -0
  16. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/los_utils.py +0 -0
  17. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/matrix_utils.py +0 -0
  18. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata/other_utils.py +0 -0
  19. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata.egg-info/SOURCES.txt +0 -0
  20. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata.egg-info/dependency_links.txt +0 -0
  21. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata.egg-info/not-zip-safe +0 -0
  22. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata.egg-info/requires.txt +0 -0
  23. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/plotastrodata.egg-info/top_level.txt +0 -0
  24. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/setup.cfg +0 -0
  25. {plotastrodata-1.8.4 → plotastrodata-1.8.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.4
3
+ Version: 1.8.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
@@ -1,4 +1,4 @@
1
1
  import warnings
2
2
 
3
3
  warnings.simplefilter('ignore', FutureWarning)
4
- __version__ = '1.8.4'
4
+ __version__ = '1.8.6'
@@ -155,6 +155,12 @@ class AstroData():
155
155
  ws = ', '.join([f'{s:d}' for s in w[1:]])
156
156
  print(f'width was changed to [{ws}].')
157
157
  newsize = size // w
158
+ if w[1] > 1:
159
+ print(f'sigma has been divided by sqrt({w[1]:d})'
160
+ + ' because of binning in the v-axis.')
161
+ self.sigma = self.sigma / np.sqrt(w[1])
162
+ if w[2] > 1 or w[3] > 1:
163
+ print('Binning in the x- or y-axis does not update sigma.')
158
164
  grid = [None, self.v, self.y, self.x]
159
165
  dgrid = [None, self.dv, self.dy, self.dx]
160
166
  for n in range(1, 4):
@@ -181,8 +187,6 @@ class AstroData():
181
187
  self.data = np.squeeze(d)
182
188
  _, self.v, self.y, self.x = grid
183
189
  _, self.dv, self.dy, self.dx = dgrid
184
- s = 'AstroData.sigma is not updated by AstroData.binning().'
185
- warnings.warn(s, UserWarning)
186
190
 
187
191
  def centering(self, includexy: bool = True,
188
192
  includev: bool = False,
@@ -142,6 +142,9 @@ class Noise:
142
142
  """
143
143
  _kw = {'nwalkersperdim': 4, 'nsteps': 200, 'nburnin': 0}
144
144
  _kw.update(kwargs)
145
+ if not hasattr(self, 'hist'):
146
+ self.gen_histogram()
147
+ print('Noise.gen_histogram() was done with default arguments.')
145
148
  f = gauss_pbcor if 'pbcor' in self.sigma else gauss
146
149
  model = normalize(range=self.range, bins=self.bins)(f)
147
150
  bounds = [[0.1, 2], [-2, 2]]
@@ -167,6 +170,9 @@ class Noise:
167
170
  savefig (dict or str, optional): For plt.figure().savefig(). Defaults to None.
168
171
  show (bool, optional): True means doing plt.show(). Defaults to False.
169
172
  """
173
+ if not hasattr(self, 'model'):
174
+ self.fit_histogram()
175
+ print('Noise.fit_histogram() was done with default arguments.')
170
176
  fig, ax = plt.subplots()
171
177
  ax.plot(self.hbin, self.hist, drawstyle='steps-mid')
172
178
  ax.plot(self.hbin, self.model, '-')
@@ -65,6 +65,36 @@ def logticks(ticks: list[float], lim: list[float, float]
65
65
  return newticks, newlabels
66
66
 
67
67
 
68
+ def logcbticks(vmin: float = -3.01, vmax: float = 3.01
69
+ ) -> tuple[np.ndarray, np.ndarray]:
70
+ """Make nice ticks for a log color bar.
71
+
72
+ Args:
73
+ vmin (float, optional): Minimum value. Defaults to -3.01.
74
+ vmax (float, optional): Maximum value. Defaults to 3.01.
75
+
76
+ Returns:
77
+ tuple: (ticks, ticklabels).
78
+ """
79
+ ticks = np.outer(np.logspace(-3, 3, 7), np.arange(1, 10))
80
+ ticklabels = []
81
+ for i in range(-3, 4):
82
+ ii = np.abs(min(i, 0))
83
+ ii = f'{ii:d}'
84
+ for j in range(1, 10):
85
+ jj = j * 10**i
86
+ if j in [1, 2, 5]:
87
+ s = f'{jj:.{ii}f}'
88
+ else:
89
+ s = ''
90
+ ticklabels.append(s)
91
+ ticks = np.log10(np.ravel(ticks))
92
+ ticklabels = np.ravel(ticklabels)
93
+ ticklabels = ticklabels[((vmin < ticks) * (ticks < vmax))]
94
+ ticks = ticks[((vmin < ticks) * (ticks < vmax))]
95
+ return ticks, ticklabels
96
+
97
+
68
98
  @dataclass
69
99
  class PlotAxes2D():
70
100
  """Use Axes.set_* to adjust x and y axes.
@@ -771,6 +801,7 @@ class PlotAstroData(AstroFrame):
771
801
  stretchscale = sigma
772
802
  cmin_org = _kw['vmin'] if 'vmin' in _kw else sigma
773
803
  c = set_minmax(c, stretch, stretchscale, stretchpower, sigma, _kw)
804
+ cmin, cmax = np.nanmin(c), np.nanmax(c)
774
805
  c = self.vskipfill(c, v)
775
806
  if type(self.channelnumber) is int:
776
807
  c = [c[self.channelnumber]]
@@ -810,13 +841,15 @@ class PlotAstroData(AstroFrame):
810
841
  p = 1 - stretchpower
811
842
  cbticks = (cbticks / cmin_org)**p - 1
812
843
  cbticks = cbticks / p / np.log(10)
844
+ if stretch == 'log' and cbticks is None:
845
+ cbticks, cbticklabels = logcbticks(cmin, cmax)
813
846
  if cbticks is not None:
814
847
  cb.set_ticks(cbticks)
815
848
  if cbticklabels is not None:
816
849
  cb.set_ticklabels(cbticklabels)
817
850
  elif stretch in ['log', 'asinh', 'power']:
818
851
  t = cb.get_ticks()
819
- t = t[(_kw['vmin'] < t) * (t < _kw['vmax'])]
852
+ t = t[(cmin < t) * (t < cmax)]
820
853
  cb.set_ticks(t)
821
854
  if stretch == 'log':
822
855
  ticklin = 10**t
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotastrodata
3
- Version: 1.8.4
3
+ Version: 1.8.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