Skip to content

Commit 726a340

Browse files
committed
Last minute fixes, tests went through
Slight changes to the README, added a Misc section. A last check / modification of docstrings.
1 parent 875047b commit 726a340

File tree

6 files changed

+147
-33
lines changed

6 files changed

+147
-33
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PyhDToolkit: An all-in-one toolkit package for Python work in my PhD.
22

3-
This repository is a package gathering a number of Python utilities for my PhD.
3+
This repository is a package gathering a number of Python utilities for my work.
44

55
## Installation
66

@@ -35,7 +35,7 @@ make tests
3535

3636
## Standards, Tools and VCS
3737

38-
This repository respects the PyCharm docstring format (because it's the tool I use), and uses [Black][black_formatter] as a code formatter.
38+
This repository respects the PyCharm docstring format, and uses [Black][black_formatter] as a code formatter.
3939
The default enforced line length is 120 characters.
4040
You can lint the code with:
4141
```bash
@@ -45,11 +45,28 @@ make black
4545
VCS is done through [git][git_ref] and follows the [Gitflow][gitflow_ref] workflow.
4646
As a consequence, make sure to always install from `master`.
4747

48+
## Miscellaneous Goodies
49+
50+
Feel free to explore the `Makefile` and make use of the functions it offers.
51+
You can get an idea of what is available to you by running:
52+
```bash
53+
make help
54+
```
55+
56+
This repository currently comes with an `environment.yml` file to reproduce a fully compatible conda environment.
57+
You can install this environment and add it to your ipython kernel by running:
58+
```bash
59+
make condaenv
60+
```
61+
62+
A Dockerfile and later on an [OCI][oci_ref]-compliant file are to come.
63+
4864
## License
4965

50-
Copyright © 2019 Felix Soubelet. [MIT License][license]
66+
Copyright © 2019-2020 Felix Soubelet. [MIT License][license]
5167

5268
[black_formatter]: https://github.com/psf/black
5369
[gitflow_ref]: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
5470
[git_ref]: https://git-scm.com/
55-
[license]: https://github.com/fsoubelet/PyhDToolkit/blob/master/LICENSE
71+
[license]: https://github.com/fsoubelet/PyhDToolkit/blob/master/LICENSE
72+
[oci_ref]: https://www.opencontainers.org/

pyhdtoolkit/cpymadtools/latwiss.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ def plot_latwiss(cpymad_instance, title: str, fig_size: tuple, ncells: int, **kw
5353
Provided with an active Cpymad class after having ran a script, will create a plot representing nicely the
5454
lattice layout and the beta functions along with the horizontal dispertion function. Original code is from
5555
Guido Sterbini.
56-
:param cpymad_instance: an instanciated `cpymad.MadX` object.
56+
:param cpymad_instance: an instanciated `cpymad.madx.Madx` object.
5757
:param title: title of your plot.
5858
:param fig_size: figure size.
5959
:param ncells: number of cells of your lattice.
60-
:param kwargs:
61-
:return:
60+
:return: nothing, plots and eventually saves the figure as a file.
6261
"""
6362
# Getting kwargs and instantiating
6463
x_limits = kwargs.get("xlim", None)
@@ -129,10 +128,9 @@ def plot_machine_survey(cpymad_instance, fig_size: tuple, **kwargs) -> None:
129128
"""
130129
Provided with an active Cpymad class after having ran a script, will create a plot representing the machine
131130
geometry in 2D. Original code is from Guido Sterbini.
132-
:param cpymad_instance: an instanciated `cpymad.MadX` object.
131+
:param cpymad_instance: an instanciated `cpymad.madx.Madx` object.
133132
:param fig_size: figure size.
134-
:param kwargs:
135-
:return:
133+
:return: nothing, plots and eventually saves the figure as a file.
136134
"""
137135
savefig = kwargs.get("savefig", False)
138136
cpymad_instance.input("survey;")

pyhdtoolkit/cpymadtools/plotters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def plot_normalized_phase_space(cpymad_instance, u_coordinates, pu_coordinates,
5858
"""
5959
Plots the normalized phase space of a particle distribution when provided by position and momentum coordinates
6060
for a specific plane.
61-
:param cpymad_instance: an instanciated `cpymad.MadX` object.
61+
:param cpymad_instance: an instanciated `cpymad.madx.Madx` object.
6262
:param u_coordinates: coordinates of particles.
6363
:param pu_coordinates: momentum coordinates of particles.
6464
:param kwargs: The looked for keywords are `size`, `plane`, and `savefig`. They give the possibility of
@@ -104,7 +104,7 @@ def plot_normalized_phase_space_colored(cpymad_instance, u_coordinates, pu_coord
104104
Plots the normalized phase space of a particle distribution when provided by position and momentum coordinates
105105
for a specific plane. Each particle trajectory has its own color on the plot, within the limit of pyplot's 156
106106
named colors. The sequence repeats after the 156th color.
107-
:param cpymad_instance: an instanciated `cpymad.MadX` object.
107+
:param cpymad_instance: an instanciated `cpymad.madx.Madx` object.
108108
:param u_coordinates: coordinates of particles.
109109
:param pu_coordinates: momentum coordinates of particles.
110110
:param kwargs: The looked for keywords are `size`, `plane`, and `savefig`. They give the possibility of
@@ -160,7 +160,7 @@ def farey_sequence(n: int) -> list:
160160
"""
161161
Return the n-th farey_sequence sequence, ascending. Original code from Rogelio Tomás.
162162
:param n: the order up to which we want to calculate the sequence.
163-
:return: the sequence.
163+
:return: the sequence as a list.
164164
"""
165165
seq = [[0, 1]]
166166
a, b, c, d = 0, 1, 1, n
@@ -215,7 +215,7 @@ def plot_tune_diagram(
215215
) -> None:
216216
"""
217217
Plots the evolution of particles' tunes on a Tune Diagram.
218-
:param cpymad_instance: an instanciated `cpymad.MadX` object.
218+
:param cpymad_instance: an instanciated `cpymad.madx.Madx` object.
219219
:param v_qx: values of the horizontal tune Qx. Can be only one value.
220220
:param vxgood:
221221
:param v_qy: values of the vertical tune Qy. Can be only one value.

pyhdtoolkit/studies/triplet_errors/algo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class GridCompute:
2828
"""
2929
Algorithm as a class to run the simulations and analyze the outputs.
3030
31-
Will prompt error values for confirmation, run MAD-X simulations through a `Cpymad.Madx` object, get beta-beating
32-
values from the outputs and return the appropriate structures.
31+
Will prompt error values for confirmation, run MAD-X simulations through a `cpymad.madx.Madx` object,
32+
get beta-beating values from the outputs and return the appropriate structures.
3333
"""
3434

3535
def __init__(self):

0 commit comments

Comments
 (0)