@@ -102,7 +102,6 @@ async def add_profile_from_file(
102102async def add_profile_from_arrays (
103103 xarray : Annotated [list , "X-values of the profile" ],
104104 yarray : Annotated [list , "Y-values of the profile" ],
105- dx : Annotated [list , "Uncertainties in the x-values" ] = None ,
106105 dy : Annotated [list , "Uncertainties in the y-values" ] = None ,
107106 profile_name : Annotated [str , "Unique name for the profile" ] = None ,
108107 xname : Annotated [str , "Name of the x-axis for the profile" ] = "x" ,
@@ -113,7 +112,6 @@ async def add_profile_from_arrays(
113112 session .add_profile_from_arrays (
114113 xarray ,
115114 yarray ,
116- dx = dx ,
117115 dy = dy ,
118116 profile_name = profile_name ,
119117 xname = xname ,
@@ -203,6 +201,24 @@ async def add_pdf_model(
203201 from_model_name : Annotated [
204202 str , "Name of the existing model to base the new model on"
205203 ] = None ,
204+ code : Annotated [
205+ str , "Code that builds a structure to base the new model on"
206+ ] = None ,
207+ library : Annotated [
208+ str , "Structure library to use ('Diffpy' or 'ObjCryst')"
209+ ] = "Diffpy" ,
210+ global_namespace : Annotated [
211+ dict , "Global namespace to execute 'code' in"
212+ ] = {},
213+ local_structure_name : Annotated [
214+ str , "Name of the structure variable assigned by 'code'"
215+ ] = "structure" ,
216+ finite : Annotated [
217+ bool , "Whether to use DebyePDFGenerator instead of PDFGenerator"
218+ ] = False ,
219+ run_parallel : Annotated [
220+ bool , "Whether to run the PDF model in parallel"
221+ ] = True ,
206222) -> str :
207223 """
208224 Add a structure-file-based parametric model to the refinement session.
@@ -214,18 +230,39 @@ async def add_pdf_model(
214230 structure_file_path : str, optional
215231 Path to the structure file.
216232 from_model_name : str, optional
233+ code : str, optional
234+ Code that builds a structure to base the new model on.
235+ library : str, optional
236+ Structure library to use ('Diffpy' or 'ObjCryst').
237+ global_namespace : dict, optional
238+ Global namespace to execute 'code' in.
239+ local_structure_name : str, optional
240+ Name of the structure variable assigned by 'code'.
241+ finite : bool, optional
242+ Whether to use DebyePDFGenerator instead of PDFGenerator.
243+ run_parallel : bool, optional
244+ Whether to run the PDF model in parallel.
217245
218246 Notes
219247 -----
220248 'from_model_name' is used to create a new model referencing to an
221249 existing computation object. For example, when the same phase's signal
222250 is observed in multiple profiles, 'from_model_name' allows the refinement
223251 backend to modify the same structure across multiple profiles.
252+
253+ Exactly one of 'structure_file_path', 'from_model_name', or 'code'
254+ must be provided.
224255 """
225256 session .add_pdf_model (
226257 model_name = model_name ,
227258 structure_file_path = structure_file_path ,
228259 from_model_name = from_model_name ,
260+ code = code ,
261+ library = library ,
262+ global_namespace = global_namespace ,
263+ local_structure_name = local_structure_name ,
264+ finite = finite ,
265+ run_parallel = run_parallel ,
229266 )
230267 return f"Model { model_name } added successfully."
231268
0 commit comments