plotastrodata 1.2.7.post3__tar.gz → 1.2.9__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 (20) hide show
  1. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/PKG-INFO +1 -1
  2. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/__init__.py +1 -1
  3. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/analysis_utils.py +1 -3
  4. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/plot_utils.py +40 -49
  5. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/PKG-INFO +1 -1
  6. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/LICENSE +0 -0
  7. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/README.md +0 -0
  8. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/const_utils.py +0 -0
  9. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/fft_utils.py +0 -0
  10. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/fits_utils.py +0 -0
  11. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/fitting_utils.py +0 -0
  12. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/los_utils.py +0 -0
  13. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata/other_utils.py +0 -0
  14. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/SOURCES.txt +0 -0
  15. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/dependency_links.txt +0 -0
  16. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/not-zip-safe +0 -0
  17. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/requires.txt +0 -0
  18. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/plotastrodata.egg-info/top_level.txt +0 -0
  19. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/setup.cfg +0 -0
  20. {plotastrodata-1.2.7.post3 → plotastrodata-1.2.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plotastrodata
3
- Version: 1.2.7.post3
3
+ Version: 1.2.9
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', UserWarning)
4
- __version__ = '1.2.7-3'
4
+ __version__ = '1.2.9'
@@ -59,8 +59,6 @@ def quadrantmean(data: np.ndarray, x: np.ndarray, y: np.ndarray,
59
59
  else:
60
60
  print('quadrants must be \'13\' or \'24\'.')
61
61
  datanew = (datanew + datanew[::-1, ::-1]) / 2.
62
- print(np.shape(datanew), np.shape(xnew), np.shape(ynew))
63
- print(np.shape(datanew[ny:, nx:]), np.shape(xnew[nx:]), np.shape(ynew[ny:]))
64
62
  return datanew[ny:, nx:], xnew[nx:], ynew[ny:]
65
63
 
66
64
 
@@ -759,7 +757,7 @@ class AstroFrame():
759
757
  vlim=self.vlim, pv=self.pv)
760
758
  if grid[2] is not None and len(grid[2]) > 1 and grid[2][1] < grid[2][0]:
761
759
  d.data[i], grid[2] = d.data[i][::-1], grid[2][::-1]
762
- print('Inverted velocity.')
760
+ print('Velocity has been inverted.')
763
761
  d.v = grid[2]
764
762
  grid = grid[:3:2] if self.pv else grid[:2]
765
763
  if self.swapxy:
@@ -57,7 +57,7 @@ def logticks(ticks: list[float], lim: list[float, float]
57
57
  order = int(np.floor((np.log10(lim[1]))))
58
58
  b = (lim[1] // 10**order) * 10**order
59
59
  b = np.round(b, max(-order, 0))
60
- newticks = np.sort(np.r_[a, ticks, b])
60
+ newticks = np.sort(np.unique(np.r_[a, ticks, b]))
61
61
  newlabels = [str(t if t < 1 else int(t)) for t in newticks]
62
62
  return newticks, newlabels
63
63
 
@@ -874,11 +874,42 @@ class PlotAstroData(AstroFrame):
874
874
  if show_beam:
875
875
  self.add_beam(beam=beam, beamcolor=beamcolor, beampos=beampos)
876
876
 
877
+ def _set_axis_shared(self, pa2: PlotAxes2D, title: dict | str | None):
878
+ """Internal method used in set_axis() and set_axis_radec().
879
+
880
+ Args:
881
+ pa2 (PlotAxes2D): This is instantiated in set_axis() or set_axis_radec().
882
+ title (dict | str | None): str means set_title(str) for 2D or fig.suptitle(str) for 3D. Defaults to None.
883
+ """
884
+ for ch, axnow in enumerate(self.ax):
885
+ pa2.set_xyaxes(axnow)
886
+ self.Xlim = pa2.xlim
887
+ self.Ylim = pa2.ylim
888
+ if not (ch in self.bottomleft):
889
+ plt.setp(axnow.get_xticklabels(), visible=False)
890
+ plt.setp(axnow.get_yticklabels(), visible=False)
891
+ axnow.set_xlabel('')
892
+ axnow.set_ylabel('')
893
+ if len(self.ax) == 1:
894
+ if self.fig is None:
895
+ plt.figure(0).tight_layout()
896
+ if title is not None:
897
+ if len(self.ax) > 1:
898
+ t = {'y': 0.9}
899
+ t_in = {'t': title} if type(title) is str else title
900
+ t.update(t_in)
901
+ for i in range(self.npages):
902
+ fig = plt.figure(i)
903
+ fig.suptitle(**t)
904
+ else:
905
+ t = {'label': title} if type(title) is str else title
906
+ axnow.set_title(**t)
907
+
877
908
  def set_axis(self, title: dict | str | None = None, **kwargs) -> None:
878
909
  """Use Axes.set_* of matplotlib. kwargs can include the arguments of PlotAxes2D to adjust x and y axis.
879
910
 
880
911
  Args:
881
- title (dict, optional): str means set_title(str) for 2D or fig.suptitle(str) for 3D. Defaults to None.
912
+ title (dict | str | None): str means set_title(str) for 2D or fig.suptitle(str) for 3D. Defaults to None.
882
913
  """
883
914
  _kw = {}
884
915
  _kw.update(kwargs)
@@ -902,34 +933,14 @@ class PlotAstroData(AstroFrame):
902
933
  if 'ylim' not in _kw:
903
934
  _kw['ylim'] = self.Ylim
904
935
  pa2 = kwargs2PlotAxes2D(_kw)
905
- for ch, axnow in enumerate(self.ax):
906
- pa2.set_xyaxes(axnow)
907
- if not (ch in self.bottomleft):
908
- plt.setp(axnow.get_xticklabels(), visible=False)
909
- plt.setp(axnow.get_yticklabels(), visible=False)
910
- axnow.set_xlabel('')
911
- axnow.set_ylabel('')
912
- if len(self.ax) == 1:
913
- if self.fig is None:
914
- plt.figure(0).tight_layout()
915
- if title is not None:
916
- if len(self.ax) > 1:
917
- t = {'y': 0.9}
918
- t_in = {'t': title} if type(title) is str else title
919
- t.update(t_in)
920
- for i in range(self.npages):
921
- fig = plt.figure(i)
922
- fig.suptitle(**t)
923
- else:
924
- t = {'label': title} if type(title) is str else title
925
- axnow.set_title(**t)
936
+ self._set_axis_shared(pa2=pa2, title=title)
926
937
 
927
938
  def set_axis_radec(self, center: str | None = None,
928
939
  xlabel: str = 'R.A. (ICRS)',
929
940
  ylabel: str = 'Dec. (ICRS)',
930
941
  nticksminor: int = 2,
931
942
  grid: dict | None = None, title: dict | None = None) -> None:
932
- """Use ax.set_* of matplotlib.
943
+ """Use Axes.set_* of matplotlib. kwargs can include the arguments of PlotAxes2D to adjust x and y axis.
933
944
 
934
945
  Args:
935
946
  center (str, optional): Defaults to None, initial one.
@@ -937,7 +948,7 @@ class PlotAstroData(AstroFrame):
937
948
  ylabel (str, optional): Defaults to 'Dec. (ICRS)'.
938
949
  nticksminor (int, optional): Interval ratio of major and minor ticks. Defaults to 2.
939
950
  grid (dict, optional): True means merely grid(). Defaults to None.
940
- title (dict, optional): str means set_title(str) for 2D or fig.suptitle(str) for 3D. Defaults to None.
951
+ title (dict | str | None): str means set_title(str) for 2D or fig.suptitle(str) for 3D. Defaults to None.
941
952
  """
942
953
  if self.rmax > 50.:
943
954
  print('WARNING: set_axis_radec() is not supported '
@@ -964,9 +975,9 @@ class PlotAstroData(AstroFrame):
964
975
  def makegrid(second, mode):
965
976
  second = float(second)
966
977
  if mode == 'ra':
967
- scale, factor, sec = 1.5, 15 * np.cos(dec), r'$^{\rm s}$'
978
+ scale, factor, sec = 1.5, 15 * np.cos(dec), r'$^\mathrm{s}$'
968
979
  else:
969
- scale, factor, sec = 0.5, 1, r'$^{\rm \prime\prime}$'
980
+ scale, factor, sec = 0.5, 1, r'$^{\prime\prime}$'
970
981
  sec = r'.$\hspace{-0.4}$' + sec
971
982
  dorder = log2r - scale - (order := np.floor(log2r - scale))
972
983
  if 0.00 < dorder <= 0.33:
@@ -998,34 +1009,14 @@ class PlotAstroData(AstroFrame):
998
1009
  yticks, yticksminor, yticklabels = makegrid(dec_s, 'dec')
999
1010
  ra_hm = get_hmdm(xy2coord([xticks[3] / 3600., 0], center), 0)
1000
1011
  dec_dm = get_hmdm(xy2coord([0, yticks[3] / 3600.], center), 1)
1001
- ra_hm = ra_hm.replace('h', r'$^{\rm h}$') + r'$^{\rm m}$'
1012
+ ra_hm = ra_hm.replace('h', r'$^\mathrm{h}$') + r'$^\mathrm{m}$'
1002
1013
  dec_dm = dec_dm.replace('d', r'$^{\circ}$') + r'$^{\prime}$'
1003
1014
  xticklabels[3] = ra_hm + xticklabels[3]
1004
1015
  yticklabels[3] = dec_dm + '\n' + yticklabels[3]
1005
1016
  pa2 = PlotAxes2D(True, None, 'linear', 'linear', self.Xlim, self.Ylim,
1006
1017
  xlabel, ylabel, xticks, yticks, xticklabels,
1007
1018
  yticklabels, xticksminor, yticksminor, grid)
1008
- for ch, axnow in enumerate(self.ax):
1009
- pa2.set_xyaxes(axnow)
1010
- if not (ch in self.bottomleft):
1011
- plt.setp(axnow.get_xticklabels(), visible=False)
1012
- plt.setp(axnow.get_yticklabels(), visible=False)
1013
- axnow.set_xlabel('')
1014
- axnow.set_ylabel('')
1015
- if len(self.ax) == 1:
1016
- if self.fig is None:
1017
- plt.figure(0).tight_layout()
1018
- if title is not None:
1019
- if len(self.ax) > 1:
1020
- t = {'y': 0.9}
1021
- t_in = {'t': title} if type(title) is str else title
1022
- t.update(t_in)
1023
- for i in range(self.npages):
1024
- fig = plt.figure(i)
1025
- fig.suptitle(**t)
1026
- else:
1027
- t = {'label': title} if type(title) is str else title
1028
- axnow.set_title(**t)
1019
+ self._set_axis_shared(pa2=pa2, title=title)
1029
1020
 
1030
1021
  def savefig(self, filename: str | None = None,
1031
1022
  show: bool = False, **kwargs) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plotastrodata
3
- Version: 1.2.7.post3
3
+ Version: 1.2.9
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