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.1.tar.gz (23.6 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.1-cp312-abi3-win_amd64.whl (162.6 kB view details)

Uploaded CPython 3.12+Windows x86-64

chopcal-0.5.1-cp312-abi3-win32.whl (147.2 kB view details)

Uploaded CPython 3.12+Windows x86

chopcal-0.5.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (164.1 kB view details)

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

chopcal-0.5.1-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (174.7 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ i686

chopcal-0.5.1-cp312-abi3-macosx_11_0_arm64.whl (106.3 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

chopcal-0.5.1-cp312-abi3-macosx_10_9_x86_64.whl (131.5 kB view details)

Uploaded CPython 3.12+macOS 10.9+ x86-64

chopcal-0.5.1-cp311-cp311-win_amd64.whl (163.8 kB view details)

Uploaded CPython 3.11Windows x86-64

chopcal-0.5.1-cp311-cp311-win32.whl (149.0 kB view details)

Uploaded CPython 3.11Windows x86

chopcal-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (170.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

chopcal-0.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (181.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

chopcal-0.5.1-cp311-cp311-macosx_11_0_arm64.whl (110.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

chopcal-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl (133.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: chopcal-0.5.1.tar.gz
  • Upload date:
  • Size: 23.6 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.1.tar.gz
Algorithm Hash digest
SHA256 98a3031e008d439a05edaee43cf2138926d774e403061df73236f3d133d8f100
MD5 d1a86cbb823e833b5a1c94fb7494618b
BLAKE2b-256 c040a763ae6579b2508d120d93e2d8c2009a70c0ff2e084c3defb93cf0d66a98

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1.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.1-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: chopcal-0.5.1-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 162.6 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.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 140cd999ebf7dcc700d7aff8be44c104d9149b6fde112a880a6e8d0b8cc17bd0
MD5 32ccbcf83cc0e7f0587ac9bb95bee78e
BLAKE2b-256 5ad8cfa67dfe4c6e6255fc4c4da13fbe76e2d79927bc7714a21e1ed29909eb57

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp312-abi3-win32.whl.

File metadata

  • Download URL: chopcal-0.5.1-cp312-abi3-win32.whl
  • Upload date:
  • Size: 147.2 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.1-cp312-abi3-win32.whl
Algorithm Hash digest
SHA256 03d34589eafc3c2a0de8b0cf2f63855e27b61cbb37d65e717c2d84bb3e052218
MD5 c2ba5f44c3e1a652ba197625176d22a6
BLAKE2b-256 1130cd88250a38021ef648bf53c84e3241d782df2d5f6ee6003d187b37b24b4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2f178b7e702bd448c1e6a9c0a5d698d1ad477fcef560849580038955555f7ff
MD5 5fcc2e9281129dd8870fb256bf911c18
BLAKE2b-256 8c413abf7aec2818aded440dd3308a401f4ec3a1a17313b68a8072bce8af63f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 afc669f18f1abb369e0cf26daa6014fc1c4620222763b76dfae9fb9c749e7c3e
MD5 bb4c4b582773bbf433882db555ecf9a2
BLAKE2b-256 8413c95e3f4dc827495d151b546aba8c14e2e90663d33980d08eccb70fca03df

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80a2c9125e7d36b04bd056a0d0e48d2d21726d2a355981f614ec23f4eedd775d
MD5 7e495a265214e3aa46743d89b066d027
BLAKE2b-256 9dd23f2e62266dd72231c22f744d27359b351f06e3294b28e6f69353081a5d16

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp312-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp312-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 967d8555cf90dd915ab947d98e0b7adb64e4bd1c2dc78e97c4320c4c23b573c1
MD5 1fd09fbfe417ef291d044331e5b4d970
BLAKE2b-256 edf3a267120b733a3aa7d214e2e09a5f8c9a606ab0103bfade1b4099475ec6ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: chopcal-0.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 163.8 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0e514843866347de1edd99ebab576d2974ff9b44378da78b96f92b75f35cce44
MD5 e2aec15c81eec4bd6f64dc3561843e57
BLAKE2b-256 bc2a5fbe7c172ddbaa23fdcab708723682a128203c1c89d66d66a3b69278362a

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: chopcal-0.5.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 149.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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d868e1faaa7ad7a89b66149e11db291e43415205484b42a081a1627b7bc845c3
MD5 0aaa8eec80ac3172ce368e69a6a73bae
BLAKE2b-256 3ef6f16272da9de8888408e89e14e9315d17f3773d37b1a8424d5cce92e68ca8

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa522b97e50b9585b2e3199f6297c88cacd18a5d86116f1a9c79e969b487f76a
MD5 6fa614994690fa1ba94e16e1c8d36f7a
BLAKE2b-256 9121569b98629c4d823bb9834aaf8ac7882e7bf82d4f9f3dc4699b28947e25e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c06da4ddce744e51d54da6e2c64e07bb6786d6bf935b7c1d5737d77385de41c1
MD5 142627ea7a69b7fba3112cebf3b92213
BLAKE2b-256 db6b627b6e38157f4272ce64852e1cd54ba3ed919aa08ad64f6fac106ed12b05

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b58111175bdb9942b319b792e20ab674ae5fe91cd834af29c61c347cccf81550
MD5 04b35882530bb9ff1dbce58cf8762293
BLAKE2b-256 248343ec0d88681f38409f4a79b7c9f6b0b79fcc8b9c06995046c64f44864407

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chopcal-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 239798499366d365833654bc7a121bc928d44f9a3023ba5684930ce8b588400f
MD5 c8772ba11081d9a0204deb16bcb8aae9
BLAKE2b-256 afd8ccc3d01e3907bab62389990dd3dcd98fb9e9c48078503e4a1aa511a6c8ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for chopcal-0.5.1-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

This release

0.5.1 This release

13 files

0.5.0

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