Skip to main content

Chopcal

Description

Exposes chopper calculations to Python which were otherwise hidden in McStas instruments.

Supported components

source name component type
Instr BIFROST chopcal.bifrost function
a set of choppers, printed as a table chopcal.lib.ChopperSet class
runtime library chopper-lib chopcal.lib submodule
chopper parameters chopcal.lib.Chopper class
transmitted inverse-velocity phase space chopcal.lib.inverse_velocity_windows function
transmitted inverse-velocity extrema chopcal.lib.inverse_velocity_limits function
transmitted wavelength extrema chopcal.lib.wavelength_limits function

Placing the band

BIFROST passes a fixed bandwidth of about 1.77 Å, so one number decides where that band sits. Give it as either the longest wavelength or the lowest energy you want to reach the sample — the band runs from there to about 1.77 Å shorter.

>>> import chopcal
>>> chopcal.bifrost(wavelength_max=3.0)
name  speed [Hz]  delay [ms]  opening [deg]  open [ms]  path [m]
 ps1         196     3.87771            170      2.409     6.342
 ps2         196       6.087            170      2.409     6.362
 fo1          14     6.13892          38.26      7.591      8.53
 fo2          14     9.54467          52.01      10.32    14.973
 bw1          14     42.8605            161      31.94        78
 bw2         -14     42.8605            161      31.94     78.02
>>> chopcal.lib.wavelength_limits(list(chopcal.bifrost(wavelength_max=3.0).values()))
(1, (1.2115739130694068, 2.9831347854552717))

Mind the sense of it: the number you give is the slow end of the band. Asking for energy_min=7 does not cap the incident energy at 7 meV — it puts 7 meV at the bottom and lets everything faster through, up to about 31 meV.

The choppers come back by name in beam order, each with a speed in Hz, a delay in seconds, an opening angle in degrees and a flight path in metres. delay is when an opening is centred on the beam, so a chopper passes neutrons for angle/360/|speed| seconds around it and again every 1/speed after that.

Installation

pip install chopcal

Or, from the source repository to get the latest development version

pip install git+https://github.com/g5t/chopper-calculations.git

Describing a chopper

A Chopper is speed, delay, angle and path: how fast the disk turns in Hz, when one of its openings is on the beam in seconds, how wide that opening is in degrees, and how far the disk sits from the source in metres.

delay is a time, so it means the same thing at any speed and in either direction of rotation — which is how a real chopper is set, and what McStas' DiskChopper acts on. It replaces the phase in degrees that chopper-lib took before its version 2.0.0, and which it converted to a delay at every point of use anyway.

Developing

The build fetches chopper-lib from GitHub. To build against a local checkout instead — which you need when changing both together — point FetchContent at it:

pip install --no-build-isolation -ve . \
  -Ccmake.define.FETCHCONTENT_SOURCE_DIR_CHOPPER_LIB=/path/to/mcstas-chopper-lib
pytest test

Nothing else changes: the same sources are compiled into the extension modules, so a modification to chopper-lib.c shows up in chopcal on the next build. chopper-lib carries a CHOPPER_LIB_VERSION macro and src/choppers.cpp asserts on it, so building against a version that means something else by a chopper's fields fails rather than returning different numbers.

Download files

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

Source Distribution

chopcal-0.5.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distributions

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

chopcal-0.5.0-cp312-abi3-win_amd64.whl (98.0 kB view details)

Uploaded CPython 3.12+Windows x86-64

chopcal-0.5.0-cp312-abi3-win32.whl (87.3 kB view details)

Uploaded CPython 3.12+Windows x86

chopcal-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (153.3 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

chopcal-0.5.0-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (161.1 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ i686

chopcal-0.5.0-cp312-abi3-macosx_11_0_arm64.whl (97.4 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

chopcal-0.5.0-cp312-abi3-macosx_10_9_x86_64.whl (114.1 kB view details)

Uploaded CPython 3.12+macOS 10.9+ x86-64

chopcal-0.5.0-cp311-cp311-win_amd64.whl (101.3 kB view details)

Uploaded CPython 3.11Windows x86-64

chopcal-0.5.0-cp311-cp311-win32.whl (91.0 kB view details)

Uploaded CPython 3.11Windows x86

chopcal-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (159.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

chopcal-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (168.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

chopcal-0.5.0-cp311-cp311-macosx_11_0_arm64.whl (101.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

chopcal-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl (117.7 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file chopcal-0.5.0.tar.gz.

File metadata

  • Download URL: chopcal-0.5.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chopcal-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2d5121ead3384da9b5292f7a9309eb5061e257cbc170370271a755ea0d4c92c0
MD5 49afbdc222b9e748178755cc60dfbbd7
BLAKE2b-256 0fee4b6110fe192a5f177a2e9a9de8bbe61bb94c92a49505f7acf8acc0094930

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0.tar.gz:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: chopcal-0.5.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 98.0 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3a8065d373993d694efd479828fd47dd8f5c3d6d99f1673d8ace6d426c8d3d76
MD5 4e3d3e58b132814605dcfae693811094
BLAKE2b-256 5167cd4d026d1ee89ad9445fc07d2fee542e717dd3b1b8a013a9ca34e3741996

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-win_amd64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-win32.whl.

File metadata

  • Download URL: chopcal-0.5.0-cp312-abi3-win32.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: CPython 3.12+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-win32.whl
Algorithm Hash digest
SHA256 021217ded19f0dd667be57058a57db0647e3baaea7926f56b158146f8836a3ca
MD5 0a987e0c5f17a094dbbbebebe3e534e0
BLAKE2b-256 85c99a0e31feff2514ed9732a7c29ba7c7a79ac3107000b78b36dada9614799b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-win32.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8982890c3ffa1318e921692b0fc4c22db6e2281409ee7039d7c554833d55e184
MD5 fbd522d9d683927ffda9ece25b1e0f32
BLAKE2b-256 8d31264c764269f4f916bc9a686a0bc64f852ecf6b35b8ab15f4183342d761aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3d74881546ee494b4cb475513cf594d772380aafd4ffe6267545f44d95dffd49
MD5 29aab21b14f5793223cb2869217846b7
BLAKE2b-256 c1576d80727f20179b026da26bbf5a7d92336ff08bd8fc7117b757fa4896ca1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 067b5e548e24d52777eed86d2a0ce1b04e4e3f881bb14c861a14badf1a43e45c
MD5 63d40d747f2e3d303d1fe8172ec0cc9a
BLAKE2b-256 fa1924bb48564eaac98921a972556e95e227eeb0707f2cdfed2834d9a287c302

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp312-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp312-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a23b45d62670e529caff1faf7f97967ca8c7aeab989b9423c580c1c0fe18ef2e
MD5 4b218721e2faccf2256791b2217ea841
BLAKE2b-256 cc222ca719d62c65bd51be0e890df2563ca5eb9aa6e547f4906b638f17e24ccd

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp312-abi3-macosx_10_9_x86_64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: chopcal-0.5.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 101.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb0c7306b54565cab6c899434a2296baacac2555971906f2c58d031d16965cd6
MD5 871d41fda8b4009bdbdcdf7ae6f548a3
BLAKE2b-256 ffe43010aeb23c99244f3be7ff3f7081b7157fa33ed47a8a8edefbadf0440ff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: chopcal-0.5.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 e69ddf2663d5809827bb756eda573ef353b5c890a1e71136cbd90a4c405ffe6d
MD5 393d4af8d59c683f765325aebc182625
BLAKE2b-256 5f74241db2b283cf9357f95d35991bc054f087312611e27ffb23c4df4fdf614e

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-win32.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 482fc4850fa07feb0e7259e280dd6ef7eb1c7c0e5d2c026a927f9cd85d435484
MD5 360e918478364c0789e9a781ad7a86a7
BLAKE2b-256 1aba29c3a99cc6ad69270680c0ef1fd27139ebfd4d44d30a7138b4f30303ca0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 18afbd1eb274f0e6658addb5d6c90ea07648f4c84e666ad6d7ec35c402fc6055
MD5 9172df7cfa49c1ea24ad57325089c97f
BLAKE2b-256 60584d152bf753705aac70b1ec526ab71a5b805da188c581be0f0a183d94a4b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8206af23b18019ef342cca7f374a1858928204ef1b9cbd125cc24b4a733b06d
MD5 0dc14164d55e56c87f75c9da569499a8
BLAKE2b-256 f62384fa03329f8191e88211867864da6827e52e55e53dcdf895851faf6a392b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chopcal-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 298474b63263067fc1766f3bea9edb6e1b7475b3f01a076b679afba8b089c83f
MD5 13e117289162e34de71f10cdaf38346b
BLAKE2b-256 468de8fefb1c58ffa65c40ad5f0d79f8191bff27fcdeab724cc1db9bd93ff55b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: wheels.yml on g5t/chopper-calculations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.1

13 files

This release

0.5.0 This release

13 files

0.4.0

43 files

0.3.1

53 files

0.3.0

1 file

0.2.1

49 files

0.2.0

49 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