teareduce 0.4.8__py3-none-any.whl → 0.5.0__py3-none-any.whl

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.
@@ -7,6 +7,7 @@
7
7
  # License-Filename: LICENSE.txt
8
8
 
9
9
  import os
10
+ from pathlib import Path
10
11
  import requests
11
12
 
12
13
 
@@ -28,6 +29,10 @@ def get_cookbook_file(file_path, verbose=True):
28
29
  url = f"https://raw.githubusercontent.com/nicocardiel/teareduce-cookbook/main/{file_path}"
29
30
  response = requests.get(url)
30
31
  local_filename = os.path.basename(file_path)
32
+ if Path(local_filename).is_file():
33
+ if verbose:
34
+ print(f"File {local_filename} already exists locally. Skipping download.")
35
+ return
31
36
  with open(local_filename, "wb") as f:
32
37
  f.write(response.content)
33
38
  if verbose:
teareduce/imshow.py CHANGED
@@ -14,13 +14,18 @@ from matplotlib.axes import Axes
14
14
  from mpl_toolkits.axes_grid1 import make_axes_locatable
15
15
 
16
16
 
17
- def imshowme(data, **kwargs):
17
+ def imshowme(data, return_objs=False, **kwargs):
18
18
  """Simple execution of teareduce.imshow.
19
19
 
20
20
  Parameters
21
21
  ----------
22
22
  data : numpy.ndarray
23
23
  2D array to be displayed
24
+ return_objs : bool
25
+ If True, return the Figure, Axes, AxesImage,
26
+ color bar Axes and Colorbar instances.
27
+ **kwargs : dict
28
+ Additional parameters passed to imshow().
24
29
 
25
30
  Returns
26
31
  -------
@@ -37,14 +42,16 @@ def imshowme(data, **kwargs):
37
42
  Instance of Colorbar, or None if colorbar is False.
38
43
  """
39
44
  fig, ax = plt.subplots()
40
- img, cax, cbar = imshow(fig=fig, ax=ax, data=data, **kwargs)
41
- return fig, ax, img, cax, cbar
45
+ img, cax, cbar = imshow(fig=fig, ax=ax, data=data, return_objs=True, **kwargs)
46
+ if return_objs:
47
+ return fig, ax, img, cax, cbar
42
48
 
43
49
 
44
50
  def imshow(fig=None, ax=None, data=None, ds9mode=False,
45
51
  crpix1=1, crval1=None, cdelt1=None, cunit1=None, cunitx=Unit('Angstrom'),
46
52
  xlabel=None, ylabel=None, title=None,
47
53
  colorbar=True, cblabel='Number of counts',
54
+ return_objs=True,
48
55
  **kwargs):
49
56
  """Call imshow() with color bar and default labels.
50
57
 
@@ -89,6 +96,11 @@ def imshow(fig=None, ax=None, data=None, ds9mode=False,
89
96
  If True, display color bar.
90
97
  cblabel : str
91
98
  Color bar label.
99
+ return_objs : bool
100
+ If True, return AxesImage, color bar Axes and Colorbar
101
+ instances.
102
+ **kwargs : dict
103
+ Additional parameters passed to imshow().
92
104
 
93
105
  Return
94
106
  ------
@@ -188,4 +200,5 @@ def imshow(fig=None, ax=None, data=None, ds9mode=False,
188
200
  cax = None
189
201
  cbar = None
190
202
 
191
- return img, cax, cbar
203
+ if return_objs:
204
+ return img, cax, cbar
teareduce/version.py CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  """Module to define the version of the teareduce package."""
11
11
 
12
- VERSION = '0.4.8'
12
+ VERSION = '0.5.0'
13
13
 
14
14
 
15
15
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: teareduce
3
- Version: 0.4.8
3
+ Version: 0.5.0
4
4
  Summary: Utilities for astronomical data reduction
5
5
  Author-email: Nicolás Cardiel <cardiel@ucm.es>
6
6
  License: GPL-3.0-or-later
@@ -23,6 +23,8 @@ Requires-Dist: astropy
23
23
  Requires-Dist: lmfit
24
24
  Requires-Dist: matplotlib
25
25
  Requires-Dist: numpy>=1.22
26
+ Requires-Dist: rich
27
+ Requires-Dist: rich-argparse
26
28
  Requires-Dist: scipy
27
29
  Requires-Dist: tqdm
28
30
  Provides-Extra: test
@@ -6,7 +6,7 @@ teareduce/ctext.py,sha256=cCVVsFRQ73V0JwDCytd73U3HWRjfv5xkt3ca5-YWuwo,2081
6
6
  teareduce/draw_rectangle.py,sha256=mKZ0j8ZRtbxkZH9pQjja_xgP-LSpfe9c7YTgHJX_nSc,1911
7
7
  teareduce/elapsed_time.py,sha256=QWakPeiOUA__WpjjFREnodKqW1FZzVGWstab0N3Ro6k,1418
8
8
  teareduce/histogram1d.py,sha256=3hlvcI8XPRmZ27H_sFmyL26gIcbJozk07ELBKWtngQk,2835
9
- teareduce/imshow.py,sha256=d5rb5bwCWvt139X0nOW0xtCozSwkHf1p-lndPifuA8E,6600
9
+ teareduce/imshow.py,sha256=qnic8X0GTjHW5yIITEZcqZmefzDpQlGJH7v2bPHI6t8,7082
10
10
  teareduce/numsplines.py,sha256=1PpG-frdc9Qz3VRbC7XyZFWKmhus05ID4REtFnWDmUo,8049
11
11
  teareduce/peaks_spectrum.py,sha256=XLMbJZnyYDVSaa5nCMXk9kSn0fyG_lhVmXWHzTwehiA,9878
12
12
  teareduce/polfit.py,sha256=CGsrRsz_Du2aKxOcgXi36lpAZO04JyqCCUaxhC0C-Mk,14281
@@ -15,22 +15,30 @@ teareduce/sdistortion.py,sha256=5ZsZn4vD5Sw2aoqO8-NIOH7H89Zmh7ZDkow6YbAotHU,5916
15
15
  teareduce/simulateccdexposure.py,sha256=cdbpca6GVuM3d7R1LGzlIZZvjTq_jzrlkk_Cli7aouQ,24636
16
16
  teareduce/sliceregion.py,sha256=Jdf8XvmGaY_vaY1cneTaRtSOYPxpUsJm9cXJDDMa0YM,18626
17
17
  teareduce/statsummary.py,sha256=VTNAnBV8z6suqiyB2Lhw3YjUUOjlmwUPX3enkOKRF54,5422
18
- teareduce/version.py,sha256=9bRTfbP-0J-zaWu-g_Yo1f-fV-a__5oRYcf981NnIE0,419
18
+ teareduce/version.py,sha256=2Y5F6s1-LbltvSto197jfUfolKF_i_LCEoAq7wi0lSc,419
19
19
  teareduce/wavecal.py,sha256=2MewWz5Y3ms41c305UtWOM_LaLNdk1mugDXCtzf-fSw,68586
20
20
  teareduce/write_array_to_fits.py,sha256=kWDrEH9coJ1yIu56oQJpWtDqJL4c8HGmssE9jle4e94,617
21
21
  teareduce/zscale.py,sha256=SDgmcDD2N5GvDn46JADCgTQJPBF_N_jSKMHoeTz9Nsw,1152
22
22
  teareduce/cleanest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- teareduce/cleanest/__main__.py,sha256=DGr32TeUa2gsiokQzNXkYrOCJcLWoE0BRQACKq20xfg,1371
24
- teareduce/cleanest/cosmicraycleanerapp.py,sha256=qE8Wq6j240Pzfd5DB8mR579qnYt359yN0Lj5FZeFp4s,7976
25
- teareduce/cleanest/reviewcosmicray.py,sha256=ha3MeSfT-RvSQnRSq8_M59JfnOGNd3IgtyHklrujE08,22450
23
+ teareduce/cleanest/__main__.py,sha256=mobw6PW6JauOBKt-0eNvUH0UCC_D-AjrbTlzfAu7joY,1732
24
+ teareduce/cleanest/cosmicraycleanerapp.py,sha256=k0E72E4lOwYmQ8IKRhtyuQIHsKxHjVA2V5hJEFKnQDo,33141
25
+ teareduce/cleanest/definitions.py,sha256=zTF3O0dC1VeU43MZqYA6WLk8NRsNL07IHW9NvWXHyJM,1689
26
+ teareduce/cleanest/find_closest_true.py,sha256=mWdIvhipzAXDRKfePDrP7f0lP4U48cckpHiKwiB4jHI,1320
27
+ teareduce/cleanest/imagedisplay.py,sha256=4FhoRcyskj_F6gaza4U37sLODpe-Sud3sunM8_-p5iY,5877
28
+ teareduce/cleanest/interpolation_a.py,sha256=MpZ41WV3ck5Q2DDmgkeMhIqG-VNVD97lN9SU1tUJJmA,3266
29
+ teareduce/cleanest/interpolation_x.py,sha256=qp1JU5_w8xrsyo33cK2U1gYf4Y49LewDJ8-s1pxh93s,2801
30
+ teareduce/cleanest/interpolation_y.py,sha256=ra6rdvUcwG5hVqF7id5rLtSE8amgvjSYFSrgjhwSgIQ,2820
31
+ teareduce/cleanest/interpolationeditor.py,sha256=RjAmfgpNOFivot9nz9d87Xno-hxmtDdNH29oIvn5xeY,8000
32
+ teareduce/cleanest/parametereditor.py,sha256=XxGRLqm8Rcy7vkCSMVPrBxLeqFWFFWNaIklr7bmS7eU,10058
33
+ teareduce/cleanest/reviewcosmicray.py,sha256=U2jpYsNSNFA8bbqeQ8wZDvVWTwdgLPZfvtIzzcy23aA,26783
26
34
  teareduce/cookbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- teareduce/cookbook/get_cookbook_file.py,sha256=n40HoWv3eiFtaquYWTAM6CbVfha9oUO9LHmnU2a5jkc,902
35
+ teareduce/cookbook/get_cookbook_file.py,sha256=vde-iNii2lm1QII8GmLRsFsKNxkdsd7njCBE-8Z7io0,1088
28
36
  teareduce/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
37
  teareduce/tests/test_sliceregion.py,sha256=S7Zoh2eEBFIEbfsXgWBEMCf7pottjw2oLhqlZJQkAwg,3785
30
38
  teareduce/tests/test_version.py,sha256=mKLnbXyvVNc1pATq5PxR8qeoFMPAFL_GilFV6IHLOi0,172
31
- teareduce-0.4.8.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
32
- teareduce-0.4.8.dist-info/METADATA,sha256=jW69XhMxJd0YFBNEZnf6OvSmuiVswWzEsS_jRHgqRiY,3017
33
- teareduce-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- teareduce-0.4.8.dist-info/entry_points.txt,sha256=6yBvig5jTL2ugqz5SF767AiszzrHKGRASsX1II84kqA,66
35
- teareduce-0.4.8.dist-info/top_level.txt,sha256=7OkwtX9zNRkGJ7ACgjk4ESgC74qUYcS5O2qcO0v-Si4,10
36
- teareduce-0.4.8.dist-info/RECORD,,
39
+ teareduce-0.5.0.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
40
+ teareduce-0.5.0.dist-info/METADATA,sha256=bI2MQ4CMfRdMNscb6NjvIhl_4FTQnFCyX6n_1lymFn8,3066
41
+ teareduce-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
+ teareduce-0.5.0.dist-info/entry_points.txt,sha256=6yBvig5jTL2ugqz5SF767AiszzrHKGRASsX1II84kqA,66
43
+ teareduce-0.5.0.dist-info/top_level.txt,sha256=7OkwtX9zNRkGJ7ACgjk4ESgC74qUYcS5O2qcO0v-Si4,10
44
+ teareduce-0.5.0.dist-info/RECORD,,