From 27211382a994cc2631e38832885fd5172a5eb027 Mon Sep 17 00:00:00 2001 From: Yngve Levinsen <yngve.levinsen@esss.se> Date: Wed, 14 Aug 2019 16:26:29 +0200 Subject: [PATCH] flake8 compatibility for two more files --- ess/__queue_templates__.py | 2 +- ess/fieldmap.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ess/__queue_templates__.py b/ess/__queue_templates__.py index ef1f8fe..b5b37dc 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 ecef063..4955208 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) -- GitLab