Skip to content

Commit d4b9359

Browse files
committed
update tools examples to reflect new cli
1 parent d6c352e commit d4b9359

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

docs/source/examples/tools-example.rst

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ You can do this in one of the following four ways:
2020
# Option 2: From a z-scan file
2121
args = Namespace(z_scan_file="zscan.xy")
2222
# Option 3: Using sample mass density
23-
args = Namespace(theoretical_from_density="ZrO2,17.45,1.2")
24-
# Option 4: Using packing fraction
25-
args = Namespace(theoretical_from_packing="ZrO2,17.45,0.3")
23+
args = Namespace(sample_composition="ZrO2", sample_mass_density="17.45", diameter="1.2")
2624
# Set and view the computed mu*D value
2725
args = set_mud(args)
2826
print(args.mud)
2927
3028
31-
2. Next, we load the input files for correction using ``set_input_lists(args)``:
29+
1. Next, we load the input files for correction using ``set_input_lists(args)``:
3230

3331
.. code-block:: python
3432
@@ -59,24 +57,13 @@ If no output directory is specified, it defaults to the current working director
5957
# Option 1: Specify wavelength directly
6058
args = Namespace(wavelength=0.7)
6159
# Option 2: Use a valid anode type
62-
args = Namespace(anode_type="Mo")
60+
args = Namespace(wavelength="Mo")
6361
args = set_wavelength(args)
6462
6563
Note that you should specify either a wavelength or an anode type, not both, to avoid conflicts.
6664
If you provide an anode type, the corresponding wavelength will be retrieved from global parameters.
6765
You may use ``labpdfproc --help`` to view a list of valid anode types.
6866
If neither is given, it's only acceptable if the input diffraction data is already on a two-theta grid.
69-
To simplify workflows and avoid re-entering it every time,
70-
we recommend saving the wavelength or anode type to a diffpy config file. For example:
71-
72-
.. code-block:: python
73-
74-
from pathlib import Path
75-
import json
76-
home_dir = Path.home()
77-
wavelength_data = {"wavelength": 0.3}
78-
with open(home_dir / "diffpyconfig.json", "w") as f:
79-
json.dump(wavelength_data, f)
8067

8168
To set the x-axis type (xtype) for your diffraction data:
8269

@@ -88,7 +75,7 @@ To set the x-axis type (xtype) for your diffraction data:
8875
This sets the xtype to ``tth``. Other valid options including ``q`` and ``d`` spacing.
8976

9077

91-
5. Finally, we load user metadata, user information, and package information into ``args``.
78+
1. Finally, we load user metadata, user information, and package information into ``args``.
9279
To load metadata, pass key-value pairs as a list:
9380

9481
.. code-block:: python
@@ -137,3 +124,19 @@ Using the function ``load_metadata(args, filepath)``
137124
requires both the ``argument.Namespace`` and the current input file path.
138125
For more details about working with diffraction objects and how they are written to output files, see
139126
https://www.diffpy.org/diffpy.utils/examples/diffraction_objects_example.html.
127+
128+
129+
Creating ``diffpyconfig.json`` file
130+
-----------------------------------
131+
132+
To simplify workflows and avoid re-entering it every time,
133+
we recommend saving the wavelength or anode type to a diffpy config file. For example,
134+
135+
.. code-block:: python
136+
137+
from pathlib import Path
138+
import json
139+
home_dir = Path.home()
140+
wavelength_data = {"wavelength": 0.3}
141+
with open(home_dir / "diffpyconfig.json", "w") as f:
142+
json.dump(wavelength_data, f)

0 commit comments

Comments
 (0)