Skip to content

Commit 24081cc

Browse files
committed
#951 isinstance(True,int) -> is true lol, fixing error in lambdaComputing
https://stackoverflow.com/questions/37888620/comparing-boolean-and-int-using-isinstance
1 parent 34da3b7 commit 24081cc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

atom_batch_execution/scripts/batch_execution

+2-1
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,12 @@ def main():
193193
# Save experiment settings
194194
for experiment_type in data['experiments']:
195195
if experiment_type["name"] == stripAutomaticSuffixes(experiment_key,args):
196-
print("WRITING")
196+
print(f"Saving settings file for {Fore.BLUE}{experiment_type['name']}{Style.RESET_ALL}")
197197

198198
settings_file_path = f"{experiment_folder}/{experiment_type['name']}_settings.yml"
199199
yaml.dump(experiment_type, open(settings_file_path, 'w'), sort_keys=False)
200200

201+
201202
# Collect stdout_data files
202203
for file in experiment['files_to_collect']:
203204
if file is None:

atom_batch_execution/scripts/plot_graphs

+9-5
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ def computeLambdaConditions(line_dict,args):
4343

4444
# Lists determine a range of values to plot
4545
if isinstance(value,list):
46-
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] >= {value[0]}","and")
47-
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] <= {value[1]}","and")
46+
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] >= {value[0]}","and")
47+
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] <= {value[1]}","and")
4848

49-
elif isinstance(value,int) or isinstance(value,float):
50-
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] == {value}","and")
49+
elif type(value) in (int,float):
50+
lambda_expression = addConditionToLambda(lambda_expression,f"x['{key}'] == {value}","and")
5151

5252
# A bool determines whether to include all available values of a field or not
5353
# Being false is equal to not being declared
54-
elif isinstance(value,bool):
54+
# https://stackoverflow.com/questions/37888620/comparing-boolean-and-int-using-isinstance
55+
elif type(value) == bool:
5556
# Retrieve the value, if the key doesn't exist .get() returns None
5657
if value :
5758
lambda_expression = addConditionToLambda(lambda_expression,f"x.get('{key}')","and")
@@ -153,6 +154,9 @@ def main():
153154
y_data.append(round(float(line[1]),4))
154155

155156
# Sorting data --> https://stackoverflow.com/questions/9764298/given-parallel-lists-how-can-i-sort-one-while-permuting-rearranging-the-other
157+
print(x_data)
158+
print(y_data)
159+
exit()
156160
x_data_sorted,y_data_sorted = zip(*sorted(zip(x_data,y_data)))
157161

158162
plot_line['x_values'] = x_data_sorted

0 commit comments

Comments
 (0)