diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 01bd9d32..a1d0065f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,8 +12,8 @@ New Features: - Add nodes for non-adiabatic coupling vectors (NACR) and phase-less loss. See /examples/excited_states_azomethane.py. -- New MultiGradient node for computing multiple partial derivatives of - using one call to automatic differentiation. +- New MultiGradient node for computing more than one partial derivative + using a single call to automatic differentiation. Improvements: ------------- @@ -24,6 +24,11 @@ Improvements: - Create Memory parent class to remove redundancy. +- New setting TIMEPLOT_AUTOSCALING. If True (default), time plots with + log-scaling on the axes will only be produced if warranted by the data. + If False, time plots with linear-scaling and log-scaling will be produced + every time. + Bug Fixes: ---------- diff --git a/hippynn/_settings_setup.py b/hippynn/_settings_setup.py index 3e1de4b8..6869c93f 100644 --- a/hippynn/_settings_setup.py +++ b/hippynn/_settings_setup.py @@ -72,6 +72,7 @@ def kernel_handler(kernel_string): "DEBUG_AUTOINDEXING": (False, strtobool), "USE_CUSTOM_KERNELS": ("auto", kernel_handler), "WARN_LOW_DISTANCES": (True, strtobool), + "TIMEPLOT_AUTOSCALING": (True, strtobool), } settings = SimpleNamespace(**{k: default for k, (default, handler) in default_settings.items()}) diff --git a/hippynn/plotting/timeplots.py b/hippynn/plotting/timeplots.py index a3446d9f..6b820ea0 100644 --- a/hippynn/plotting/timeplots.py +++ b/hippynn/plotting/timeplots.py @@ -66,12 +66,13 @@ def plot_over_time(metric_name, metric_data, pltkwd_info, save_dir): datamin = min(min(arr) for arr in metric_data.values()) datamax = max(max(arr) for arr in metric_data.values()) - if datamin > 0 and datamax / datamin > 2: + # if settings.TIMEPLOT_AUTOSCALING is set to True, only produce log-scale plots under certain conditions + if (not settings.TIMEPLOT_AUTOSCALING) or (datamin > 0 and datamax / datamin > 2): plt.yscale("log") fname = os.path.join(save_dir, metric_name + "_logplot" + settings.DEFAULT_PLOT_FILETYPE) plt.savefig(fname) - if max(len(arr) for arr in metric_data.values()) > 10: + if (not settings.TIMEPLOT_AUTOSCALING) or (max(len(arr) for arr in metric_data.values()) > 10): plt.xscale("log") fname = os.path.join(save_dir, metric_name + "_loglogplot" + settings.DEFAULT_PLOT_FILETYPE) plt.savefig(fname)