@@ -20,6 +20,18 @@ def save_tsv_approach_retract(filename, fdist_list, ratings=[]):
20
20
[np .nan ]* len (fdist_list )])
21
21
columns .append (["Y Position" ,
22
22
[np .nan ]* len (fdist_list )])
23
+ # Add maximum indentation
24
+ maxindent = []
25
+ for fd in fdist_list :
26
+ if "tip position" in fd :
27
+ cp = fd .fit_properties ["params_fitted" ]["contact_point" ].value
28
+ idmax = fd .data .appr ["fit" ].argmax ()
29
+ mi = fd .data .appr ["tip position" ][idmax ]
30
+ mival = (cp - mi )* 1e6
31
+ else :
32
+ mival = np .nan
33
+ maxindent .append (mival )
34
+ columns .append (["Maximum indentation [µm]" , maxindent ])
23
35
# Add fit parameters
24
36
model_key = fdist_list [0 ].fit_properties ["model_key" ]
25
37
model = nmodel .models_available [model_key ]
@@ -53,7 +65,9 @@ def save_tsv(filename, column_lists):
53
65
E.g.: ["Column One", [1.1, 2.2, 3.3, 4.4],
54
66
"Column Two", [nan, 2.0, 4.0, 1.0]]
55
67
"""
56
- with codecs .open (filename , "w" , encoding = "utf-8" ) as fd :
68
+ with codecs .open (filename , "wb" ) as fd :
69
+ fd .write (codecs .BOM_UTF8 )
70
+ with codecs .open (filename , "a" , encoding = "utf-8" ) as fd :
57
71
# Write header:
58
72
header = "\t " .join ([d [0 ] for d in column_lists ])
59
73
fd .write (header + "\r \n " )
0 commit comments