You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/quickstart.rst
+42-3
Original file line number
Diff line number
Diff line change
@@ -64,14 +64,15 @@ The different sub-packages must be imported separately, depending on your needs:
64
64
import pyhdtoolkit.maths
65
65
import pyhdtoolkit.models
66
66
import pyhdtoolkit.optics
67
+
import pyhdtoolkit.plotting
67
68
import pyhdtoolkit.utils
68
69
69
70
Cpymadtools
70
71
^^^^^^^^^^^
71
72
72
73
The core of ``PyhDToolkit`` is the :ref:`cpymadtools <pyhdtoolkit-cpymadtools>` sub-package.
73
74
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, runand analyze ``MAD-X`` simulations and their results.
75
76
76
77
All the public apis in the `~pyhdtoolkit.cpymadtools` work in the same fashion: call them with as first argument your
77
78
`~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:
92
93
In the `~pyhdtoolkit.cpymadtools` one will find modules to:
93
94
94
95
* 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>`);
96
97
* Run :ref:`(HL)LHC <cpymadtools-lhc>` specific functionality, mostly tailored to my work.
97
98
98
99
One can find many examples of the `~pyhdtoolkit.cpymadtools` apis' use in the :ref:`gallery <gallery>` section of this documentation.
99
100
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
+
100
139
Utilities
101
140
^^^^^^^^^
102
141
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>`,
104
143
run your functions through :ref:`useful contexts <utils-contexts>`, easily wrap and :ref:`parallelise <utils-executors>`
105
144
functions, or perform many convenient :ref:`operations <utils-operations>` on miscellaneous Python objects.
0 commit comments