Skip to content

Commit

Permalink
quick documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoubelet committed Feb 19, 2021
1 parent 1ec6e88 commit 2a102c4
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ clean:

condaenv:
@echo "Creating $(D)PHD$(E) conda environment according to '$(C)environment.yml$(E)' file."
@conda env create -f environment.yml
@conda env create -f docker/environment.yml
@echo "Adding $(D)PHD$(E) environment to base ipython kernel."
@source activate PHD
@ipython kernel install --user --name=PHD
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 align="center">
<b>pyhdtoolkit</b>
<b>PyhDToolkit</b>
</h1>

<p align="center">
Expand Down
16 changes: 8 additions & 8 deletions docs/About_PyhDToolkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

## Purpose

This package is meant to be an all-in-one collection of utilities and scripts I use in my PhD work.
This package is an all-in-one collection of baseline utilities I use in my PhD work.
Most of the codes here have their use in my day-to-day work, but not necessarily in our team's softwares.

## Functionality

For now, `PyhDToolkit` provides some of the following features:

- Useful tools to integrate with [`cpymad`][cpymad], a Python bindings library for the [`MAD-X`][madx] code, including generators, matching routines and plotting utilities.
- A `cpymadtools` module with tools to integrate with [`cpymad`][cpymad], a Python bindings library for the [`MAD-X`][madx] code; including generators, matching routines, plotting utilities etc.
- A `maths` module to incorporate useful methods used in analysis.
- A `plotting` module for my favorite defaults and helpers.
- An `optics` module for particle accelerator physics related calculations and analysis.
- A `scripts` module to handle different simulations setups.
- A `plotting` module for my favorite defaults and helpers.
- A `tfstools` module similar to `cpymadtools`, with functionality revolving around handling `tfs` files and plotting their contents.
- A `utils` module for various utilities.
- A `utils` module for various Python and UNIX utilities.

## Roadmap

In addition to developping current modules, more will be added to better incorporate with the workhorse softwares of the OMC team, notably [`tfs-pandas`][tfs] and [`omc3`][omc3].
Foreseen development includes:

- Expansion of existing modules, particularly the `optics` module to include most simple calculations on beam properties.
- An `omcwrapper` module to handle different usecases of the `omc3` package.
- A `sixtracklibtools` module for utility functions surrounding the use of `sixtracklib`.
- Expansion of the `optics` module to include most simple calculations on beam properties.
- Expansion of the `cpymadtools` with utilities as their needs arise in my studies.
- A `sixtracklibtools` module for utility functions surrounding the use of [`sixtracklib`][sixtracklib], eventually.

[cpymad]: https://github.com/hibtc/cpymad
[madx]: https://mad.web.cern.ch/mad/
[omc3]: https://github.com/pylhc/omc3
[tfs]: https://github.com/pylhc/tfs
[sixtracklib]: https://github.com/SixTrack/sixtracklib
3 changes: 3 additions & 0 deletions docs/Getting_Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ You can now install this simply in a virtual environment with:

### With Docker

Docker provides an easy way to get access to a fully-fledged environment identical to the one I use, for reproducibility of my results.
You can directly pull a pre-built image from `Dockerhub` (with tag `latest` being an automated build) with:
```bash
> docker pull fsoubelet/simenv
Expand All @@ -51,6 +52,8 @@ Assuming you pulled the provided image from Dockerhub, run a jupyterlab server o
> docker run --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v <host_dir_to_mount>:/home/jovyan/work fsoubelet/simenv
```

Any jupyter notebook or Python files in the mounted directory can then be used / ran with an environment identical to mine.

[virtual_env_primer]: https://realpython.com/python-virtual-environments-a-primer/
[black_formatter]: https://github.com/psf/black
[Docker]: https://www.docker.com/
Expand Down
24 changes: 23 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyhdtoolkit/cpymadtools/optics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Module cpymadtools.optics
-------------------------
Created on 2020.02.19
:author: Felix Soubelet (felix.soubelet@cern.ch)
A module with functions to access `optics_functions` functionality directly onto `cpymad.madx.Madx` objects.
"""
from typing import Sequence

import tfs
import optics_functions

from cpymad.madx import Madx
from loguru import logger
6 changes: 3 additions & 3 deletions pyhdtoolkit/cpymadtools/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
A module with functions to perform MAD-X actions with a cpymad.madx.Madx object, that are very specific to
LHC and HLLHC use cases.
"""
from typing import Dict, List, Sequence, Tuple
from typing import List, Sequence, Tuple

import numpy as np
import tfs
Expand Down Expand Up @@ -262,8 +262,8 @@ def install_ac_dipole(

if not geometric_emit:
logger.debug(
f"No value provided for the geometric emittance used when creating the beam, the value will be "
f"queried from MAD-X's global 'geometric_emit'"
"No value provided for the geometric emittance used when creating the beam, the value will be "
"queried from MAD-X's global 'geometric_emit'"
)
geometric_emit = madx.globals["geometric_emit"]

Expand Down
2 changes: 1 addition & 1 deletion pyhdtoolkit/cpymadtools/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
A module with functions to manipulate MAD-X TRACK functionality through a cpymad.madx.Madx object.
"""
from typing import Dict, Tuple
from typing import Tuple

import pandas as pd

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tfs-pandas = "^2.0"
loguru = "^0"
numba = ">=0.51,<1.0"
cpymad = "^1.6"
optics-functions = "^0"

# Defining optional dependencies for extras
portray = { version = "^1.4", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cpymadtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import tfs

from cpymad.madx import Madx
from pandas import DataFrame
from pandas._testing import assert_dict_equal
from pandas.testing import assert_frame_equal
from pandas import DataFrame

from pyhdtoolkit.cpymadtools.constants import ( # coverage
CORRECTOR_LIMITS,
Expand Down

0 comments on commit 2a102c4

Please sign in to comment.