Skip to main content

Turn-By-Turn

Cron Testing Coverage PyPI Version GitHub release Conda-forge Version DOI

This package provides reading functionality for turn-by-turn BPM measurements data from different particle accelerators. It also provides writing functionality in the LHC's own SDDS format, through our sdds package. Supported accelerators include: LHC, SPS, PSB, IOTA, SuperKEKB, and others. PSB support is currently read-only and may change during LS3. Files are read into a custom-made TbtData dataclass encompassing the relevant information.

See the API documentation for details.

Installing

Installation is easily done via pip:

python -m pip install turn_by_turn

One can also install in a conda environment via the conda-forge channel with:

conda install -c conda-forge turn_by_turn

Example Usage

The package is imported as turn_by_turn, and exports top-level functions for reading and writing:

import turn_by_turn as tbt

# Loading a file is simple and returns a custom dataclass named TbtData
data: tbt.TbtData = tbt.read("Beam2@BunchTurn@2018_12_02@20_08_49_739.sdds", datatype="lhc")

# Easily access relevant information from the loaded data: transverse data,
# number of turns, bunches and IDs of the recorded bunches
first_bunch_transverse_positions: tbt.TransverseData = data.matrices[0]

# Transverse positions are recorded as pandas DataFrames
first_bunch_x = first_bunch_transverse_positions.X.copy()
first_bunch_y = first_bunch_transverse_positions.Y.copy()

# Do any operations with these as you usually do with pandas
first_bunch_mean_x = first_bunch_x.mean()

# Average over all bunches/particles at all used BPMs from the measurement
averaged_tbt: tbt.TbtData = tbt.utils.generate_average_tbtdata(data)

# Writing out to disk (in the LHC's SDDS format) is simple too, potentially with added noise
tbt.write("path_to_output.sdds", averaged_tbt, noise=1e-5)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for turn_by_turn 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for turn_by_turn 1.5.0
File Size Uploaded
turn_by_turn-1.5.0.tar.gz 35.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for turn_by_turn 1.5.0
File Interpreter ABI Platform
turn_by_turn-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 77.3 kB

Release files / turn_by_turn-1.5.0.tar.gz

Download URL turn_by_turn-1.5.0.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82f93bb1c95f393a845a099cb7575abd809b11cc76f64b1025c01b5e8428dc07
BLAKE2b-256 checksum
How to use checksums
d154cb1a950860df76932d466ed8c729f8684a9f34a1cf670b5491547be62efa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / turn_by_turn-1.5.0-py3-none-any.whl

Download URL turn_by_turn-1.5.0-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8daa3a1774bec92a054e9d9f43be7e8c41902db81eae8de88cfeaa97e08b6969
BLAKE2b-256 checksum
How to use checksums
63f8f9adedb30af95f020ec8ed8e1bfba0f0baaab23960c2f8e280a3c2be5a84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page