Skip to content

Commit

Permalink
Change from 'fig.canvas.set_window_title' to 'fig.canvas.manager.set_…
Browse files Browse the repository at this point in the history
…window_title' for plotting using the 'Qt5Agg' backend
  • Loading branch information
Allonck committed Mar 5, 2024
1 parent 865c4cd commit 9e60aa3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions goodman_pipeline/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ def get_lines_in_lamp(ccd, plots=False):
if plots: # pragma: no cover
plt.close('all')
fig, ax = plt.subplots()
fig.canvas.set_window_title('Lines Detected')
fig.canvas.manager.set_window_title('Lines Detected')

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -2743,7 +2743,7 @@ def recenter_lines(data, lines, plots=False):
new_center.append(centroid)
if plots: # pragma: no cover
fig, ax = plt.subplots(1, 1)
fig.canvas.set_window_title('Lines Detected in Lamp')
fig.canvas.manager.set_window_title('Lines Detected in Lamp')
ax.axhline(median, color='b')

ax.plot(range(len(data)),
Expand Down Expand Up @@ -3135,7 +3135,7 @@ def trace(ccd,
z1 = np.mean(ccd.data) - 0.5 * np.std(ccd.data)
z2 = np.median(ccd.data) + np.std(ccd.data)
fig, ax = plt.subplots()
fig.canvas.set_window_title(ccd.header['GSP_FNAM'])
fig.canvas.manager.set_window_title(ccd.header['GSP_FNAM'])

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -3247,7 +3247,7 @@ def trace_targets(ccd, target_list, sampling_step=5, pol_deg=2, nfwhm=5,
z1 = np.mean(ccd.data) - 0.5 * np.std(ccd.data)
z2 = np.median(ccd.data) + np.std(ccd.data)
fig, ax = plt.subplots()
fig.canvas.set_window_title(ccd.header['GSP_FNAM'])
fig.canvas.manager.set_window_title(ccd.header['GSP_FNAM'])

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4286,7 +4286,7 @@ def __call__(self,

plt.switch_backend('Qt5Agg')
fig, ax = plt.subplots()
fig.canvas.set_window_title(self.file_name)
fig.canvas.manager.set_window_title(self.file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4363,7 +4363,7 @@ def fit_background(self, spatial_profile=None, file_name=None, plots=False):

if plots or self.plots: # pragma: no cover
fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand All @@ -4380,7 +4380,7 @@ def fit_background(self, spatial_profile=None, file_name=None, plots=False):
plt.show()

fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4451,7 +4451,7 @@ def subtract_background(self, spatial_profile=None, background_model=None,
plt.close()

fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4527,7 +4527,7 @@ def get_peaks(self,
plt.ioff()

fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

ax.set_title('All detected Peaks')

Expand Down Expand Up @@ -4623,7 +4623,7 @@ def filter_peaks(self,
plt.ioff()

fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4742,7 +4742,7 @@ def _fit_gaussian(fitter,

if plots: # pragma: no cover
fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down Expand Up @@ -4813,7 +4813,7 @@ def _fit_moffat(fitter,

if plots: # pragma: no cover
fig, ax = plt.subplots()
fig.canvas.set_window_title(file_name)
fig.canvas.manager.set_window_title(file_name)

mng = plt.get_current_fig_manager()
mng.window.showMaximized()
Expand Down
2 changes: 1 addition & 1 deletion goodman_pipeline/spectroscopy/redspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def _run(self,
ax.set_ylabel("Intensity (ADU)")
ax.set_xlabel("Dispersion Axis (Pixels)")

fig.canvas.set_window_title(
fig.canvas.manager.set_window_title(
'Extracted Data: Target Center ~ '
'{:.2f}'.format(single_profile_center))

Expand Down
4 changes: 2 additions & 2 deletions goodman_pipeline/spectroscopy/wavelength.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _automatic_wavelength_solution(self,
self.i_fig = None
if self.i_fig is None:
self.i_fig = plt.figure()
self.i_fig.canvas.set_window_title(
self.i_fig.canvas.manager.set_window_title(
'Automatic Wavelength Solution')
self.ax1 = self.i_fig.add_subplot(111)
self.ax1.set_rasterization_zorder(1)
Expand Down Expand Up @@ -695,7 +695,7 @@ def _save_science_data(self,
'{:s}\n{:s}'.format(object_name, grating)

fig, ax1 = plt.subplots(1)
fig.canvas.set_window_title(ccd.header['GSP_FNAM'])
fig.canvas.manager.set_window_title(ccd.header['GSP_FNAM'])
# ax1 = fig.add_subplot(111)

mng = plt.get_current_fig_manager()
Expand Down

0 comments on commit 9e60aa3

Please sign in to comment.