Skip to content

Commit

Permalink
Don't show collate variable in legend
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Oct 3, 2024
1 parent 8b24957 commit f01bd8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
20 changes: 9 additions & 11 deletions cace/parameter/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -890,6 +890,7 @@ def makeplot(
condition_sets,
conditions,
results_for_plot,
collate_variable,
parent=None,
):

Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion cace/parameter/parameter_ngspice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit f01bd8f

Please sign in to comment.