diff --git a/CHANGELOG b/CHANGELOG index d49373a2..e61e6400 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v3.9.3 2024-08-20 + * Fix NCrystal.cifutils plot labels with underscores in filenames. + * Fix MiniMC plotting. + v3.9.2 2024-08-19 * Prevent rare error in the MiniMC framework, which happened when acos was evaluated on a value which due to numerical instabilities was ever so diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d55e323..bfdcab74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ endif() cmake_policy( SET CMP0048 NEW )#Not sure if this is really needed -project( NCrystal VERSION 3.9.2 ${_project_metadata} ) +project( NCrystal VERSION 3.9.3 ${_project_metadata} ) unset( _project_metadata ) diff --git a/NCrystal/__init__.py b/NCrystal/__init__.py index 0aaba61c..66fda04b 100644 --- a/NCrystal/__init__.py +++ b/NCrystal/__init__.py @@ -54,7 +54,7 @@ #NB: Synchronize meta-data below with fields in setup.py+template_setup.py.in meta data: __license__ = "Apache 2.0, http://www.apache.org/licenses/LICENSE-2.0" -__version__ = '3.9.2' +__version__ = '3.9.3' __status__ = "Production" __author__ = "NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)" __copyright__ = "Copyright 2015-2024 %s"%__author__ diff --git a/NCrystal/_mmc.py b/NCrystal/_mmc.py index ad4c8170..1b3126b0 100644 --- a/NCrystal/_mmc.py +++ b/NCrystal/_mmc.py @@ -329,6 +329,8 @@ def plot( self, *, plt.figure() do_legend = False + tot_integral_with_absorption = None#unknown + if breakdown_mode: colors = { @@ -357,7 +359,6 @@ def plot( self, *, 'NOSCAT'].index(h.title)) integrals = [ h.stats.get('integral',-1.0) for h in hists ] - tot_integral_with_absorption = None#unknown tot_integral = ( sum(integrals) if all( i>=0.0 for i in integrals ) else None ) diff --git a/NCrystal/cifutils.py b/NCrystal/cifutils.py index 76fdfc2a..e1e27cc0 100644 --- a/NCrystal/cifutils.py +++ b/NCrystal/cifutils.py @@ -400,7 +400,9 @@ def produce_validation_plots( files, verbose_lbls = True, pdf_target = None, embed them in a PDF file. Any plot_kwargs will be passed along to the produce_validation_plot(..) function. """ - from .plot import _import_matplotlib_plt, _import_matplotlib_pdfpages, _fakepyplot_mode + from .plot import ( _import_matplotlib_plt, + _import_matplotlib_pdfpages, + _fakepyplot_mode ) if pdf_target: pdfpages = _import_matplotlib_pdfpages() @@ -508,7 +510,7 @@ def _extractID(s,pattern): yield int(d) import re as _re - _re_atomdbspecs = _re.compile("\[ *with ([a-zA-Z ]+)->([ a-zA-Z0-9+-\.]+) *\]") + _re_atomdbspecs = _re.compile(r"\[ *with ([a-zA-Z ]+)->([ a-zA-Z0-9+-\.]+) *\]") def _extractAtomDBSpec(s): #Look for remapping specs like "[with H->D]" and return in @ATOMDB format #(i.e. "H is D"). @@ -537,7 +539,8 @@ def _extractAtomDBSpec(s): ids = newids def _atomdb_to_remap( atomdb): - _atomdb = list( ' '.join(e.strip().split()) for e in (atomdb or '').replace(':',' ').split('@') ) + _atomdb = list( ' '.join(e.strip().split()) + for e in (atomdb or '').replace(':',' ').split('@') ) _atomdb = list( e for e in _atomdb if e ) l = [] for c in _atomdb: @@ -587,6 +590,9 @@ def _atomdb_to_remap( atomdb): 'pink', 'gray')] + def fix_lbl_for_plt(lbl): + return lbl.replace('_',"$"+'\\'+"mathrm{\\_}$") + for i,(lbl,mc) in enumerate(cmps): lbl = str(lbl) if '/' in lbl: @@ -608,7 +614,7 @@ def _atomdb_to_remap( atomdb): natoms_all.add(si['n_atoms']) plt.plot(wls,mc.scatter.xsect(wl=wls), - label=lbl, + label=fix_lbl_for_plt(lbl), linewidth=lw, alpha=0.5 if i==0 else 0.5, color = col_ordered[i] if i diff --git a/ncrystal_core/include/NCrystal/ncrystal.h b/ncrystal_core/include/NCrystal/ncrystal.h index 63d8238f..308ddaf5 100644 --- a/ncrystal_core/include/NCrystal/ncrystal.h +++ b/ncrystal_core/include/NCrystal/ncrystal.h @@ -1201,9 +1201,9 @@ extern "C" { #endif #define NCRYSTAL_VERSION_MAJOR 3 #define NCRYSTAL_VERSION_MINOR 9 -#define NCRYSTAL_VERSION_PATCH 2 -#define NCRYSTAL_VERSION 3009002 /* (1000000*MAJOR+1000*MINOR+PATCH) */ -#define NCRYSTAL_VERSION_STR "3.9.2" +#define NCRYSTAL_VERSION_PATCH 3 +#define NCRYSTAL_VERSION 3009003 /* (1000000*MAJOR+1000*MINOR+PATCH) */ +#define NCRYSTAL_VERSION_STR "3.9.3" NCRYSTAL_API int ncrystal_version(void); /* returns NCRYSTAL_VERSION */ NCRYSTAL_API const char * ncrystal_version_str(void); /* returns NCRYSTAL_VERSION_STR */