Skip to content

Commit 1dbca47

Browse files
Merge pull request #1 from Countoscope/added-tutorial
added simple tutorial to doc
2 parents 3f9e66b + 01f3030 commit 1dbca47

File tree

4 files changed

+103
-5
lines changed

4 files changed

+103
-5
lines changed

README.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Countoscope documentation
22
=========================
33

4+
This repository is dedicated to the documentation of the Countoscope. The documentation
5+
is generated by |Sphinx|, a powerful
6+
documentation generator for Python projects that transforms reStructuredText into
7+
HTML, LaTeX, and other formats.
8+
9+
.. |Sphinx| raw:: html
10+
11+
<a href="https://www.sphinx-doc.org" target="_blank">Sphinx</a>
12+
413
How to
514
------
615

docs/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
extensions = [
1717
'sphinx.ext.autodoc',
18+
'sphinx.ext.mathjax',
1819
]
1920

2021
templates_path = ['_templates']

docs/source/index.rst

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ Countoscope
88
Indices and tables
99
==================
1010

11-
* :ref:`genindex`
12-
* :ref:`modindex`
13-
* :ref:`search`
11+
.. toctree::
12+
:caption: Tutorial
13+
:maxdepth: 2
14+
:hidden:
15+
16+
tutorials/tutorial
1417

15-
.. toctree::
18+
.. toctree::
19+
:caption: Python modules
1620
:maxdepth: 2
1721
:hidden:
1822

1923
modules/trajectorytool
2024
modules/boxcountingtool
21-
modules/countoscope
25+
modules/countoscope

docs/source/tutorials/tutorial.rst

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Tutorial
2+
========
3+
4+
Installation
5+
------------
6+
7+
In order to install the Countoscope Python tool, clone the repository using:
8+
9+
.. code:: bash
10+
11+
git clone https://github.com/Countoscope/countoscope.git
12+
13+
Install all the required Python packages using:
14+
15+
.. code:: bash
16+
17+
pip install -r requirements.txt
18+
19+
Then, type:
20+
21+
.. code:: bash
22+
23+
pip install .
24+
25+
Use
26+
---
27+
28+
In a Python script or a Jupyter Notebook, define the path to the data trajectory
29+
file. For instance, using the `3D-closed` dataset provided in the `datasets`
30+
repository:
31+
32+
.. code:: python
33+
34+
path_to_data = "/mpath/datasets/datasets/3D-closed/trajectory.xyz"
35+
36+
Import the Countoscope as well as NumPy by typing:
37+
38+
.. code:: python
39+
40+
from countoscope import Countoscope
41+
import numpy as np
42+
43+
The trajectory file `trajectory.xyz` corresponds to a system of 190 particles in
44+
a :math:`(30 Å)^3` box. Let us define the system size as a NumPy array:
45+
46+
.. code:: python
47+
48+
system_size = np.array([30, 30, 30])
49+
50+
Finally, let us choose a grid size for the Countoscope measurement:
51+
52+
.. code:: python
53+
54+
box_size=np.array([10, 10, 10])
55+
56+
Then, launch the Countoscope calculation using *trajectory_file*, *system_size*,
57+
and *box_size* as input parameters:
58+
59+
.. code:: python
60+
61+
results = Countoscope(trajectory_file = path_to_data,
62+
system_size=system_size,
63+
box_size=box_size)
64+
results.run()
65+
66+
After the calculation is done, all the computed data can be obtained from the
67+
`results`object. For instance, for :math:`<N>`, type:
68+
69+
.. code:: python
70+
71+
print(np.round(results.mean_of_N,2))
72+
73+
which will return:
74+
75+
.. code:: bash
76+
77+
0.84
78+
79+
To plot :math:`<\Delta N^2>`, let us import Pyplot first:
80+
81+
.. code:: python
82+
83+
import matplotlib.pyplot as plt
84+
plt.loglog(results.delta_n2)

0 commit comments

Comments
 (0)