-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from xsuite/refactor/xwakes
refactor to make xwakes comply with the xsuite standards
- Loading branch information
Showing
41 changed files
with
3,838 additions
and
3,736 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,31 @@ | ||
# PyWIT | ||
####Python Wake and Impedance Toolbox | ||
|
||
## Installation | ||
**NB:** Though most of this PyWIT's functionality is available independently of any non-dependency package, | ||
the installation of IW2D (https://gitlab.cern.ch/IRIS/IW2D) is *strongly recommended* in order to have full access to | ||
all of the features of PyWIT. For this reason, this installation guide will include the installation process required by | ||
IW2D. If you already have IW2D downloaded and installed on your system, you can skip directly to step 3. Please note that IW2D (at the time of writing) is only available on Linux systems. | ||
|
||
1. Download the IW2D repository to your system by cloning the git repository. This can be done by executing the command | ||
|
||
`git clone https://gitlab.cern.ch/IRIS/IW2D` | ||
|
||
in a suitable directory. You may be prompted to enter your CERN log-in credentials for this step. | ||
|
||
|
||
2. Perform the installation procedure for IW2D. This is explained in detail in the `README.md` file in the IW2D repository, but is summarized here: | ||
1. Install the prerequisite libraries "MPFR" and "GSL" by running: | ||
`sudo apt-get install libgsl-dev libmpfr-dev` | ||
or alternatively, if you have anaconda/miniconda installed: | ||
`conda install -c conda-forge gsl mpfr` | ||
2. Compile the C++ code by running: | ||
``` | ||
cd IW2D/cpp | ||
cp ./Makefile_system_GMP_MPFR Makefile | ||
make | ||
``` | ||
# Xwakes | ||
|
||
Python package for wakes and impedances handling. | ||
|
||
3. In a new directory, where you want your PyWIT directory to be placed, Download the PyWIT repository to your system by | ||
cloning the git repository. This can be done by executing the command | ||
`git clone https://gitlab.cern.ch/IRIS/pywit`. | ||
You may be prompted to enter your CERN log-in credentials for this step. | ||
## Installation | ||
|
||
4. Install PyWIT using pip by navigating to your pywit directory executing the command | ||
Under a conda environment with Python 3.8+ it is simply installed via PyPI by doing `pip install xwakes` | ||
|
||
`pip install .`. | ||
## IW2D coupling | ||
|
||
This section describes how to couple Xwakes to IW2D using the executables obtained compiling the C++ code. | ||
When the Python interface of IW2D will be completed this will not be needed anymore. | ||
|
||
5. Navigate to the directory `IW2D/IW2D/cpp` in the IW2D repository. Copy the following four | ||
files from this folder: | ||
To begin with, some folders need to be created in the user's home directory. | ||
This can be automatically done by running the following command after Xwakes is installed: | ||
``` | ||
python -c 'import xwakes; xwakes.initialize_pywit_directory()' | ||
``` | ||
The IW2D executable are produced by following the [IW2D readme]([https://gitlab.cern.ch/IRIS/IW2D/-/tree/master?ref_type=heads)](https://gitlab.cern.ch/IRIS/IW2D/). | ||
After this procedure is completed the following executable files will be created in `/path/to/iw2d/IW2D/cpp/`: | ||
* `flatchamber.x` | ||
* `roundchamber.x` | ||
* `wake_flatchamber.x` | ||
* `wake_roundchamber.x` | ||
6. In your home directory, there will have appeared a new directory called 'pywit'. Navigate into this folder, then | ||
into 'IW2D', then into 'bin'. Paste the four files copied in step 5 into this folder. | ||
|
||
These files have to be copied in the newly created folder with the command | ||
|
||
You should now be able to use PyWIT with your Python system interpreter. | ||
``` | ||
cp /path/to/iw2d/IW2D/cpp/*.x ~/pywit/IW2D/bin | ||
``` | ||
Now Xwakes can be used to launch IW2D calculations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from xwakes.wit import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
''' | ||
generate files to mirror in pywit the modules from xwakes.wit | ||
''' | ||
|
||
import os | ||
|
||
fff = os.listdir('../xwakes/wit') | ||
|
||
for nn in fff: | ||
if not nn.endswith('.py') or nn.startswith('_'): | ||
continue | ||
|
||
with open(nn, 'w') as fid: | ||
fid.write(f'from xwakes.wit.{nn.split(".py")[0]} import *\n') |
Oops, something went wrong.