Skip to content

(unofficial; beta) Raw Python bindings to the NEST library using pybind11.

License

Notifications You must be signed in to change notification settings

YaniBion/nestpy

 
 

Repository files navigation

nestpy (beta status)

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

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 checkout https://github.com/NESTCollaboration/nestpy
cd nestpy
python setup.py install

Usage

Python bindings to the NEST library:

import nestpy

# Setup a VDetector
detector = nestpy.DetectorExample_XENON10()

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

A = 131.293
Z = 54.
density = 2.9 # g/cm^3                                                                                            

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,
                 density,
                 124, # Drift field, V/cm                                                                         
                 A,
                 Z,
                 (1,1))

print('The photon yield is:', y.PhotonYield)

print('With statistical fluctuations', nc.GetQuanta(y, density).photons)

For more examples on possible calls, please see the tests folder.

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.

About

(unofficial; beta) Raw Python bindings to the NEST library using pybind11.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C++ 73.3%
  • Python 22.3%
  • CMake 4.0%
  • Other 0.4%