teareduce 0.5.7__tar.gz → 0.5.8__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.
- {teareduce-0.5.7/src/teareduce.egg-info → teareduce-0.5.8}/PKG-INFO +2 -1
- {teareduce-0.5.7 → teareduce-0.5.8}/pyproject.toml +1 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/cosmicraycleanerapp.py +16 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/definitions.py +1 -1
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/interpolationeditor.py +1 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/reviewcosmicray.py +31 -2
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/version.py +1 -1
- {teareduce-0.5.7 → teareduce-0.5.8/src/teareduce.egg-info}/PKG-INFO +2 -1
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce.egg-info/requires.txt +1 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/LICENSE.txt +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/README.md +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/setup.cfg +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/__init__.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/avoid_astropy_warnings.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/__init__.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/__main__.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/centerchildparent.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/dilatemask.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/find_closest_true.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/imagedisplay.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/interpolate.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/interpolation_a.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/interpolation_x.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/interpolation_y.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/lacosmicpad.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/mergemasks.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/modalprogressbar.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cleanest/parametereditor.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cookbook/__init__.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cookbook/get_cookbook_file.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/correct_pincushion_distortion.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/cosmicrays.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/ctext.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/draw_rectangle.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/elapsed_time.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/histogram1d.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/imshow.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/numsplines.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/peaks_spectrum.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/polfit.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/robust_std.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/sdistortion.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/simulateccdexposure.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/sliceregion.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/statsummary.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/tests/__init__.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/tests/test_cleanest.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/tests/test_sliceregion.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/tests/test_version.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/wavecal.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/write_array_to_fits.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce/zscale.py +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce.egg-info/SOURCES.txt +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce.egg-info/dependency_links.txt +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce.egg-info/entry_points.txt +0 -0
- {teareduce-0.5.7 → teareduce-0.5.8}/src/teareduce.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: teareduce
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
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,7 @@ Requires-Dist: astropy
|
|
|
23
23
|
Requires-Dist: ccdproc
|
|
24
24
|
Requires-Dist: lmfit
|
|
25
25
|
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: maskfill
|
|
26
27
|
Requires-Dist: numpy>=1.22
|
|
27
28
|
Requires-Dist: requests
|
|
28
29
|
Requires-Dist: rich
|
|
@@ -17,6 +17,7 @@ from tkinter import simpledialog
|
|
|
17
17
|
import sys
|
|
18
18
|
|
|
19
19
|
from astropy.io import fits
|
|
20
|
+
from maskfill import maskfill
|
|
20
21
|
import matplotlib.pyplot as plt
|
|
21
22
|
from matplotlib.backend_bases import key_press_handler
|
|
22
23
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
|
|
@@ -773,6 +774,21 @@ class CosmicRayCleanerApp(ImageDisplay):
|
|
|
773
774
|
# upate mask_crfound by eliminating the cleaned pixels
|
|
774
775
|
self.mask_crfound[mask_crfound_region] = False
|
|
775
776
|
data_has_been_modified = True
|
|
777
|
+
elif cleaning_method == "maskfill":
|
|
778
|
+
# Replace detected CR pixels with local median values
|
|
779
|
+
smoothed_output, _ = maskfill(
|
|
780
|
+
input_image=self.data,
|
|
781
|
+
mask=mask_crfound_region,
|
|
782
|
+
size=3,
|
|
783
|
+
operator="median",
|
|
784
|
+
smooth=True,
|
|
785
|
+
)
|
|
786
|
+
self.data[mask_crfound_region] = smoothed_output[mask_crfound_region]
|
|
787
|
+
# update mask_fixed to include the newly fixed pixels
|
|
788
|
+
self.mask_fixed[mask_crfound_region] = True
|
|
789
|
+
# upate mask_crfound by eliminating the cleaned pixels
|
|
790
|
+
self.mask_crfound[mask_crfound_region] = False
|
|
791
|
+
data_has_been_modified = True
|
|
776
792
|
elif cleaning_method == "auxdata":
|
|
777
793
|
if self.auxdata is None:
|
|
778
794
|
print("No auxiliary data available. Cleaning skipped!")
|
|
@@ -43,7 +43,7 @@ lacosmic_default_dict = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
# Default parameters for cleaning methods
|
|
46
|
-
VALID_CLEANING_METHODS = ["x interp.", "y interp.", "surface interp.", "median", "mean", "lacosmic", "auxdata"]
|
|
46
|
+
VALID_CLEANING_METHODS = ["x interp.", "y interp.", "surface interp.", "median", "mean", "lacosmic", "maskfill", "auxdata"]
|
|
47
47
|
|
|
48
48
|
# Maximum pixel distance to consider when finding closest CR pixel
|
|
49
49
|
MAX_PIXEL_DISTANCE_TO_CR = 15
|
|
@@ -13,6 +13,7 @@ import tkinter as tk
|
|
|
13
13
|
from tkinter import messagebox
|
|
14
14
|
from tkinter import simpledialog
|
|
15
15
|
|
|
16
|
+
from maskfill import maskfill
|
|
16
17
|
import matplotlib.pyplot as plt
|
|
17
18
|
from matplotlib.backend_bases import key_press_handler
|
|
18
19
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
|
|
@@ -150,7 +151,7 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
150
151
|
self.root.minsize(1000, 700)
|
|
151
152
|
else:
|
|
152
153
|
# self.root.geometry("800x700+100+100") # This does not work in Fedora
|
|
153
|
-
self.root.minsize(
|
|
154
|
+
self.root.minsize(900, 700)
|
|
154
155
|
self.root.update_idletasks()
|
|
155
156
|
self.root.geometry("+100+100")
|
|
156
157
|
self.data = data
|
|
@@ -224,6 +225,8 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
224
225
|
self.interp_l_button.config(state=tk.DISABLED)
|
|
225
226
|
if self.cleandata_lacosmic is None:
|
|
226
227
|
self.interp_l_button.config(state=tk.DISABLED)
|
|
228
|
+
self.interp_maskfill_button = tk.Button(self.button_frame2, text="mas[k]fill", command=self.use_maskfill)
|
|
229
|
+
self.interp_maskfill_button.pack(side=tk.LEFT, padx=5)
|
|
227
230
|
self.interp_aux_button = tk.Button(self.button_frame2, text="[a]ux. data", command=self.use_auxdata)
|
|
228
231
|
self.interp_aux_button.pack(side=tk.LEFT, padx=5)
|
|
229
232
|
if self.auxdata is None:
|
|
@@ -246,7 +249,7 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
246
249
|
if self.auxdata is not None:
|
|
247
250
|
self.fig, (self.ax_aux, self.ax) = plt.subplots(ncols=2, figsize=(11, 5.5), constrained_layout=True)
|
|
248
251
|
else:
|
|
249
|
-
self.fig, self.ax = plt.subplots(figsize=(
|
|
252
|
+
self.fig, self.ax = plt.subplots(figsize=(9, 5.5), constrained_layout=True)
|
|
250
253
|
self.canvas = FigureCanvasTkAgg(self.fig, master=self.root)
|
|
251
254
|
self.canvas.get_tk_widget().pack(padx=5, pady=5)
|
|
252
255
|
# The next two instructions prevent a segmentation fault when pressing "q"
|
|
@@ -376,6 +379,7 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
376
379
|
self.interp_d_button.config(state=tk.DISABLED)
|
|
377
380
|
self.interp_m_button.config(state=tk.DISABLED)
|
|
378
381
|
self.interp_l_button.config(state=tk.DISABLED)
|
|
382
|
+
self.interp_maskfill_button.config(state=tk.DISABLED)
|
|
379
383
|
self.interp_aux_button.config(state=tk.DISABLED)
|
|
380
384
|
|
|
381
385
|
def interp_x(self):
|
|
@@ -461,6 +465,27 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
461
465
|
self.set_buttons_after_cleaning_cr()
|
|
462
466
|
self.update_display(cleaned=True)
|
|
463
467
|
|
|
468
|
+
def use_maskfill(self):
|
|
469
|
+
"""Use maskfill cleaned data to clean a cosmic ray."""
|
|
470
|
+
print(f"Maskfill interpolation of cosmic ray {self.cr_index}")
|
|
471
|
+
ycr_list, xcr_list = np.where(self.cr_labels == self.cr_index)
|
|
472
|
+
mask = np.zeros(self.data.shape, dtype=bool)
|
|
473
|
+
for iy, ix in zip(ycr_list, xcr_list):
|
|
474
|
+
mask[iy, ix] = True
|
|
475
|
+
smoothed_output, _ = maskfill(
|
|
476
|
+
input_image=self.data,
|
|
477
|
+
mask=mask,
|
|
478
|
+
size=3,
|
|
479
|
+
operator="median",
|
|
480
|
+
smooth=True,
|
|
481
|
+
)
|
|
482
|
+
for iy, ix in zip(ycr_list, xcr_list):
|
|
483
|
+
self.data[iy, ix] = smoothed_output[iy, ix]
|
|
484
|
+
self.mask_fixed[iy, ix] = True
|
|
485
|
+
self.num_cr_cleaned += 1
|
|
486
|
+
self.set_buttons_after_cleaning_cr()
|
|
487
|
+
self.update_display(cleaned=True)
|
|
488
|
+
|
|
464
489
|
def use_auxdata(self):
|
|
465
490
|
"""Use auxiliary data to clean a cosmic ray."""
|
|
466
491
|
if self.auxdata is None:
|
|
@@ -505,6 +530,7 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
505
530
|
if self.cleandata_lacosmic is not None:
|
|
506
531
|
if self.last_dilation is None or self.last_dilation == 0:
|
|
507
532
|
self.interp_l_button.config(state=tk.NORMAL)
|
|
533
|
+
self.interp_maskfill_button.config(state=tk.NORMAL)
|
|
508
534
|
if self.auxdata is not None:
|
|
509
535
|
self.interp_aux_button.config(state=tk.NORMAL)
|
|
510
536
|
print(f"Restored all pixels of cosmic ray {self.cr_index}")
|
|
@@ -566,6 +592,9 @@ class ReviewCosmicRay(ImageDisplay):
|
|
|
566
592
|
elif event.key == "l":
|
|
567
593
|
if self.interp_l_button.cget("state") != "disabled":
|
|
568
594
|
self.use_lacosmic()
|
|
595
|
+
elif event.key == "k":
|
|
596
|
+
if self.interp_maskfill_button.cget("state") != "disabled":
|
|
597
|
+
self.use_maskfill()
|
|
569
598
|
elif event.key == "a":
|
|
570
599
|
if self.interp_aux_button.cget("state") != "disabled":
|
|
571
600
|
self.use_auxdata()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: teareduce
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
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,7 @@ Requires-Dist: astropy
|
|
|
23
23
|
Requires-Dist: ccdproc
|
|
24
24
|
Requires-Dist: lmfit
|
|
25
25
|
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: maskfill
|
|
26
27
|
Requires-Dist: numpy>=1.22
|
|
27
28
|
Requires-Dist: requests
|
|
28
29
|
Requires-Dist: rich
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|