From f01bd8febe68fa5e3ce7a880f791aac5cb6c376f Mon Sep 17 00:00:00 2001 From: mole99 Date: Thu, 3 Oct 2024 12:21:53 +0200 Subject: [PATCH] Don't show collate variable in legend --- cace/parameter/parameter.py | 20 +++++++++----------- cace/parameter/parameter_ngspice.py | 7 ++++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cace/parameter/parameter.py b/cace/parameter/parameter.py index 07cbc8e..6cadc75 100755 --- a/cace/parameter/parameter.py +++ b/cace/parameter/parameter.py @@ -327,7 +327,7 @@ def run(self): self.result_type = ResultType.ERROR self.canceled = True - if self.result_type != ResultType.SKIPPED: + if self.result_type == ResultType.SUCCESS: self.evaluate_result() # Set done before calling end cb @@ -890,6 +890,7 @@ def makeplot( condition_sets, conditions, results_for_plot, + collate_variable, parent=None, ): @@ -979,7 +980,7 @@ def makeplot( # Get the limits if limits != False: - # For the histgoram get limits from the x variable + # For the histogram get limits from the x variable if plot_type == 'histogram': if xvariable in self.param['spec']: if 'minimum' in self.param['spec'][xvariable]: @@ -1082,7 +1083,7 @@ def makeplot( 'unit' ] - # Assemble the string displayed at the y-axis + # Assemble the string displayed at the x-axis xdisplay = f'{xdisplay} ({xunit})' if xunit != '' else xdisplay # Assemble the string displayed at the y-axis @@ -1231,6 +1232,11 @@ def makeplot( label = [] for condition in condition_set: if condition in conditions: + # Don't display the condition which was + # used to collate the values + if condition == collate_variable: + continue + # Only add conditions with more than one value if len(conditions[condition].values) > 1: label.append( @@ -1270,14 +1276,6 @@ def makeplot( if not yvalues: - # Check length of x and y - if len(xvalues) != len(yvalues): - err( - f'Length of x and y is not the same ({len(xvalues)}, {len(yvalues)}).' - ) - self.result_type = ResultType.ERROR - return None - self.plot( xvalues, yvalues, diff --git a/cace/parameter/parameter_ngspice.py b/cace/parameter/parameter_ngspice.py index 54d98a7..247e331 100755 --- a/cace/parameter/parameter_ngspice.py +++ b/cace/parameter/parameter_ngspice.py @@ -241,6 +241,7 @@ def implementation(self): # but under the same conditions (e.g. temperature) should be collated. # First remove the collate condition from the conditions + collate_variable = None if self.get_argument('collate'): collate_variable = self.get_argument('collate') @@ -745,7 +746,11 @@ def __getattr__(self, attr): # Create the plots and save them for named_plot in self.param['plot']: self.makeplot( - named_plot, condition_sets, conditions, simulation_values + named_plot, + condition_sets, + conditions, + simulation_values, + collate_variable, ) def get_num_steps(self):