Skip to main content

Read and write turn-by-turn measurement files from different particle accelerator formats.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turn_by_turn-1.4.0.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turn_by_turn-1.4.0-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

File details

Details for the file turn_by_turn-1.4.0.tar.gz.

File metadata

  • Download URL: turn_by_turn-1.4.0.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for turn_by_turn-1.4.0.tar.gz
Algorithm Hash digest
SHA256 60a6b1579050e60c4398b46fb318ffbadc08046b832f73fa1636d602527cf5fb
MD5 ea5a0abcaa77af67c307247dc02ddc1a
BLAKE2b-256 eab1846929da1b288bb82f21b0c2821a2276416e8a7a189ec96035b5473be8cc

See more details on using hashes here.

File details

Details for the file turn_by_turn-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: turn_by_turn-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 41.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for turn_by_turn-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c8a0d9e1e0a534cf7874ee71eb0cf5b6628a5a743d3f0b205f50a30825ceba
MD5 7c0b36fda2ba3f40f6b3ff73773658cb
BLAKE2b-256 feabdd3730fe9e0ce7d58f3cc95db427fb20544abdf313017f9ccff8fce86d32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page