|
8 | 8 | Getting started |
9 | 9 | ================ |
10 | 10 |
|
11 | | -Here are some example templates provided to help you get started with writing your documentation. You can use these templates to create your own documentation. |
| 11 | +``diffpy.batchpdfsuite`` is a GUI for batch refinements of multiple PDF |
| 12 | +datasets. It is built on top of the |
| 13 | +`diffpy.srfit <https://github.com/diffpy/diffpy.srfit>`_ and |
| 14 | +`diffpy.apps <https://github.com/diffpy/diffpy.apps>`_ libraries. |
12 | 15 |
|
13 | | -Reuse ``.rst`` files across multiple pages |
14 | | ------------------------------------------- |
| 16 | +This tutorial will guide you through the interface and usage of ``diffpy.batchpdfsuite``. |
| 17 | +For installation, please refer to the `README <https://github.com/diffpy/diffpy.batchpdfsuite#installation>`_ |
15 | 18 |
|
16 | | -Here is how you can reuse a reusable block of ``.rst`` files across multiple pages: |
17 | 19 |
|
18 | | -.. include:: snippets/example-table.rst |
| 20 | +``diffpy.batchpdfsuite`` Interface |
| 21 | +---------------------------------- |
19 | 22 |
|
20 | | -.. warning:: |
| 23 | +Here is the main interface of ``diffpy.batchpdfsuite``. |
21 | 24 |
|
22 | | - Ensure that the ``.rst`` file you are including is not too long. If it is too long, it may be better to split it into multiple files and include them separately. |
| 25 | +.. image:: img/bpdfsuite_gui.png |
| 26 | + :width: 100% |
| 27 | + :align: center |
23 | 28 |
|
24 | | -Refer to a specific section in the documentation |
25 | | ------------------------------------------------- |
| 29 | +- *a* - **Settings**: To be implemented in the future for user settings. |
| 30 | +- *b* - **Log**: The panel containing the runtime output during the refinement process. |
| 31 | +- *c* - **Help**: To be implemented in the future for help and documentation. |
| 32 | +- *d* - **Experiment Data Panel**: The panel to load and display the loaded experiment data profile. |
| 33 | +- *e* - **Structure Data Panel**: The panel to load and display the structure file to be used for refinement. |
| 34 | +- *f* - **Control Panel**: The panel to control the refinement process. |
| 35 | +- *g* - **Task Panel**: The panel to view the status of the refinement tasks. Each task is created automatically when the corresponding experiment data is loaded. |
| 36 | + |
| 37 | + |
| 38 | +A Walkthrough Example |
| 39 | +---------------------- |
| 40 | + |
| 41 | +Download the example data from :download:`here <../examples/example.zip>` |
| 42 | + |
| 43 | +1. Unzip the downloaded file. |
| 44 | +2. Launch the ``diffpy.batchpdfsuite`` GUI. |
| 45 | + |
| 46 | +.. code-block:: bash |
| 47 | +
|
| 48 | + bpdfsuite |
| 49 | +
|
| 50 | +
|
| 51 | +3. Load the experiment data by clicking **Select Folder** in the **Experiment Data Panel** and choosing the ``data`` folder in the unzipped example data. |
| 52 | + |
| 53 | +Besides the experiment data profile, the refinement tasks will also be generated automatically. |
| 54 | + |
| 55 | + |
| 56 | +.. image:: img/bpdfsuite_gui_folder_selected.png |
| 57 | + :width: 100% |
| 58 | + :align: center |
26 | 59 |
|
27 | | -You can use the ``ref`` tag to refer to a specific section in the documentation. For example, you can refer to the section below using the ``:ref:`` tag as shown :ref:`here <attach-image>`. |
28 | 60 |
|
29 | 61 | .. note:: |
30 | 62 |
|
31 | | - Please check the raw ``.rst`` file of this page to see the exact use of the ``:ref:`` tag. |
| 63 | + The **Watch** option allows ``diffpy.batchpdfsuite`` to monitor the |
| 64 | + selected folder in real time and create new refinement tasks automatically |
| 65 | + when new experiment data is added to the folder. For simplicity, we will |
| 66 | + not use this option in this tutorial. |
32 | 67 |
|
33 | | -Embed your code snippets in the documentation |
34 | | ---------------------------------------------- |
| 68 | +4. Load the structure file by clicking **Select File** in the **Structure Data Panel** and choosing ``refinement/Ni.cif`` |
35 | 69 |
|
36 | | -Here is how you can write a block of code in the documentation. You can use the ``code-block`` directive to write a block of code in the documentation. For example, you can write a block of code as shown below: |
| 70 | +To load the structure file, you need to set the name for the structure file to be |
| 71 | +referenced in the refinement process and then click **Add File**. You can also |
| 72 | +accepts the default name and click **Add File** directly. |
37 | 73 |
|
38 | | -.. code-block:: bash |
| 74 | +5. Load the refinement settings. You can either |
| 75 | + - Set **Type** to be ``Code`` and load the file ``refinement/template_2.py``. Or |
| 76 | + - Set **Type** to be ``Macro`` and load the file ``refinement/single-phase.dp-in`` |
| 77 | + |
| 78 | +.. note:: |
| 79 | + |
| 80 | + To learn how to write the Python script for ``diffpy.batchpdfsuite``, please |
| 81 | + find the available parameters during the refinement process in the ``refinement/template_2.py`` |
| 82 | + file, and write the script according to your needs. |
39 | 83 |
|
40 | | - # Create a new environment, without build dependencies (pure Python package) |
41 | | - conda create -n <package_name>-env python=3.14 \ |
42 | | - --file requirements/tests.txt \ |
43 | | - --file requirements/conda.txt |
| 84 | + To learn how to write the Diffpy macro file for ``diffpy.batchpdfsuite``, please |
| 85 | + refer to the ``diffpy.apps`` |
| 86 | + `documentation <https://www.diffpy.org/diffpy.apps/getting-started.html#how-to-write-macro>`_ |
44 | 87 |
|
45 | | - # Create a new environment, with build dependencies (non-pure Python package) |
46 | | - conda create -n <package_name>-env python=3.14 \ |
47 | | - --file requirements/tests.txt \ |
48 | | - --file requirements/conda.txt \ |
49 | | - --file requirements/build.txt |
50 | 88 |
|
51 | | - # Activate the environment |
52 | | - conda activate <package_name>_env |
| 89 | +5. Check the ``Sequential`` option in the **Control Panel**. |
53 | 90 |
|
54 | | - # Install your package locally |
55 | | - # `--no-deps` to NOT install packages again from `requirements.pip.txt` |
56 | | - pip install -e . --no-deps |
| 91 | +.. note:: |
57 | 92 |
|
58 | | - # Run pytest locally |
59 | | - pytest |
| 93 | + The ``Sequential`` option allows the parameters in the following tasks to take |
| 94 | + their previous task's refined values as their initial values. |
| 95 | + |
| 96 | + |
| 97 | +6. Set the sorting regex to be ``(\d+)(?=K)`` and click **Apply** in the **Task Panel**. |
| 98 | + |
| 99 | +Sequential refinement requires the tasks to be sorted in a specific order, i.e. for |
| 100 | +temperature-dependent refinement, the tasks should be sorted in ascending/descending order of temperature. |
| 101 | + |
| 102 | +.. note:: |
60 | 103 |
|
61 | | - # ... run example tutorials |
| 104 | + The sorting regex ``(\d+)(?=K)`` is used to extract the temperature value |
| 105 | + from the experiment data file name. ``\d`` means any numeric digit, |
| 106 | + and ``+`` means the previous character, ``\d`` in this case, should be repeated one or more times. |
| 107 | + The ``(?=K)`` ensures that the previous matched group, ``(\d+)`` in this case, |
| 108 | + must be followed by the character ``K``. |
62 | 109 |
|
63 | | -.. _attach-image: |
| 110 | + To learn more about regex, please refer to the `Python regex documentation <https://docs.python.org/3/library/re.html>`_ |
64 | 111 |
|
65 | | -Attach an image to the documentation |
66 | | ------------------------------------- |
67 | 112 |
|
68 | | -Here is how you attach an image to the documentation. The ``/docs/source/img/scikit-package-logo-text.png`` example image is provided in the template. |
| 113 | +7. Select the tasks you want to begin the process and click **Start** in the **Control Panel**. |
69 | 114 |
|
70 | | -.. image:: ./img/scikit-package-logo-text.png |
71 | | - :alt: codecov-in-pr-comment |
72 | | - :width: 400px |
73 | | - :align: center |
| 115 | +.. image:: img/bpdfsuite_gui_before_start.png |
| 116 | + :width: 100% |
| 117 | + :align: center |
74 | 118 |
|
| 119 | +8. Click the **Log** Icon to view the runtime output during the refinement process. |
75 | 120 |
|
76 | | -Other useful directives |
77 | | ------------------------ |
| 121 | +9. Double click the finished tasks in the **Task Panel** to view the refined results. |
78 | 122 |
|
79 | | -Here is how you can do menu selection :menuselection:`Admin --> Settings` and display labels for buttons like :guilabel:`Privacy level`. |
| 123 | +10. (Optional) Click **Save to** in the **Task Panel** to save the result in another place. By default, they are |
| 124 | +stored in ``fit_results`` under the experiment data folder. |
0 commit comments