@@ -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,21 @@ 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 ,
206219) -> str :
207220 """
208221 Add a structure-file-based parametric model to the refinement session.
@@ -214,18 +227,36 @@ async def add_pdf_model(
214227 structure_file_path : str, optional
215228 Path to the structure file.
216229 from_model_name : str, optional
230+ code : str, optional
231+ Code that builds a structure to base the new model on.
232+ library : str, optional
233+ Structure library to use ('Diffpy' or 'ObjCryst').
234+ global_namespace : dict, optional
235+ Global namespace to execute 'code' in.
236+ local_structure_name : str, optional
237+ Name of the structure variable assigned by 'code'.
238+ finite : bool, optional
239+ Whether to use DebyePDFGenerator instead of PDFGenerator.
217240
218241 Notes
219242 -----
220243 'from_model_name' is used to create a new model referencing to an
221244 existing computation object. For example, when the same phase's signal
222245 is observed in multiple profiles, 'from_model_name' allows the refinement
223246 backend to modify the same structure across multiple profiles.
247+
248+ Exactly one of 'structure_file_path', 'from_model_name', or 'code'
249+ must be provided.
224250 """
225251 session .add_pdf_model (
226252 model_name = model_name ,
227253 structure_file_path = structure_file_path ,
228254 from_model_name = from_model_name ,
255+ code = code ,
256+ library = library ,
257+ global_namespace = global_namespace ,
258+ local_structure_name = local_structure_name ,
259+ finite = finite ,
229260 )
230261 return f"Model { model_name } added successfully."
231262
0 commit comments