Skip to main content

Python bindings for the NEST noble element simulations

Project description

nestpy

Join the chat at https://gitter.im/NESTCollaboration/nestpy Build Status DOI PyPi version Project Status: Active – The project has reached a stable, usable state and is being actively developed. Python Versions PyPI downloads

Visit the tutorials directory for tutorials on the nestpy calls, maintenance, and benchmark plots.

These are the Python bindings for the NEST library, which provides a direct wrapping of functionality. The library is not Pythonic at this point but just uses the existing naming conventions from the C++ library.

You do not have to have NEST already installed to use this package.

Installing from PyPI

For 64-bit Linux or Mac systems, instally 'nestpy' should just require running:

pip install nestpy

You can then test that it works by running the example above.

Installing from source

Requirements: You must have CMake>=2.8.12 and a C++11 compatible compiler (GCC>=4.8) to build.

First, you must check out this repository then simply run the installer:

git clone https://github.com/NESTCollaboration/nestpy
cd nestpy
python setup.py install

Usage

Python bindings to the NEST library:

import nestpy

# This is same as C++ NEST with naming
nc = nestpy.NESTcalc(nestpy.VDetector())

interaction = nestpy.INTERACTION_TYPE(0)  # NR

E = 10  # keV
print('For an %s keV %s' % (E, interaction))

# Get particle yields
y = nc.GetYields(interaction,
		 E)

print('The photon yield is:', y.PhotonYield)
print('With statistical fluctuations',
      nc.GetQuanta(y).photons)

For more examples on possible calls, please see the tests and tutorials folders.

Support

  • Bugs: Please report bugs to the issue tracker on Github such that we can keep track of them and eventually fix them. Please explain how to reproduce the issue (including code) and which system you are running on.
  • Help: Help can be provided also via the issue tracker by tagging your issue with 'question'
  • Contributing: Please fork this repository then make a pull request. In this pull request, explain the details of your change and include tests.

Technical implementation

This package is a pybind11 wrapper of NEST that uses TravisCI to build binaries using the manylinux Docker image.

  • Help from Henry Schreiner, which included a great binding tutorial
  • Implementation also based on this

See AUTHORS.md for information on the developers.

Citation

When you use nestpy, please say so in your slides or publications (for publications, see Zenodo link above). You can mention this in addition to how you cite NEST. This is important for us being able to get funding to support this project.

History

Patch releases mean (the Z number in X.Y.Z version) that the underlying physics has not changed. Changes to the NEST version will always trigger a minor or major release. If this library changes such that end users have to change their code, this may also trigger a minor or major release.

1.5.0 (2021-11-11)

New Physics:

  • Carried over from v2.3 beta: A new binomial random number generator (C++ default library), e- EE models, beta model with new yields and fluctuations, non-beta-ER (XELDA).
  • New beta model is default regardless of E-field, but old one is still accessible
  • ER model (betas and gammas weighted) is its own function, callable
  • Pb-206 ion coming off wall from alpha decay has correct Ly and Qy versus field (Thomas-Imel box model for recomb)
  • The electron extraction efficiency model now includes “optimistic” high e- EE Aprile/PandaX fits (activatable with EPS_GAS negative)

Code Quality and/or Miscellaneous Bug Fixes:

  • C++11 -> 17 default, README updated with all new versioning requirements, but old gcc and cmake versions requested to allow backwards-compatibility with nestpy. std::clamp still doesn’t work, so similar function written by hand
  • 1.1 -> 1.08 for increasing Qy to match new Zurich W-value measurement, but with new more logical variable names both deep in code and in detector file for user, and with one factor universal in NEST.cpp; general variable renaming for greater clarity
  • Numerous cosmetic and aesthetic changes to code, including unused variable removal, while spacing and tabbing made Google clang-format (with shell script for that now included with NEST), if/else Mac dangle warning addressed
  • Kr83m yields same but code overhauled to allow min versus max time separation flexibility and easier data comparison, with bug squashed where wrong error message got replayed
  • NEST is now 30% faster, cf. v2.2.4, at least when using gcc 7+, despite the new binomial fluctuation function!

nestpy Specific:

  • Bindings to energy spectra generators from TestSpectra.cpp, including: tritium and C14 beta sources; AmBe, DD, Cf252 neutron sources; Spin-Independent WIMP Generators.

1.4.12 (2021-11-02)

Sync with NEST v2.3.0beta

  • Beta model updated to work with LUX C-14 (medium E-fields) in addition to XENON1T Rn-220 calibration, < 100 V/cm (Greg Rischbieter, Matthew Szydagis, Vetri Velan, and Quentin Riffard of LZ)
  • Non-beta (L-shell and M-shell) ER data now matched, from the XELDA experiment, with weighting of beta and gamma models (Sophia Farrell, Rice/XENON and Greg R. UAlbany/LZ)
  • Work function of 11.5 eV (EXO-200, Zurich) can now be more accurately reproduced with the "remove quanta" flag set to false, matching the EXO and Baudis (new) data sets (Kirsten McMichael, RPI/nEXO and Matthew Szydagis, UAlbany/LZ)
  • Systematic error taken into account for 3D XYZ position reconstruction with S2, per LUX Mercury paper (Claudio Silva, Coimbra/LZ).
  • Made the default S1 calculation mode hybrid instead of full, for faster simulation of large-energy (e.g., MeV-scale) events
  • Tweaked the default detector example (LUX Run03) to work with the latest models and reproduce D-D and 3H bands perfectly still, while also adding units to this LUX detector header file (Szydagis)
  • Binomial random number generator now uses default C++ library (Robert James, LZ). Code is a bit slower now (only by ~10%) but is more precise, and matches python, Flamedisx
  • The e- ext eff from liquid to gas is now based on both E-field (in liquid) and temperature, not field alone, combining dozen data sets spanning decades, to address concern raised by Sergey Pereverzev, LLNL. So, it's NOT just PIXeY or LLNL, etc.

1.4.11 (2021-08-09)

Sync with NEST v2.2.3

  • Replaced useTiming variable by an enum and made the GetS1 result a class member. Separated the S1 and S2 calculation modes.
  • Made GetS1 return a ref to avoid vector copy
  • Made the GetS2 results a private member returned by reference, while also making GetS1 and GetS2 results "const"
  • Removed useless, unused variables that caused a lot of memory allocation/deallocation; result of all this and the above: +~1-5% faster
  • Updated the parametric S1 calc to account for the truncated-Gaussian SPE and DPE distributions, making it more consistent with "full"
  • Changed hybrid-mode transition to be 100 keV, ~500 photon hits in modern TPCs, instead of hits directly, creating a smooth transition
  • Efficiency adjustment in the S1 parametric mode that further makes the parametric and full modes (previously useTiming -1,0) closer.
  • Changes driven by Quentin Riffard (LZ/LBNL) & Greg Rischbieter (LZ/UA), with ideas from Matthew (UA) & Luke Kreczko (Bristol)

1.4.10 (2021-07-08)

Sync with NEST v2.2.2

Code Quality and/or Misc Bug Fixes:

  • Added default density argument for LXe case, forcing an argument re-ordering (Sophia)
  • Moved position of "delete detector" in execNEST to solve python problem (Albert Baker, Greg R.)
  • Approx eff func for single phe made simpler, for FlameDisx (Robert James, Sophia, Matthew)
  • More robust rule used for when to approximate binomial as Gaussian (Sophia, Greg R.)
  • Warn that you are in a region of too-low time between S1a and S1b for Kr83m only 1x (Sophia)
  • Bad-order if-statements simplified with a min within a max for <0, >1 checks (Luke K., Matthew) New Physics:
  • Liquid Ar model for ER fits all the data better now, in both energy and dE/dx bases (Kate K.)

Code Quality and/or Miscellaneous Bug Fixes:

  • Deleted unused redundant line in GetS1 that re-calculated the drift time (Quentin Riffard, LBNL/LZ)
  • Only print most error and warning messages if verbosity on (Quentin Riffard, LBNL/LZ)
  • Updated TravisCI link in README and added note about OSX builds (Chris Tunnell, Rice/XENON)
  • Use of abs value func standardized, lines broken up, multi-line string for cerr (Matthew at behest of Luke Kreczko, Bristol/LZ) New Physics:
  • Liquid Xe model for NR is now better behaved at few hundred keV and few hundred in S1: no odd increase in band width caused by Nex/Ni zeroing out and kinking the recombination probability. Mean yields model unchanged, nor recombination fluctuations / skewness. (Matthew and Greg R., UAlbany/LZ)

1.4.9 (2021-06-01)

Sync with NEST v2.2.1patch2

Code Quality and/or Misc Bug Fixes:

  • Added default density argument for LXe case, forcing an argument re-ordering (Sophia)
  • Moved position of "delete detector" in execNEST to solve python problem (Albert Baker, Greg R.)
  • Approx eff func for single phe made simpler, for FlameDisx (Robert James, Sophia, Matthew)
  • More robust rule used for when to approximate binomial as Gaussian (Sophia, Greg R.)
  • Warn that you are in a region of too-low time between S1a and S1b for Kr83m only 1x (Sophia)
  • Bad-order if-statements simplified with a min within a max for <0, >1 checks (Luke K., Matthew) New Physics:
  • Liquid Ar model for ER fits all the data better now, in both energy and dE/dx bases (Kate K.)

1.4.8 (2021-04-09)

Sync with NEST v2.2.1patch1

1.4.7 (2021-03-03)

Sync with NEST v2.2.1

  • Cleaned up MANIFEST so pypi dist packages are less bulky #56
  • Added floating point comparison method for equality checks #54
  • Random Number Generation in bindings.cpp to ensure quanta are truly randomized. #54
  • Binding to Kr83m yields model directly so users can specify explicity deltaT_ns between decay modes. #55

1.4.5-1.4.6 (2021-03-01)

(Pre-releases, see version 1.4.7 for distributions)
Sync with NEST v2.2.1

1.4.4 (2021-02-10)

NEST v2.2.0 (no NEST changes)

  • PyPi calls improved to compile for linux

1.4.3 (2021-02-08)

NEST v2.2.0 (no NEST changes)

  • Attempted bug fix (fixed properly in 1.4.4)
  • New tutorials directory

1.4.2 (2021-02-01)

  • Bind with LUX detector file
  • Fix interaction key interpretation in helpers

1.4.1 (2020-12-15)

Sync with v2.2.0 NEST. Includes all files in MANIFEST.in, so that pip install will work.

1.4.0 (2020-11-19)

Minor changes all are to fix software bugs, no physics changes.

  • MANIFEST.in include requirements
  • Make sure to include all dependencies.
  • Fix travis builds.

1.4.0beta (2020-11-14)

NESTv2.2.0beta

1.3.2 (2020-11-11)

NESTv2.1.2

  • New free parameters registered
  • Cases of void initialization in tests fixed
  • Introduced files for debugging tests as we improve code
  • Prepared for NEST v.2.2 which is imminent
  • Solved half of GetS1 and GetS2 issues opened in #37

1.3.1 (2020-08-26)

NESTv2.1.1

1.3.0 (2020-07-06)

NESTv2.1.0

1.2.1 (2020-06-20)

NESTv2.1.0beta

1.1.4 (2020-06-20)

  • Update pybind11 2.5.0
  • Fix manylinux build
  • Add Python 3.8 support

1.1.3 (2019-08-05)

Default arguments for GetYields and GetQuanta (see PR #25)

1.1.2 (2019-08-02)

NESTv2.0.1

  • execNEST included in nestpy
  • Extensive bug fixes and testing improvements

1.1.1 (2018-08-29)

NESTv2.0.0

  • Fix source installation (See #16).

1.1.0 (2018-08-18)

NESTv2.0.0

  • Release to world.
  • Cleanup (#15)

1.0.3 (2018-08-18)

NESTv2.0.0

  • README broken links fixed

1.0.2 (2018-08-18)

NESTv2.0.0

  • Metadata (classifier in setup.py, badges, chat) (#14)

1.0.1 (2018-08-18)

NESTv2.0.0

  • Retrigger release for PyPI deployment

1.0.0 (2018-08-18)

NESTv2.0.0

  • First release intended for general public.
  • Mac OSX support (#10)
  • Complete tests and various bug fixes (#13)
  • Documentation, citation, and technical detail writing

0.2.3 (2018-08-14)

NESTv2.0.0

  • Still working on PyPI

0.2.2 (2018-08-14)

NESTv2.0.0

  • Fix lack of deploy of release to PyPI

0.2.1 (2018-08-14)

NESTv2.0.0

  • Fix tests that were breaking only in deploys

0.2.0 (2018-08-14)

NESTv2.0.0

  • Fully wrapped NEST (PR #5)

0.1.1 (2018-08-14)

NESTv2.0.0

  • First release that deploys on PyPI. Limited functionality. (PR #2)

0.1.0 (2018-08-14)

NESTv2.0.0

  • Initial release

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

nestpy-1.4.11-cp39-cp39-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9

nestpy-1.4.11-cp38-cp38-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8

nestpy-1.4.11-cp38-cp38-macosx_10_14_x86_64.whl (690.0 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

nestpy-1.4.11-cp37-cp37m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m

nestpy-1.4.11-cp36-cp36m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m

nestpy-1.4.11-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

nestpy-1.4.11-cp27-cp27mu-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 2.7mu

nestpy-1.4.11-cp27-cp27m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 2.7m

File details

Details for the file nestpy-1.4.11-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 56e3565198afa5037ac6a933e0cf938452907d4b117ae40391fc0cac485bf94b
MD5 3fab262c52e768b22d2a839337318ea3
BLAKE2b-256 d3b1ae8be68d04e6a496292ccaafda378a0e0fb177bed76618848f9b71c866c0

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 48e207c75959c2f498e3f33dcd5541427971827161fb80dd9815cc845538799b
MD5 4f0d58128fa096e733ef03f491def637
BLAKE2b-256 abfd4b9ec8727dc7b85ca50d1243c38cf94b622cd321321ecb84e654a13d3c82

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 690.0 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for nestpy-1.4.11-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a4f6579c1886a1a29af1e6a616f7e7e0ccad44725cbe7fb21a0dd19a90cc780d
MD5 2d465205646908e354311d934d18cf6c
BLAKE2b-256 4d27bed11897349fb3fb1cbdf6a0bc5cc42ab28a36f2dde86a69b1eac8ad459f

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ba82e5dc0c08a61b95e229388b26f1aaa0066653e6a142466c16ad02408befc7
MD5 954ad52ca456b74a732b2f9aa2838c8a
BLAKE2b-256 5268dda452b12c073a0af9ac5b8233435f29969cc10483ca777a55b60a81a312

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0b53368ae3258577fbd546f71fceb9a228ff1c8c106d99e0fb737386274b1274
MD5 9ecbea0e27377ed4585610d387506321
BLAKE2b-256 915e55d9b2ab2ed68d53780262489bcb866e836d66082c8e01cfe451a33e94b3

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1ed44f61cacda5257f7d68bf83628ba1012a4eaa0978d587a83b677280f27d27
MD5 1ed328ee6064ef8c014bdfa7e883bc30
BLAKE2b-256 69e368a15ea27ae1cf3097f316df0de509534d518c18a74a0dc3d2e2adc1cdaf

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 13cefcf49ad22b97a42faa41d66d450639d62f8e8392a7f12d64813d0c02e401
MD5 3acc737f8d8a716f20bae2c781d11479
BLAKE2b-256 2264cad2d03ba496b7bef2e531ad5db4ce301a72e79656bf98213651d329e2da

See more details on using hashes here.

File details

Details for the file nestpy-1.4.11-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nestpy-1.4.11-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7

File hashes

Hashes for nestpy-1.4.11-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e5904870a3a875084a32deff5af96ff27b484b86d92cf733a262d5bd47fcf037
MD5 2155831fa08e33b6e4f867d31cbb0d4a
BLAKE2b-256 61868cb96cd55a982dc868df0b55e58a7cb1c349ea8da2f517dc7d37e0719aea

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