Skip to content

Commit

Permalink
fix regression: save in .xisf format fails when having sample points set
Browse files Browse the repository at this point in the history
  • Loading branch information
schmelly committed Jan 2, 2024
1 parent 1d919e0 commit 8684dc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions graxpert/application/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def on_bg_tol_changed(self, event):
self.prefs.bg_tol_option = event["bg_tol_option"]

def on_calculate_request(self, event=None):

if self.images["Original"] is None:
messagebox.showerror("Error", _("Please load your picture first."))
return
Expand All @@ -114,7 +113,7 @@ def on_calculate_request(self, event=None):
if self.prefs.interpol_type_option == "AI":
if not self.validate_ai_installation():
return

eventbus.emit(AppEvents.CALCULATE_BEGIN)

progress = DynamicProgressThread(callback=lambda p: eventbus.emit(AppEvents.CALCULATE_PROGRESS, {"progress": p}))
Expand Down Expand Up @@ -320,7 +319,8 @@ def on_save_request(self, event):

try:
self.images["Processed"].save(dir, self.prefs.saveas_option)
except:
except Exception as e:
logging.exception(e)
eventbus.emit(AppEvents.SAVE_ERROR)
messagebox.showerror("Error", _("Error occured when saving the image."))

Expand All @@ -341,7 +341,8 @@ def on_save_background_request(self, event):

try:
self.images["Background"].save(dir, self.prefs.saveas_option)
except:
except Exception as e:
logging.exception(e)
eventbus.emit(AppEvents.SAVE_ERROR)
messagebox.showerror("Error", _("Error occured when saving the image."))

Expand Down
2 changes: 1 addition & 1 deletion graxpert/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def app_state_2_fitsheader(prefs: Prefs, app_state: AppState, fits_header):
fits_header["SAMPLE-SIZE"] = prefs.sample_size
fits_header["RBF-KERNEL"] = prefs.RBF_kernel
fits_header["SPLINE-ORDER"] = prefs.spline_order
fits_header["BG-PTS"] = str(app_state.background_points)
fits_header["BG-PTS"] = str(list(map(lambda e: e.tolist(), app_state.background_points)))

return fits_header

Expand Down

0 comments on commit 8684dc0

Please sign in to comment.