removed strings, added argument
This commit is contained in:
parent
a24982fa0b
commit
c6636ef212
@ -1,6 +1,3 @@
|
|||||||
path = "C:\\Users\\Jakub\\Desktop\\"
|
|
||||||
name = "test"
|
|
||||||
|
|
||||||
|
|
||||||
def fill_string(string, total_lenght):
|
def fill_string(string, total_lenght):
|
||||||
"""fills string to tatal_length with whitespaces
|
"""fills string to tatal_length with whitespaces
|
||||||
@ -13,15 +10,15 @@ def fill_string(string, total_lenght):
|
|||||||
return return_string
|
return return_string
|
||||||
|
|
||||||
|
|
||||||
def export_comm(data, name):
|
def export_comm(data, path):
|
||||||
"""exports data in the *.comm format
|
"""exports data in the *.comm format
|
||||||
|
:param path: path to file + name
|
||||||
:arg data - data to export, is dict after peak fitting
|
:arg data - data to export, is dict after peak fitting
|
||||||
arg: name - name of the exported file
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if data["meta"]["indices"] == "hkl":
|
if data["meta"]["indices"] == "hkl":
|
||||||
extension = ".comm"
|
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"]:
|
for keys in data["Measurements"]:
|
||||||
try:
|
try:
|
||||||
meas_number_str = fill_string(keys[1:], 6)
|
meas_number_str = fill_string(keys[1:], 6)
|
||||||
@ -80,7 +77,7 @@ def export_comm(data, name):
|
|||||||
|
|
||||||
elif data["meta"]["indices"] == "real":
|
elif data["meta"]["indices"] == "real":
|
||||||
extension = ".incomm"
|
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"]:
|
for keys in data["Measurements"]:
|
||||||
try:
|
try:
|
||||||
meas_number_str = fill_string(keys[1:], 4)
|
meas_number_str = fill_string(keys[1:], 4)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user