Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/xwakes #8

Merged
merged 30 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
779daeb
Remove dependency on sortednp
giadarol Jun 20, 2024
9fb2fed
Avoid warning
giadarol Jun 20, 2024
163997c
typo
giadarol Jun 20, 2024
18ddcad
Change version number
giadarol Jun 20, 2024
6e2724f
Restructure package
giadarol Jun 20, 2024
234f760
Clean up
giadarol Jun 20, 2024
548b487
Add data file to MANIFEST.in
giadarol Jun 20, 2024
d874b2c
Change version number
giadarol Jun 20, 2024
5494b7c
Add missing files
giadarol Jun 20, 2024
caa13a5
Change version number
giadarol Jun 20, 2024
a3ffe66
Display version
giadarol Jun 20, 2024
e82db1c
Add init_pywit_directory.py
giadarol Jun 20, 2024
92d4dad
Function
giadarol Jun 20, 2024
52cbdda
Make matplotlib optional
giadarol Jun 20, 2024
af6c40a
Generalize path handling
giadarol Jun 20, 2024
648f02c
Adapt tests
giadarol Jun 20, 2024
10bb5f0
trapz -> trapezoid in numpy 2
giadarol Jun 20, 2024
bdcd79b
Add CI workflow
giadarol Jun 20, 2024
7d9a601
Add scipy dependency
giadarol Jun 20, 2024
7c6cb06
Merge branch 'refactor/xwakes' of github.com:xsuite/xwakes into refac…
lgiacome Jun 20, 2024
e072fdc
Update README.md
lgiacome Jun 20, 2024
4debc10
Merge pull request #7 from xsuite/refactor/improve-readme
giadarol Jun 20, 2024
270e97c
Merge branch 'refactor/xwakes' of github.com:xsuite/xwakes into refac…
lgiacome Jun 21, 2024
06e8e15
Correcting typo in README
nmounet Jun 21, 2024
122ba39
Improving (speed-up) mix_fine_and_rough_sampling implementatoin in co…
nmounet Jun 21, 2024
8ad5034
Merge branch 'refactor/xwakes' of github.com:xsuite/xwakes into refac…
lgiacome Jun 21, 2024
cd0e102
add a useful comment
lgiacome Jun 21, 2024
07ff0b5
add tests for mix_fine_and_rough_sampling
lgiacome Jun 21, 2024
a4344d1
switch to skipif
lgiacome Jun 21, 2024
8b447cf
Rename and comment
giadarol Jun 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions LICENSE.txt

This file was deleted.

3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ include *.md

# Include the license file
include LICENSE

# Include the data files
include xwakes/wit/materials.json
62 changes: 19 additions & 43 deletions README.md
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.
1 change: 1 addition & 0 deletions pywit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from xwakes.wit import *
14 changes: 14 additions & 0 deletions pywit/_generate_modules.py
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')
Loading
Loading