From c6636ef212cc77777d5076f60fdc22feb4ed083f Mon Sep 17 00:00:00 2001 From: JakHolzer <53743814+JakHolzer@users.noreply.github.com> Date: Fri, 11 Sep 2020 15:38:54 +0200 Subject: [PATCH] removed strings, added argument --- pyzebra/comm_export.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pyzebra/comm_export.py b/pyzebra/comm_export.py index 654d6cb..29110cd 100644 --- a/pyzebra/comm_export.py +++ b/pyzebra/comm_export.py @@ -1,6 +1,3 @@ -path = "C:\\Users\\Jakub\\Desktop\\" -name = "test" - def fill_string(string, total_lenght): """fills string to tatal_length with whitespaces @@ -13,15 +10,15 @@ def fill_string(string, total_lenght): return return_string -def export_comm(data, name): +def export_comm(data, path): """exports data in the *.comm format + :param path: path to file + name :arg data - data to export, is dict after peak fitting - arg: name - name of the exported file """ if data["meta"]["indices"] == "hkl": extension = ".comm" - with open(str(path + name + extension), "w") as out_file: + with open(str(path + extension), "w") as out_file: for keys in data["Measurements"]: try: meas_number_str = fill_string(keys[1:], 6) @@ -80,7 +77,7 @@ def export_comm(data, name): elif data["meta"]["indices"] == "real": extension = ".incomm" - with open(str(path + name + extension), "w") as out_file: + with open(str(path + extension), "w") as out_file: for keys in data["Measurements"]: try: meas_number_str = fill_string(keys[1:], 4)