Skip to content

Commit

Permalink
#951 isinstance(True,int) -> is true lol, fixing error in lambdaCompu…
Browse files Browse the repository at this point in the history
  • Loading branch information
brunofavs committed May 11, 2024
1 parent 34da3b7 commit 24081cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion atom_batch_execution/scripts/batch_execution
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,12 @@ def main():
# Save experiment settings
for experiment_type in data['experiments']:
if experiment_type["name"] == stripAutomaticSuffixes(experiment_key,args):
print("WRITING")
print(f"Saving settings file for {Fore.BLUE}{experiment_type['name']}{Style.RESET_ALL}")

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


# Collect stdout_data files
for file in experiment['files_to_collect']:
if file is None:
Expand Down
14 changes: 9 additions & 5 deletions atom_batch_execution/scripts/plot_graphs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ def computeLambdaConditions(line_dict,args):

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

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

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

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

plot_line['x_values'] = x_data_sorted
Expand Down

0 comments on commit 24081cc

Please sign in to comment.