Skip to content

Commit bbee912

Browse files
committed
update quickstart
1 parent 1fca6d7 commit bbee912

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

docs/quickstart.rst

+42-3
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@ The different sub-packages must be imported separately, depending on your needs:
6464
import pyhdtoolkit.maths
6565
import pyhdtoolkit.models
6666
import pyhdtoolkit.optics
67+
import pyhdtoolkit.plotting
6768
import pyhdtoolkit.utils
6869

6970
Cpymadtools
7071
^^^^^^^^^^^
7172

7273
The core of ``PyhDToolkit`` is the :ref:`cpymadtools <pyhdtoolkit-cpymadtools>` sub-package.
7374
It provides an ensemble of functionality to perform operations with and from `~cpymad.madx.Madx` objects;
74-
and conveniently setup, run, analyze and plot ``MAD-X`` simulations and their results.
75+
and conveniently setup, run and analyze ``MAD-X`` simulations and their results.
7576

7677
All the public apis in the `~pyhdtoolkit.cpymadtools` work in the same fashion: call them with as first argument your
7778
`~cpymad.madx.Madx` instance, and then any `args` and `kwargs` relevant to the functionality at hand.
@@ -92,15 +93,53 @@ Then using the `~pyhdtoolkit.cpymadtools` apis goes as:
9293
In the `~pyhdtoolkit.cpymadtools` one will find modules to:
9394

9495
* Encompass existing ``MAD-X`` commands, such as for example :ref:`matching <cpymadtools-matching>` or :ref:`tracking <cpymadtools-track>`;
95-
* Perform useful routines with a clean pythonic interface (for instance :ref:`betatron coupling <cpymadtools-coupling>` calculation and handling, :ref:`errors assignments <cpymadtools-errors>`);
96+
* Perform useful routines with a clean pythonic interface (for instance :ref:`betatron coupling <cpymadtools-coupling>` calculation and handling, :ref:`errors assignments <cpymadtools-errors>` or :ref:`table querying <cpymadtools-utils>`);
9697
* Run :ref:`(HL)LHC <cpymadtools-lhc>` specific functionality, mostly tailored to my work.
9798

9899
One can find many examples of the `~pyhdtoolkit.cpymadtools` apis' use in the :ref:`gallery <gallery>` section of this documentation.
99100

101+
Plotting
102+
^^^^^^^^
103+
104+
The :ref:`plotting <pyhdtoolkit-plotting>` sub-package provides a set of functions to create plots supporting or showcasing the results of ``MAD-X`` simulations.
105+
It also provides convenience plotting utilities and a set of `matplotlib` styles that work well in conjunction with the various plotting APIs.
106+
107+
Some public apis in `~pyhdtoolkit.plotting` can be used as standalone while others work in the same way as the `~pyhdtoolkit.cpymadtools` apis, by being called with a `~cpymad.madx.Madx` instance as first arguments and then any `args` and `kwargs` relevant to plotting.
108+
In the second case, relevant data for the plotting is directly queried and computed by interacting with the `~cpymad.madx.Madx` instance.
109+
110+
Using the `~pyhdtoolkit.plotting` apis goes as:
111+
112+
.. tabbed:: Standalone
113+
114+
.. prompt:: python >>>
115+
116+
from pyhdtoolkit.plotting.tune import plot_tune_diagram # for instance
117+
plot_tune_diagram(max_order=6, differentiate_orders=True) # and enjoy the result!
118+
119+
.. tabbed:: Interacting with MAD-X
120+
121+
Let's say one has initiated their ``MAD-X`` simulation through `~cpymad.madx.Madx` as follows:
122+
123+
.. prompt:: python >>>
124+
125+
from cpymad.madx import Madx
126+
madx = Madx()
127+
# do some simulation with this instance
128+
129+
Then using the api goes as:
130+
131+
.. prompt:: python >>>
132+
133+
from pyhdtoolkit.plotting.aperture import plot_aperture # for instance
134+
plot_aperture(madx, *args, **kwargs) # and enjoy the result!
135+
136+
137+
One can find many examples of the `~pyhdtoolkit.plotting` apis' use in the :ref:`gallery <gallery>` section of this documentation.
138+
100139
Utilities
101140
^^^^^^^^^
102141

103-
The :ref:`utils <pyhdtoolkit-utils>` module contains useful functions to set up (:ref:`logging <utils-logging>`, run external programs through the :ref:`command line <utils-cmdline>`,
142+
The :ref:`utils <pyhdtoolkit-utils>` module contains useful functions to set up :ref:`logging <utils-logging>`, run external programs through the :ref:`command line <utils-cmdline>`,
104143
run your functions through :ref:`useful contexts <utils-contexts>`, easily wrap and :ref:`parallelise <utils-executors>`
105144
functions, or perform many convenient :ref:`operations <utils-operations>` on miscellaneous Python objects.
106145

0 commit comments

Comments
 (0)