.. _sb_overview:

Overview of xpd acquisition environment
---------------------------------------

All experiments will be carried out in the ``pe2_data/xpdUser`` directory tree.

At the beginning of beamtime, users will be presented with a standard set of directories
inside  ``pe2_data/xpdUser``.  The directories and their purpose are shown in the table
below.

All the directories will be empty initially. However, users can place predefined
files, which helps to accelerate the experiments, in ``Import`` directory. Normally this
file will be generated by running a simulated experiment using xpdAcq.
If these files do not exist, that is not a problem. But, there will be much more
typing when setting up the metadata during beamtime.

Once the directories are set-up, the experiment is run by typing ``xpdui``
which places you into an ``ipython`` session.  The available commands and workflow
are described under :ref:`xpdu`.

Table of directories and their uses:

+---------------+------------------------------------------------------------+
|Directory Name |Contents                                                    |
+===============+============================================================+
|Import         |Here, users place pre-populated Sample spreadsheet(.xlsx)   |
|               |pre-made files user scripts (.py),                          |
|               |detector-image mask files (.npy), files containing xpdAcq   |
|               |objects (extension .yml) or an archived file made of mix of |
|               |them. The user can use ``import_userScriptsEtc`` to unpack  |
|               |and import those files.                                     |
+---------------+------------------------------------------------------------+
|config_base    |This contains the calibration parameters, config file and   |
|               |mask file used by ``xPDFsuite`` and ``xpdacq``.             |
|               |Only the programs should write in this directory.           |
|               |Users are advised to not edit or add anything to this       |
|               |directory.                                                  |
+---------------+------------------------------------------------------------+
|tiff_base      |This is where all the image files (.tif) are stored and     |
|               |*can be extracted* from the database using ``databroker``   |
|               |library during the experiment.                              |
+---------------+------------------------------------------------------------+
|userScripts    |This is a handy space where the users can write their own   |
|               |experiment scripts and save them. They will be bundled up   |
|               |at the end of the experiment so that the user can take them |
+---------------+------------------------------------------------------------+
|userAnalysis   |Users can create any sets of directories under here for     |
|               |storing analysis files (e.g those saved by xPDFsuite).      |
+---------------+------------------------------------------------------------+
|...            |In fact, users can create any directories and files         |
|               |they want. This is because at the end of beamtime, they     |
|               |will be bundled, tarred and zipped as to be taken home.     |
|               |                                                            |
+---------------+------------------------------------------------------------+

For detailed information, proceed to **XPD user** section
