Skip to content

Commit 92b8fe4

Browse files
committed
chore: update argument names
1 parent 8dae7fa commit 92b8fe4

3 files changed

Lines changed: 65 additions & 4 deletions

File tree

‎news/misc_functionalities.rst‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**Added:**
2+
3+
* Add generator parallelism.
4+
* Add soft bounds.
5+
* add a tool to download cif file from database.
6+
7+
**Changed:**
8+
9+
* <news item>
10+
11+
**Deprecated:**
12+
13+
* <news item>
14+
15+
**Removed:**
16+
17+
* <news item>
18+
19+
**Fixed:**
20+
21+
* <news item>
22+
23+
**Security:**
24+
25+
* <news item>

‎src/diffpy/apps/refinebase/refinement_server.py‎

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ async def add_profile_from_file(
102102
async 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

‎src/diffpy/apps/refinebase/refinement_session.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def add_profile_from_arrays(
5656
self,
5757
xarray,
5858
yarray,
59-
dx=None,
6059
dy=None,
6160
profile_name: str = None,
6261
xname: str = "x",
@@ -68,7 +67,7 @@ def add_profile_from_arrays(
6867
if profile_name is None:
6968
profile_name = str(uuid.uuid4())
7069
profile = Profile()
71-
profile.setObservedProfile(xarray, yarray, dx=dx, dy=dy)
70+
profile.setObservedProfile(xobs=xarray, yobs=yarray, dyobs=dy)
7271
profile.xpar.name = xname
7372
profile._xname = xname
7473
profile.ypar.name = yname

0 commit comments

Comments
 (0)