From 9859a1e1f49c0d7fb9a1b2ab728a6ad67b925c16 Mon Sep 17 00:00:00 2001 From: Mireille Schneider Date: Wed, 22 Apr 2026 14:08:35 +0200 Subject: [PATCH 1/3] Fix bug in core_sources total power waveform calculation --- idstools/compute/core_sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idstools/compute/core_sources.py b/idstools/compute/core_sources.py index 534900c6..359e8db7 100644 --- a/idstools/compute/core_sources.py +++ b/idstools/compute/core_sources.py @@ -399,7 +399,7 @@ def get_single_and_total_electrons_ions_waveforms(self, time_slice): total_ion_power = 0.0 total_power_waveform[time_index] = ( - total_electron_power_waveform[time_index] + electrons_power + total_ion_power + total_power_waveform[time_index] + electrons_power + total_ion_power ) total_particles_waveform[time_index] = ( total_electron_particles_waveform[time_index] + electrons_particles From 48a5d49b4f6ff1fd34fcaa893bc2eb205e7eb682 Mon Sep 17 00:00:00 2001 From: prasad-sawantdesai Date: Mon, 4 May 2026 09:45:57 +0200 Subject: [PATCH 2/3] removed unused variable --- idstools/compute/core_sources.py | 1 - 1 file changed, 1 deletion(-) diff --git a/idstools/compute/core_sources.py b/idstools/compute/core_sources.py index 359e8db7..cd194652 100644 --- a/idstools/compute/core_sources.py +++ b/idstools/compute/core_sources.py @@ -370,7 +370,6 @@ def get_single_and_total_electrons_ions_waveforms(self, time_slice): single_power_waveform = {} single_particles_waveform = {} dict_single_and_total_electrons_waveforms = self.get_single_and_total_electrons_waveforms(time_slice) - total_electron_power_waveform = dict_single_and_total_electrons_waveforms["total_electron_power_waveform"] total_electron_particles_waveform = dict_single_and_total_electrons_waveforms[ "total_electron_particles_waveform" ] From e10910d3f51cd6729c14155960dae3b7319139a9 Mon Sep 17 00:00:00 2001 From: prasad-sawantdesai Date: Thu, 4 Jun 2026 16:17:10 +0200 Subject: [PATCH 3/3] debug illegal instruction issue on CI --- idstools/scripts/bin/plotcoresources | 4 ++++ idstools/view/common.py | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/idstools/scripts/bin/plotcoresources b/idstools/scripts/bin/plotcoresources index c8f7a4b2..a4f9bbd0 100644 --- a/idstools/scripts/bin/plotcoresources +++ b/idstools/scripts/bin/plotcoresources @@ -5,6 +5,8 @@ import argparse import logging import os +import matplotlib + try: import imaspy as imas except ImportError: @@ -72,9 +74,11 @@ if __name__ == "__main__": time_slice, time_value = get_nearest_time(time_array, args.time) ntime = len(time_array) nsources = len(core_sources.source) + logger.info(f"ntime={ntime}, nsources={nsources}, backend={matplotlib.get_backend()}") core_source_view = CoreSourcesView(core_sources) + logger.info("Creating plot canvas") canvas = PlotCanvas(2, 4) canvas.update_style(args.rc) ret = ax_power_profiles = canvas.add_axes(title=r"Power Profiles [MW/M3]", row=0, col=0) diff --git a/idstools/view/common.py b/idstools/view/common.py index e8ba5c3c..6b1fd801 100644 --- a/idstools/view/common.py +++ b/idstools/view/common.py @@ -21,25 +21,26 @@ def _is_jupyter() -> bool: return False -# Select the appropriate matplotlib backend -if _is_jupyter(): - if "matplotlib.pyplot" not in sys.modules: +# Select the appropriate matplotlib backend. +# Honour an explicit MPLBACKEND env var set by CI/scripts — never override it. +if not os.environ.get("MPLBACKEND") and "matplotlib.pyplot" not in sys.modules: + if _is_jupyter(): try: import ipympl # noqa: F401 - imported to check availability matplotlib.use("widget") except ImportError: matplotlib.use("agg") -elif sys.platform.startswith("win") or "DISPLAY" in os.environ: - - try: - import tkinter # noqa: F401 - imported to check availability + elif sys.platform.startswith("win") or "DISPLAY" in os.environ: + try: + import tkinter # noqa: F401 - imported to check availability - matplotlib.use("TkAgg") - except (ImportError, ModuleNotFoundError): + matplotlib.use("TkAgg") + except Exception: + # ImportError, ModuleNotFoundError, TclError, or SIGILL-prone libs + matplotlib.use("agg") + else: matplotlib.use("agg") -else: - matplotlib.use("agg") import matplotlib.pyplot as plt # noqa: E402