Skip to content

Commit d7cc236

Browse files
Paul KienzleDrPaulSharp
authored andcommitted
Fix docstrings for data functions. Support Path object for load_data
1 parent d8274ef commit d7cc236

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

sasmodels/bumps_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def plot(self, view=None):
271271
def simulate_data(self, noise=None):
272272
# type: (float) -> None
273273
"""
274-
Generate simulated data.
274+
Generate simulated data. *noise* is the fractional uncertainty in percent.
275275
"""
276276
Iq = self.theory()
277277
self._set_data(Iq, noise)

sasmodels/data.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def load_data(filename, index=0):
5959
except ImportError as ie:
6060
raise ImportError(f"{ie.name} is not available. Add sasdata to the python path.")
6161
loader = Loader()
62+
filename = str(filename) # In case a Path was given.
6263
# Allow for one part in multipart file
6364
if '[' in filename:
6465
filename, indexstr = filename[:-1].split('[')
@@ -344,10 +345,14 @@ def empty_data1D(q, resolution=0.0, L=0., dL=0.):
344345
r"""
345346
Create empty 1D data using the given *q* as the x value.
346347
347-
rms *resolution* $\Delta q/q$ defaults to 0%. If wavelength *L* and rms
348-
wavelength divergence *dL* are defined, then *resolution* defines
349-
rms $\Delta \theta/\theta$ for the lowest *q*, with $\theta$ derived from
350-
$q = 4\pi/\lambda \sin(\theta)$.
348+
rms *resolution* $\Delta q/q$ defaults to 0.0. Note that this is
349+
expressed as a fraction rather than a percentage.
350+
351+
If wavelength *L* and rms wavelength divergence *dL* are given, then
352+
angle *theta* is infered from $q = 4\pi/\lambda \sin(\theta)$, and
353+
the *resolution* term applies to rms $\Delta \theta/\theta$ instead
354+
of $\Delta q/q$. Resolution $\Delta q$ is then calculated from wavelength
355+
and angular resolution.
351356
"""
352357

353358
#Iq = 100 * np.ones_like(q)
@@ -378,7 +383,7 @@ def empty_data2D(qx, qy=None, resolution=0.0):
378383
379384
If *qy* is missing, create a square mesh with *qy=qx*.
380385
381-
*resolution* dq/q defaults to 5%.
386+
*resolution* dq/q defaults to 0.0.
382387
"""
383388
if qy is None:
384389
qy = qx

0 commit comments

Comments
 (0)