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 #1161 from rdemaria/release-fix
Release fixes for 5.09
- Loading branch information
Showing
21 changed files
with
17,634 additions
and
17,702 deletions.
There are no files selected for viewing
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,3 +1,3 @@ | ||
VERSION = 5.08.01 | ||
VERSION_NUM = 50801 | ||
VERSION_DATE = 2022.02.25 | ||
VERSION = 5.09.00 | ||
VERSION_NUM = 50900 | ||
VERSION_DATE = 2023.03.08 |
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
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,3 @@ | ||
from .madx import Madx | ||
|
||
print("Work in progress...") |
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,90 @@ | ||
import cpymad.madx | ||
import re | ||
import numpy as np | ||
import scipy.optimize | ||
from collections import ChainMap | ||
|
||
from .tablemixin import TableMixIn | ||
|
||
|
||
class Table(cpymad.madx.Table, TableMixIn): | ||
pass | ||
|
||
|
||
class TableMap(cpymad.madx.TableMap): | ||
def __getitem__(self, name): | ||
try: | ||
t = Table(name, self._libmadx) | ||
t.set_index("name") | ||
return t | ||
except ValueError: | ||
raise KeyError("Table not found {!r}".format(name)) from None | ||
|
||
|
||
class Madx(cpymad.madx.Madx): | ||
def __init__( | ||
self, | ||
libmadx=None, | ||
command_log=None, | ||
stdout=None, | ||
history=None, | ||
prompt=None, | ||
**Popen_args, | ||
): | ||
super().__init__(libmadx, command_log, stdout, history, prompt, **Popen_args) | ||
|
||
self.table = TableMap(self._libmadx) | ||
|
||
def track_single_4d(mad, coord=np.zeros(4)): | ||
mad.track(onepass=True) | ||
mad.start( | ||
x=coord[0], px=coord[1], y=coord[2], py=coord[3]) | ||
mad.run() | ||
mad.endtrack() | ||
t = mad.table["track.obs0001.p0001"] | ||
out = [t[n][-1] for n in ["x", "px", "y", "py"]] | ||
return np.array(out) | ||
|
||
def track_single_6d(mad, coord=np.zeros(6)): | ||
mad.track(onepass=True) | ||
mad.start( | ||
x=coord[0], px=coord[1], y=coord[2], py=coord[3], t=coord[4], pt=coord[5]) | ||
mad.run() | ||
mad.endtrack() | ||
t = mad.table["track.obs0001.p0001"] | ||
out = [t[n][-1] for n in ["x", "px", "y", "py", "t", "pt"]] | ||
return np.array(out) | ||
|
||
|
||
def find_closed_orbit_track_4d(mad, x0=None, xtol=1e-10,mode='4d'): | ||
def ftosolve(x): | ||
if abs(x).max()>1: | ||
raise ValueError(f"{x} too large") | ||
return mad.track_single(x) - x | ||
|
||
res = scipy.optimize.fsolve(ftosolve, x0) | ||
return res | ||
|
||
def track_single_6d(mad, coord): | ||
mad.track(onepass=True) | ||
mad.start( | ||
x=coord[0], px=coord[1], y=coord[2], py=coord[3], t=coord[4], pt=coord[5] | ||
) | ||
mad.run() | ||
mad.endtrack() | ||
t = mad.table["track.obs0001.p0001"] | ||
out = [t[n][-1] for n in ["x", "px", "y", "py", "t", "pt"]] | ||
return np.array(out) | ||
|
||
def find_closed_orbit_track_4d(mad, x0=np.zeros(6), xtol=1e-10): | ||
def ftosolve(x): | ||
if abs(x).max()>1: | ||
raise ValueError(f"{x} too large") | ||
return mad.track_single(x) - x | ||
|
||
res = scipy.optimize.fsolve(ftosolve, x0) | ||
return res | ||
|
||
def find_closed_orbit_twiss(mad): | ||
t = mad.twiss() | ||
return np.array([t[n][0] for n in ["x", "px", "y", "py", "t", "pt"]]) |
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,20 @@ | ||
#!/bin/bash | ||
set -euo pipefail; IFS=$'\n\t' | ||
|
||
NAME=$( python setup.py --name ) | ||
VER=$( python setup.py --version ) | ||
|
||
echo "========================================================================" | ||
echo "Tagging $NAME v$VER" | ||
echo "========================================================================" | ||
|
||
#git tag v$VER | ||
#git push origin v$VER | ||
|
||
echo "========================================================================" | ||
echo "Releasing $NAME v$VER on PyPI" | ||
echo "========================================================================" | ||
|
||
python setup.py sdist | ||
twine upload dist/* | ||
rm -r dist/ *.egg-info |
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,12 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name='madx', | ||
version='0.0.0', | ||
description='Methodical Accelerator Design MAD-X', | ||
author='CERN', | ||
author_email='riccardo.de.maria@cern.ch', | ||
url='https://github.com/MethodicalAcceleratorDesign/mad-x', | ||
packages=find_packages(), | ||
install_requires=['numpy','matplotlib','cpymad'], | ||
) |
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
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
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
Oops, something went wrong.