File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ def get_args(override_cli_inputs=None):
124124 ),
125125 default = None ,
126126 )
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+ )
127133 args = p .parse_args (override_cli_inputs )
128134 return args
129135
Original file line number Diff line number Diff line change 11import copy
22from pathlib import Path
33
4+ from diffpy .labpdfproc .mud_calculator import compute_mud
45from diffpy .utils .tools import get_package_info , get_user_info
56
67WAVELENGTHS = {"Mo" : 0.71 , "Ag" : 0.59 , "Cu" : 1.54 }
@@ -134,6 +135,28 @@ def set_wavelength(args):
134135 return args
135136
136137
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+
137160def _load_key_value_pair (s ):
138161 items = s .split ("=" )
139162 key = items [0 ].strip ()
@@ -234,6 +257,7 @@ def preprocessing_args(args):
234257 args = set_input_lists (args )
235258 args .output_directory = set_output_directory (args )
236259 args = set_wavelength (args )
260+ args = set_mud (args )
237261 args = load_user_metadata (args )
238262 return args
239263
You can’t perform that action at this time.
0 commit comments