Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/manual-pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
python-version: '3.11'
environment-file: docs/environment.yml
auto-activate: true
activate-environment: sphinx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages-deploy-from-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
python-version: '3.11'
environment-file: docs/environment.yml
auto-activate: true
activate-environment: sphinx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
python-version: '3.11'
environment-file: docs/environment.yml
auto-activate: true
activate-environment: sphinx
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-pyblish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
26 changes: 16 additions & 10 deletions CHAP/common/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,19 @@ def confirm(event):
"""Callback function for the "Confirm" button."""
plt.close()

def on_close(event):
"""Callback function to disconnect and remove all widgets."""
# Disconnect all widget callbacks when figure is closed
lambda_box.disconnect(lambda_cid)
continue_btn.disconnect(continue_cid)
confirm_btn.disconnect(confirm_cid)

# ... and remove the buttons before returning the figure
lambda_box.ax.remove()
continue_btn.ax.remove()
confirm_btn.ax.remove()


def get_baseline(
y, *, mask=None, w=None, tol=1.e-6, lam=1.6, max_iter=20):
"""Get a baseline.
Expand Down Expand Up @@ -484,19 +497,12 @@ def get_baseline(
plt.axes([0.75, 0.05, 0.15, 0.075]), 'Confirm')
confirm_cid = confirm_btn.on_clicked(confirm)

# Connect the close event callback to the canvas
fig.canvas.mpl_connect('close_event', on_close)

# Show figure for user interaction
plt.show()

# Disconnect all widget callbacks when figure is closed
lambda_box.disconnect(lambda_cid)
continue_btn.disconnect(continue_cid)
confirm_btn.disconnect(confirm_cid)

# ... and remove the buttons before returning the figure
lambda_box.ax.remove()
continue_btn.ax.remove()
confirm_btn.ax.remove()

if return_buf:
fig_title.set_in_layout(True)
fig_subtitles[-1].set_in_layout(True)
Expand Down
23 changes: 10 additions & 13 deletions CHAP/edd/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ channels:
- hexrd
- nodefaults
dependencies:
- python>=3.9,<3.11
- asteval==1.0.8
- chessanalysispipeline
- hexrd==0.9.4
- python==3.11
- numpy==2.4.6
- pydantic==2.13.5
- pyyaml==6.0.3
- hexrd==0.10.6
- lmfit==1.3.4
- matplotlib==3.10.8
- mpi4py==4.1.1
- nexpy==2.0.0
- nexusformat==2.0.0
- pip==25.3
- pydantic==2.12.5
- requests==2.32.5
- scipy==1.15.2
- nexpy==2.1.0
- nexusformat==2.1.0
- pip==26.2.1
- scipy==1.17.1
- sympy==1.14.0
- pip:
- certif-pyspec==1.5.3
- chess-scanparsers
- chessanalysispipeline
22 changes: 14 additions & 8 deletions CHAP/edd/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,17 @@ def confirm(event):
error_texts.pop()
plt.close()

def on_close(event):
"""Callback function to disconnect and remove all widgets."""
# Disconnect all widget callbacks when figure is closed
reset_btn.disconnect(reset_cid)
confirm_btn.disconnect(confirm_cid)

# ... and remove the buttons before returning the figure
reset_btn.ax.remove()
confirm_btn.ax.remove()


def find_peaks(min_height=0.05, min_width=5, tolerance=10):
"""Find the peaks.

Expand Down Expand Up @@ -1739,15 +1750,10 @@ def select_peaks():
plt.axes([0.75, 0.05, 0.15, 0.075]), 'Confirm')
confirm_cid = confirm_btn.on_clicked(confirm)

plt.show()

# Disconnect all widget callbacks when figure is closed
reset_btn.disconnect(reset_cid)
confirm_btn.disconnect(confirm_cid)
# Connect the close event callback to the canvas
fig.canvas.mpl_connect('close_event', on_close)

# ... and remove the buttons before returning the figure
reset_btn.ax.remove()
confirm_btn.ax.remove()
plt.show()

if return_buf:
fig_title[0].set_in_layout(True)
Expand Down
48 changes: 29 additions & 19 deletions CHAP/edd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ def confirm(event):
"""Callback function for the "Confirm" button."""
plt.close()

def on_close(event):
"""Callback function to disconnect and remove all widgets."""
# Disconnect all widget callbacks when figure is closed
tth_input.disconnect(cid_update_tth)
confirm_btn.disconnect(confirm_cid)

# ...and remove the buttons before returning the figure
tth_input.ax.remove()
confirm_btn.ax.remove()

fig_title = []
error_texts = []

Expand Down Expand Up @@ -268,17 +278,12 @@ def confirm(event):
confirm_btn = Button(plt.axes([0.75, 0.05, 0.15, 0.075]), 'Confirm')
confirm_cid = confirm_btn.on_clicked(confirm)

# Connect the close event callback to the canvas
fig.canvas.mpl_connect('close_event', on_close)

# Show figure for user interaction
plt.show()

# Disconnect all widget callbacks when figure is closed
tth_input.disconnect(cid_update_tth)
confirm_btn.disconnect(confirm_cid)

# ...and remove the buttons before returning the figure
tth_input.ax.remove()
confirm_btn.ax.remove()

# Save the figures if requested and close
if return_buf:
if interactive:
Expand Down Expand Up @@ -1100,6 +1105,19 @@ def confirm(event):
f'detector {detector_id}')
plt.close()

def on_close(event):
"""Callback function to disconnect and remove all widgets."""
# Disconnect all widget callbacks when figure is closed
add_span_btn.disconnect(add_span_cid)
fig.canvas.mpl_disconnect(pick_hkl_cid)
reset_btn.disconnect(reset_cid)
confirm_btn.disconnect(confirm_cid)

# ...and remove the buttons before returning the figure
add_span_btn.ax.remove()
confirm_btn.ax.remove()
reset_btn.ax.remove()

if detector_id is None:
_change_fig_title('Select data and HKLs to use in fitting')
else:
Expand All @@ -1125,19 +1143,11 @@ def confirm(event):
confirm_btn = Button(plt.axes([0.75, 0.05, 0.15, 0.075]), 'Confirm')
confirm_cid = confirm_btn.on_clicked(confirm)

# Connect the close event callback to the canvas
fig.canvas.mpl_connect('close_event', on_close)

# Show figure for user interaction
plt.show()

# Disconnect all widget callbacks when figure is closed
add_span_btn.disconnect(add_span_cid)
fig.canvas.mpl_disconnect(pick_hkl_cid)
reset_btn.disconnect(reset_cid)
confirm_btn.disconnect(confirm_cid)

# ...and remove the buttons before returning the figure
add_span_btn.ax.remove()
confirm_btn.ax.remove()
reset_btn.ax.remove()
plt.subplots_adjust(bottom=0.0)

if return_buf:
Expand Down
17 changes: 9 additions & 8 deletions CHAP/giwaxs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python>=3.9,<3.11
- chessanalysispipeline
- nexpy==2.0.0
- nexusformat==2.0.0
- pip==25.3
- pyfai==2026.2.0
- pydantic==2.12.5
- python==3.11
- numpy==2.4.6
- pydantic==2.13.5
- pyyaml==6.0.3
- nexpy==2.1.0
- nexusformat==2.1.0
- pip==26.2.1
- pyfai==2026.9.0
- pip:
- certif-pyspec==1.5.3
- chess-scanparsers
- chessanalysispipeline
23 changes: 13 additions & 10 deletions CHAP/saxswaxs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ channels:
- nodefaults
dependencies:
- python==3.11
# - chessanalysispipeline
- nexpy==1.0.9
- nexusformat==1.0.6
- pandas==2.3.3
- pip==24.2
- pydantic==2.7.3
- pyfai==2025.1.0
- zarr==3.0.6
- numpy==2.4.6
- pydantic==2.13.5
- pyyaml==6.0.3
- lmfit==1.3.4
- nexpy==2.1.0
- nexusformat==2.1.0
- pip==26.2.1
- pyfai==2026.9.0
- scipy==1.17.1
- sympy==1.14.0
- zarr==3.1.6
- pip:
- certif-pyspec==1.5.3
# - chess-scanparsers
- chess-scanparsers
- chessanalysispipeline
24 changes: 10 additions & 14 deletions CHAP/tomo/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ channels:
- astra-toolbox
- nodefaults
dependencies:
- python>=3.9,<3.11
- astra-toolbox==2.3.1
- chessanalysispipeline
- fabio==2025.10.0
- python==3.11
- numpy==2.4.6
- pydantic==2.13.5
- pyyaml==6.0.3
- astra-toolbox==2.5.0
- lmfit==1.3.4
- matplotlib==3.10.8
- mpi4py==4.1.1
- nexpy==2.0.0
- nexusformat==2.0.0
- pip==25.3
- pyfai==2025.12.1
- pydantic==2.12.5
- requests==2.32.5
- scipy==1.15.2
- nexpy==2.1.0
- nexusformat==2.1.0
- pip==26.2.1
- scipy==1.17.1
- sympy==1.14.0
- tomopy==1.15.3
- pip:
- certif-pyspec==1.5.3
- chess-scanparsers
- chessanalysispipeline
Loading
Loading