Skip to content

Commit bec8b48

Browse files
authored
Maintenance, drop 3.9 (#38)
1 parent d322e14 commit bec8b48

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# optics_functions Changelog
22

3+
## Version 0.1.5
4+
5+
- Dropped support for `Python 3.9`.
6+
37
## Version 0.1.4
48

59
- Fixed invalid escape sequences in docstrings that would warn in all calling code.

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# optics_functions
22

3-
[![Cron Testing](https://github.com/pylhc/optics_functions/workflows/Cron%20Testing/badge.svg)](https://github.com/pylhc/optics_functions/actions?query=workflow%3A%22Cron+Testing%22)
4-
[![Code Climate coverage](https://img.shields.io/codeclimate/coverage/pylhc/optics_functions.svg?style=popout)](https://codeclimate.com/github/pylhc/optics_functions)
5-
[![Code Climate maintainability (percentage)](https://img.shields.io/codeclimate/maintainability-percentage/pylhc/optics_functions.svg?style=popout)](https://codeclimate.com/github/pylhc/optics_functions)
3+
[![Tests](https://github.com/pylhc/optics_functions/actions/workflows/coverage.yml/badge.svg?branch=master)](https://github.com/pylhc/optics_functions/actions/workflows/coverage.yml)
64
[![GitHub last commit](https://img.shields.io/github/last-commit/pylhc/optics_functions.svg?style=popout)](https://github.com/pylhc/optics_functions)
7-
<!-- [![GitHub release](https://img.shields.io/github/release/pylhc/optics_functions.svg?style=popout)](https://github.com/pylhc/optics_functions) -->
85
[![PyPI Version](https://img.shields.io/pypi/v/optics_functions?label=PyPI&logo=pypi)](https://pypi.org/project/optics_functions/)
96
[![GitHub release](https://img.shields.io/github/v/release/pylhc/optics_functions?logo=github)](https://github.com/pylhc/optics_functions/)
107
[![Conda-forge Version](https://img.shields.io/conda/vn/conda-forge/optics_functions?color=orange&logo=anaconda)](https://anaconda.org/conda-forge/optics_functions)
@@ -18,11 +15,13 @@ See the [API documentation](https://pylhc.github.io/optics_functions/) for detai
1815
## Installing
1916

2017
Installation is easily done via `pip`:
18+
2119
```bash
2220
python -m pip install optics_functions
2321
```
2422

2523
One can also install in a `conda` environment via the `conda-forge` channel with:
24+
2625
```bash
2726
conda install -c conda-forge optics_functions
2827
```
@@ -32,7 +31,7 @@ conda install -c conda-forge optics_functions
3231
> **Warning:** In certain scenarios, e.g. in case of non-zero closed orbit, the `RDT` calculations can be unreliable for **thick** lattices.
3332
> Convert to a _thin_ lattice by slicing the lattice to reduce the error of the analytical approximation.
3433
35-
#### Coupling Example:
34+
### Coupling Example
3635

3736
```python
3837
import logging
@@ -52,7 +51,7 @@ df_twiss = tfs.read("twiss.tfs", index="NAME")
5251
df_coupling = coupling_via_cmatrix(df_twiss)
5352

5453
# Example:
55-
# print(df_coupling)
54+
# print(df_coupling)
5655
#
5756
# F1001 F1010 ... C22 GAMMA
5857
# NAME ...
@@ -75,7 +74,7 @@ df_dqmin = closest_tune_approach(
7574
)
7675

7776
# Example:
78-
# print(df_dqmin)
77+
# print(df_dqmin)
7978
#
8079
# DELTAQMIN
8180
# NAME
@@ -95,7 +94,7 @@ df_dqmin = closest_tune_approach(
9594
# (...)
9695

9796
# write out
98-
# as the writer can only handle real data,
97+
# as the writer can only handle real data,
9998
# you need to split the rdts into real and imaginary parts before writing
10099
tfs.write(
101100
"coupling.tfs",
@@ -104,7 +103,7 @@ tfs.write(
104103
)
105104
```
106105

107-
#### RDT Example:
106+
### RDT Example
108107

109108
```python
110109
import logging
@@ -123,7 +122,7 @@ df_twiss = tfs.read("twiss.tfs", index="NAME")
123122
# generate all valid RDT names, here for RDTs of order 2
124123
rdts = [jklm2str(*jklm) for jklm in generator(orders=[2])[2]]
125124

126-
# check correct signs (i.e if beam==4), merge twiss and errors,
125+
# check correct signs (i.e if beam==4), merge twiss and errors,
127126
# add empty K(S)L columns if needed
128127
df_twiss = prepare_twiss_dataframe(df_twiss=df_twiss, df_errors=None, max_order=5)
129128

@@ -136,8 +135,8 @@ df_rdts = calculate_rdts(
136135
complex_columns=True, # complex output
137136
)
138137

139-
# Example:
140-
# print(df_rdts)
138+
# Example:
139+
# print(df_rdts)
141140
# F0002 ... F2000
142141
# NAME ...
143142
# IP3 2.673376-1.045712j ... -2.863617-0.789910j
@@ -156,7 +155,7 @@ df_rdts = calculate_rdts(
156155
# (...)
157156

158157
# write out
159-
# as the writer can only handle real data, either set real = True above
158+
# as the writer can only handle real data, either set real = True above
160159
# or split the rdts into real and imaginary parts before writing
161160
tfs.write(
162161
"rdts.tfs",
@@ -165,7 +164,7 @@ tfs.write(
165164
)
166165
```
167166

168-
#### Appending Example:
167+
### Appending Example
169168

170169
```python
171170
import logging
@@ -187,7 +186,7 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
187186

188187
# Example:
189188
# print(df_twiss)
190-
#
189+
#
191190
# Headers:
192191
# NAME: TWISS
193192
# TYPE: TWISS
@@ -196,7 +195,7 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
196195
# ORIGIN: 5.05.02 Linux 64
197196
# DATE: 01/02/21
198197
# TIME: 19.58.08
199-
#
198+
#
200199
# KEYWORD S ... F1001 F1010
201200
# NAME ...
202201
# IP3 MARKER 0.0000 ... -0.000000+0.000004j -0.004026+0.003574j
@@ -211,14 +210,15 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
211210
# BPMW.4L3.B1 MONITOR 26636.4387 ... -0.000000+0.000004j -0.004831+0.002376j
212211
# MCBWH.4L3.B1 HKICKER 26641.0332 ... -0.000000+0.000004j -0.004691+0.002641j
213212
```
214-
### Modules
213+
214+
## Modules
215215

216216
- `coupling` - Functions to estimate coupling from twiss dataframes and
217217
different methods to calculate the closest tune approach from
218218
the calculated coupling RDTs.
219219
([**coupling.py**](optics_functions/coupling.py), [**doc**](https://pylhc.github.io/optics_functions/modules/coupling.html))
220220
- `rdt` - Functions for the calculations of Resonance Driving Terms, as well as
221-
getting lists of valid driving term indices for certain orders.
221+
getting lists of valid driving term indices for certain orders.
222222
([**rdt.py**](optics_functions/rdt.py), [**doc**](https://pylhc.github.io/optics_functions/modules/rdt.html))
223223
- `utils` - Helper functions to prepare the twiss dataframes for use with the optics
224224
functions as well as reusable utilities,

optics_functions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__title__ = "optics_functions"
66
__description__ = "Calculate optics parameters from TWISS outputs."
77
__url__ = "https://github.com/pylhc/optics_functions"
8-
__version__ = "0.1.4"
8+
__version__ = "0.1.5"
99
__author__ = "pylhc"
1010
__author_email__ = "[email protected]"
1111
__license__ = "MIT"

pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ authors = [
2424
]
2525
license = "MIT"
2626
dynamic = ["version"]
27-
requires-python = ">=3.9"
27+
requires-python = ">=3.10"
2828

2929
classifiers = [
3030
"Development Status :: 5 - Production/Stable",
@@ -33,10 +33,11 @@ classifiers = [
3333
"Natural Language :: English",
3434
"Operating System :: OS Independent",
3535
"Programming Language :: Python :: 3 :: Only",
36-
"Programming Language :: Python :: 3.9",
3736
"Programming Language :: Python :: 3.10",
3837
"Programming Language :: Python :: 3.11",
3938
"Programming Language :: Python :: 3.12",
39+
"Programming Language :: Python :: 3.13",
40+
"Programming Language :: Python :: 3.14",
4041
"Programming Language :: Python :: Implementation :: CPython",
4142
"Topic :: Scientific/Engineering",
4243
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -77,10 +78,23 @@ markers = [
7778
"basic: basic tests run for every commit",
7879
"extended: test run on PRs",
7980
]
81+
82+
addopts = [
83+
"--import-mode=importlib",
84+
]
85+
8086
# Helpful for pytest-debugging (leave commented out on commit):
8187
# log_cli=true
8288
# log_level=DEBUG
8389

90+
[tool.coverage.run]
91+
relative_files = true
92+
93+
[tool.coverage.report]
94+
exclude_also = [
95+
"if TYPE_CHECKING:", # do not count if TYPE_CHECKING block imports (ignored at runtime) for coverage
96+
"except ImportError:", # do not count missing optional dependencies set to None, we monkeypatch and test that
97+
]
8498

8599
# ----- Dev Tools Configuration ----- #
86100

tests/unit/test_coupling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pytest
66
import tfs
77
from pandas.testing import assert_frame_equal
8-
from test_rdt import arrays_are_close_almost_everywhere
98

109
from optics_functions.constants import (
1110
ALPHA,
@@ -32,6 +31,8 @@
3231
)
3332
from optics_functions.utils import prepare_twiss_dataframe
3433

34+
from .test_rdt import arrays_are_close_almost_everywhere
35+
3536
INPUT = Path(__file__).parent.parent / "inputs"
3637
COUPLING_BUMP_INPUTS = INPUT / "coupling_bump"
3738
COUPLING_BUMP_TWISS_BEAM_1 = COUPLING_BUMP_INPUTS / "twiss.lhc.b1.coupling_bump.tfs"

0 commit comments

Comments
 (0)