Skip to content
Snippets Groups Projects
Commit 27211382 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

flake8 compatibility for two more files

parent b4fd9de1
No related branches found
No related tags found
No related merge requests found
Pipeline #19312 failed
...@@ -57,6 +57,6 @@ def _get_template(filename, template): ...@@ -57,6 +57,6 @@ def _get_template(filename, template):
import os import os
if os.path.exists(filename): if os.path.exists(filename):
return file(filename).read() return open(filename).read()
else: else:
return template return template
...@@ -79,7 +79,8 @@ __all__ = [ ...@@ -79,7 +79,8 @@ __all__ = [
"read_fieldmap", "read_fieldmap",
"cut_fieldmap_length", "cut_fieldmap_length",
"field_on_axis", "field_on_axis",
"field_on_axis_from_file" "save_to_ascii", "field_on_axis_from_file",
"save_to_ascii",
"batch_convert_to_ascii", "batch_convert_to_ascii",
"unify_grid_size", "unify_grid_size",
"batch_cut_fieldmap", "batch_cut_fieldmap",
...@@ -88,9 +89,9 @@ __all__ = [ ...@@ -88,9 +89,9 @@ __all__ = [
] ]
# class FieldMapy: # class FieldMapy:
#''' # '''
# class contains functions needed for manipulating fieldmaps for TraceWin. # class contains functions needed for manipulating fieldmaps for TraceWin.
#''' # '''
__version__ = "0.4" __version__ = "0.4"
import os import os
...@@ -418,12 +419,12 @@ def save_to_ascii(Header, Field, output_filepath: str): ...@@ -418,12 +419,12 @@ def save_to_ascii(Header, Field, output_filepath: str):
fieldmap_dim = 3 fieldmap_dim = 3
else: else:
raise ValueError( raise ValueError(
"Wrong length of header, cannot write {}".format(output_file_path) "Wrong length of header, cannot write {}".format(output_filepath)
) )
with open(output_file_path, "w") as out_file: with open(output_filepath, "w") as out_file:
stepZ = Header[1] / Header[0] # stepZ = Zmax / Nz # stepZ = Header[1] / Header[0] # stepZ = Zmax / Nz
out_file.write("{0[0]:.0f} {0[1]}\n".format(Header)) out_file.write("{0[0]:.0f} {0[1]}\n".format(Header))
if fieldmap_dim == 1: if fieldmap_dim == 1:
...@@ -623,7 +624,7 @@ def create_tw_fieldmap( ...@@ -623,7 +624,7 @@ def create_tw_fieldmap(
tabular_file_with_path = os.path.join(fieldmaps_path, tabular_file_name) tabular_file_with_path = os.path.join(fieldmaps_path, tabular_file_name)
field_File = open(tabular_file_with_path, "r") field_File = open(tabular_file_with_path, "r")
if header == True: if header is True:
field_array = np.genfromtxt(field_File, delimiter=delim, skip_header=1) field_array = np.genfromtxt(field_File, delimiter=delim, skip_header=1)
else: else:
field_array = np.genfromtxt(field_File, delimiter=delim, skip_header=0) field_array = np.genfromtxt(field_File, delimiter=delim, skip_header=0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment