diff --git a/ess/__queue_templates__.py b/ess/__queue_templates__.py index ef1f8fe95be8c170b78b495b8ca4bde42ae0f763..b5b37dcf34ec991ef618b92fdfb03d5da3933527 100644 --- a/ess/__queue_templates__.py +++ b/ess/__queue_templates__.py @@ -57,6 +57,6 @@ def _get_template(filename, template): import os if os.path.exists(filename): - return file(filename).read() + return open(filename).read() else: return template diff --git a/ess/fieldmap.py b/ess/fieldmap.py index ecef063c42aaacb6fb6c15c4ab3218b5f1bd20a7..495520875943b73b5d05bea1523e37bab5e55d2e 100644 --- a/ess/fieldmap.py +++ b/ess/fieldmap.py @@ -79,7 +79,8 @@ __all__ = [ "read_fieldmap", "cut_fieldmap_length", "field_on_axis", - "field_on_axis_from_file" "save_to_ascii", + "field_on_axis_from_file", + "save_to_ascii", "batch_convert_to_ascii", "unify_grid_size", "batch_cut_fieldmap", @@ -88,9 +89,9 @@ __all__ = [ ] # class FieldMapy: -#''' -# class contains functions needed for manipulating fieldmaps for TraceWin. -#''' +# ''' +# class contains functions needed for manipulating fieldmaps for TraceWin. +# ''' __version__ = "0.4" import os @@ -418,12 +419,12 @@ def save_to_ascii(Header, Field, output_filepath: str): fieldmap_dim = 3 else: 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)) if fieldmap_dim == 1: @@ -623,7 +624,7 @@ def create_tw_fieldmap( tabular_file_with_path = os.path.join(fieldmaps_path, tabular_file_name) 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) else: field_array = np.genfromtxt(field_File, delimiter=delim, skip_header=0)