Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xin's version with added functions #30

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ These are the Python bindings for the [NEST library](https://github.com/NESTColl

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

## Installing from PyPI
## Note from Xin:
This package is forked from [nestpy](https://github.com/NESTCollaboration/nestpy) and updated to LUX Run3 Detector template. In addition, two functions are added to `testNEST.cpp`.
1. runNEST() --- A function that takes in an energy and a position as the inputs, and output (S1, S2) observables
2. runNEST_vec() --- A vectorized function that takes in a list of energies and positions as the inputs, and outputs a list of s1, s2 variables.

For 64-bit Linux or Mac systems, instally 'nestpy' should just require running:
Additionally, all NEST built-in spectrum are binded as well. User has direct access to the various spectra.

```
pip install nestpy
```

You can then test that it works by running the example above.
Please see `example/demo_v0.ipynb` for the usage.

## Installing from source

Expand All @@ -28,11 +27,12 @@ Requirements: You must have CMake>=2.8.12 and a C++11 compatible compiler (GCC>=
First, you must check out this repository then simply run the installer:

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


## Usage

Python bindings to the NEST library:
Expand Down
226 changes: 226 additions & 0 deletions examples/demo_v0.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import nestpy\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"T_Kelvin: 173.0\n",
"radius: 200.0\n",
"dt_min: 80.0\n",
"dt_max: 130.0\n",
"anode: 549.2\n",
"cathode: 55.9\n",
"T_Kelvin: 173.0\n",
"p_bar: 1.57\n"
]
}
],
"source": [
"\n",
"#create detector\n",
"detector = nestpy.DetectorExample_LUX_RUN03()\n",
"\n",
"# inspect detector parameters\n",
"z_max = detector.get_TopDrift() \n",
"radius = detector.get_radius() # right fid radius?? TBD\n",
"dt_min = detector.get_dt_min() # right min dt?? TBD\n",
"dt_max = detector.get_dt_max() # right max dt?? TBD\n",
"anode = detector.get_anode()\n",
"cathode = detector.get_cathode()\n",
"T_Kelvin = detector.get_T_Kelvin() \n",
"p_bar = detector.get_p_bar() \n",
"\n",
"# print detector parameters (satisfied with the setting?)\n",
"print('T_Kelvin:', T_Kelvin)\n",
"print('radius:', radius)\n",
"print('dt_min:', dt_min)\n",
"print('dt_max:', dt_max)\n",
"print('anode:', anode)\n",
"print('cathode:', cathode)\n",
"print('T_Kelvin:', T_Kelvin)\n",
"print('p_bar:', p_bar)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6.532790408546776 590.173217059425\n"
]
}
],
"source": [
"# run a single recoil\n",
"keV=10\n",
"type_num = nestpy.INTERACTION_TYPE(0) # NR\n",
"pos_x, pos_y, pos_z = 0., 0., z_max/2.\n",
"inField=180\n",
"\n",
"obs = nestpy.runNEST(\n",
" detector, \n",
" keV, \n",
" type_num, \n",
" inField, \n",
" pos_x, \n",
" pos_y, \n",
" pos_z, \n",
" seed=0\n",
" )\n",
"\n",
"s1c_phd = obs.s1c_phd\n",
"s2c_phd = obs.s2c_phd\n",
"print(s1c_phd, s2c_phd)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# run many recoils with vectorized arguments\n",
"\n",
"# somehow detector is deleted once runNEST is finished\n",
"\n",
"n_events=100\n",
"keV=np.linspace(0, 100, n_events)\n",
"type_num = nestpy.INTERACTION_TYPE(0) # NR\n",
"\n",
"# uniformly sample (x,y,z) in cylindar colume\n",
"r2 = np.random.uniform(low=0, high=radius*radius, size=n_events)\n",
"r = np.sqrt(r2)\n",
"phi = np.random.uniform(low=0, high=2*np.pi, size=n_events)\n",
"pos_x = r * np.cos(phi);\n",
"pos_y = r * np.sin(phi);\n",
"pos_z = np.random.uniform(low=0, high=z_max, size=n_events)\n",
"\n",
"inField=180\n",
"obs_arr = nestpy.runNEST_vec(\n",
" nestpy.DetectorExample_LUX_RUN03(), \n",
" keV.tolist(), \n",
" type_num, \n",
" inField, \n",
" pos_x.tolist(), \n",
" pos_y.tolist(), \n",
" pos_z.tolist(), \n",
" 0\n",
" )\n",
"\n",
"s1 = np.array(obs_arr.s1c_phd)\n",
"s2 =np.array(obs_arr.s2c_phd)\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAG1NJREFUeJzt3X+MXfV55/H3x+MBhkAZWqYVHiB2usHdhCiexJtF8rabOgiTpAWXpCHd3TZqo6KsstqwJahmoyUk/SNOrCarVbqbZZuqtKLbkMRxHBB1UYFGIOF0jG2MMU5ooC0DGzsJkwQ8hfHw7B/3Dr5zfX+ce++59/z6vKSRr88cz318Zua53/uc5/v9KiIwM7NyWZV1AGZmlj4ndzOzEnJyNzMrISd3M7MScnI3MyshJ3czsxJycjczKyEndzOzEnJyNzMrodVZPfEFF1wQa9euzerpzcwKad++fd+PiKlu52WW3NeuXcvs7GxWT29mVkiS/iHJeS7LmJmV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SmpHXU4vzWqONrcAXwREQ8s3wgb9eyq6zv6DZ+UOtA+Da1V8SPZR1PQ1z/htpbxEeBA/WPdwF/DhyqH98NXJhxnK+j1nFwEDi8fA2BnwH+BvhO/c+fzjjOs4EfAOc1HMv8WlJ7sXkOWKQ2kvxgu2tHrYzwR/Wf1UPAxozjfJJazXr55/ML9XPfU/9ZOAg8AvxqxnG2/T4DH6tfz6PAO7OKsX78T4EPNZ2b2bXs58MzVM3MSihPZRkzM0uJk7uZWQk5uZuZlZCTu5lZCTm5m5mVkJO7mVkJObmbmZWQk7uZWQn9fwb36y9PGuTyAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# apply a detector cut and plot it\n",
"cut_mask = np.logical_and(s2>0, s1>0)\n",
"plt.scatter(s1[cut_mask], np.log10(s2[cut_mask]))\n",
"plt.xlabel('s1 [phd]')\n",
"plt.ylabel('log10(s2 [phd])')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# example of using NEST recoil generators"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# NEST WIMP spectrum comes from: \n",
"# Phys. Rev. D 82 (2010) 023530 (McCabe)\n",
"\n",
"Er = np.linspace(0.01, 3, 400)\n",
"\n",
"spec = nestpy.TestSpectra()\n",
"WIMP_dRate_vec = np.vectorize(spec.WIMP_dRate)\n",
"\n",
"\n",
"dR_3GeV = WIMP_dRate_vec(Er, m_GeV=3)\n",
"dR_6GeV = WIMP_dRate_vec(Er, m_GeV=6)\n",
"dR_10GeV = WIMP_dRate_vec(Er, m_GeV=10)\n",
"\n",
"plt.plot(Er, dR_3GeV, label='3 GeV')\n",
"plt.plot(Er, dR_6GeV, label='6 GeV')\n",
"# plt.plot(Er, dR_10GeV, label='10 GeV')\n",
"plt.legend()\n",
"plt.yscale('log')\n",
"plt.title('$\\sigma=10^{-36}$ cm$^2$')\n",
"plt.xlabel('Er [keVnr]')\n",
"plt.ylabel('dR/dE [counts/(kg-d-keV)]')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading