File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ def get_args(override_cli_inputs=None):
124
124
),
125
125
default = None ,
126
126
)
127
+ p .add_argument (
128
+ "-z" ,
129
+ "--z-scan-file" ,
130
+ help = "Path to the z-scan file to be loaded to overload the mu*D value." ,
131
+ default = None ,
132
+ )
127
133
args = p .parse_args (override_cli_inputs )
128
134
return args
129
135
Original file line number Diff line number Diff line change 1
1
import copy
2
2
from pathlib import Path
3
3
4
+ from diffpy .labpdfproc .mud_calculator import compute_mud
4
5
from diffpy .utils .tools import get_package_info , get_user_info
5
6
6
7
WAVELENGTHS = {"Mo" : 0.71 , "Ag" : 0.59 , "Cu" : 1.54 }
@@ -134,6 +135,28 @@ def set_wavelength(args):
134
135
return args
135
136
136
137
138
+ def set_mud (args ):
139
+ """
140
+ Set the mud based on the given input arguments
141
+
142
+ Parameters
143
+ ----------
144
+ args argparse.Namespace
145
+ the arguments from the parser
146
+
147
+ Returns
148
+ -------
149
+ args argparse.Namespace
150
+ """
151
+ if args .z_scan_file :
152
+ filepath = Path (args .z_scan_file ).resolve ()
153
+ if not filepath .is_file ():
154
+ raise FileNotFoundError (f"Cannot find { args .z_scan_file } . Please specify a valid file path." )
155
+ args .z_scan_file = filepath
156
+ args .mud = compute_mud (filepath )
157
+ return args
158
+
159
+
137
160
def _load_key_value_pair (s ):
138
161
items = s .split ("=" )
139
162
key = items [0 ].strip ()
@@ -234,6 +257,7 @@ def preprocessing_args(args):
234
257
args = set_input_lists (args )
235
258
args .output_directory = set_output_directory (args )
236
259
args = set_wavelength (args )
260
+ args = set_mud (args )
237
261
args = load_user_metadata (args )
238
262
return args
239
263
You can’t perform that action at this time.
0 commit comments