Skip to main content

(

Project description

TFS-Pandas

Cron Testing Code Climate coverage Code Climate maintainability (percentage) GitHub last commit GitHub release

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. Files are read into a custom-made TbtData dataclass encompassing the relevant information.

Installing

Installation is easily done via pip:

pip install 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, measurement date, 
# number of turns, bunches and IDs of the recorded bunches
first_bunch_transverse_positions: tbt.TransverseData = data.matrices[0]
measurement_date = data.date  # a datetime.datetime object

# 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)

See the API documentation for details.

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-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

turn_by_turn-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file turn-by-turn-0.1.0.tar.gz.

File metadata

  • Download URL: turn-by-turn-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for turn-by-turn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f321f0dd1d67abeec3f25fb6e8537748b264d88861de58b6149af3cfa4082345
MD5 627fc813cc2dd246abfc74a9f35a30c8
BLAKE2b-256 8a094e6e4b526512f7b64401ecac41e87f78505a2b574d9e4ad70ca0711a9106

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turn_by_turn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for turn_by_turn-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 718ca9cdb1e80f5093325f332ff401f62ec421e572c92db008e75e34539f5fff
MD5 a1b05fed17abec9547a68b2415a89847
BLAKE2b-256 672bbdeebe1f96d7911dd80c9cce1e0e24c4ab04d60f85bf1c18ebf1d0eaa188

See more details on using hashes here.

Supported by

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