Commit 7fb7e00b authored by Mukherjee, Debangshu's avatar Mukherjee, Debangshu
Browse files

Added numexpr dependency

parent a42facb9
......@@ -69,13 +69,13 @@ MOCK_MODULES = [
"multiprocessing",
"dask.array",
"dask",
"pyfftw.interfaces.numpy_fft"
"pyfftw.interfaces.numpy_fft",
"numexpr",
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()
from unittest.mock import MagicMock
import matplotlib
matplotlib.use("agg")
......@@ -106,21 +106,6 @@ class Mock(MagicMock):
return MagicMock()
MOCK_MODULES = [
"pygtk",
"gtk",
"gobject",
"argparse",
"numpy",
"pandas",
"skimage",
"pyfftw",
"scikit-image",
"numba",
"imagecodecs",
]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
# -- General configuration ---------------------------------------------------
......
......@@ -19,48 +19,6 @@
"First, if `stemtool` is not installed, we install it:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: stemtool in /home/qz7/anaconda3/lib/python3.7/site-packages/stemtool-0.532-py3.7.egg (0.532)\n",
"Requirement already satisfied: pyfftw>=0.10.3 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (0.12.0)\n",
"Requirement already satisfied: pywavelets>=0.5.2 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (1.1.1)\n",
"Requirement already satisfied: numpy>=1.13.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (1.19.1)\n",
"Requirement already satisfied: scipy>=1.0.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (1.5.2)\n",
"Requirement already satisfied: matplotlib>=2.2.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (3.3.1)\n",
"Requirement already satisfied: pillow>5.0.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (8.0.0)\n",
"Requirement already satisfied: numba>=0.45.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (0.51.2)\n",
"Requirement already satisfied: scikit-image>=0.13.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (0.17.2)\n",
"Requirement already satisfied: matplotlib-scalebar>=0.5.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (0.6.2)\n",
"Requirement already satisfied: ase>=3.16.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (3.19.1)\n",
"Requirement already satisfied: h5py>=2.7.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (2.10.0)\n",
"Requirement already satisfied: dask>=2.0.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from stemtool) (2.30.0)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/qz7/anaconda3/lib/python3.7/site-packages (from matplotlib>=2.2.0->stemtool) (2.4.7)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /home/qz7/anaconda3/lib/python3.7/site-packages (from matplotlib>=2.2.0->stemtool) (2.8.1)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /home/qz7/anaconda3/lib/python3.7/site-packages (from matplotlib>=2.2.0->stemtool) (1.2.0)\n",
"Requirement already satisfied: cycler>=0.10 in /home/qz7/anaconda3/lib/python3.7/site-packages (from matplotlib>=2.2.0->stemtool) (0.10.0)\n",
"Requirement already satisfied: certifi>=2020.06.20 in /home/qz7/anaconda3/lib/python3.7/site-packages (from matplotlib>=2.2.0->stemtool) (2020.6.20)\n",
"Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from numba>=0.45.0->stemtool) (0.34.0)\n",
"Requirement already satisfied: setuptools in /home/qz7/anaconda3/lib/python3.7/site-packages (from numba>=0.45.0->stemtool) (49.6.0.post20201009)\n",
"Requirement already satisfied: networkx>=2.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from scikit-image>=0.13.0->stemtool) (2.5)\n",
"Requirement already satisfied: imageio>=2.3.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from scikit-image>=0.13.0->stemtool) (2.9.0)\n",
"Requirement already satisfied: tifffile>=2019.7.26 in /home/qz7/anaconda3/lib/python3.7/site-packages (from scikit-image>=0.13.0->stemtool) (2020.10.1)\n",
"Requirement already satisfied: six in /home/qz7/anaconda3/lib/python3.7/site-packages (from h5py>=2.7.0->stemtool) (1.15.0)\n",
"Requirement already satisfied: pyyaml in /home/qz7/anaconda3/lib/python3.7/site-packages (from dask>=2.0.0->stemtool) (5.3.1)\n",
"Requirement already satisfied: decorator>=4.3.0 in /home/qz7/anaconda3/lib/python3.7/site-packages (from networkx>=2.0->scikit-image>=0.13.0->stemtool) (4.4.2)\n"
]
}
],
"source": [
"!pip install stemtool"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -72,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -99,14 +57,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Elapsed time: 3.295365 seconds.\n",
"Elapsed time: 3.303474 seconds.\n",
"\n"
]
}
......@@ -144,7 +102,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -160,7 +118,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -394,7 +352,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Elapsed time: 1.014183 seconds.\n",
"Elapsed time: 1.083005 seconds.\n",
"\n"
]
},
......@@ -435,7 +393,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Elapsed time: 9.162902 seconds.\n",
"Elapsed time: 9.146991 seconds.\n",
"\n"
]
},
......@@ -476,7 +434,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Elapsed time: 1.391834 seconds.\n",
"Elapsed time: 0.652032 seconds.\n",
"\n"
]
},
......@@ -545,16 +503,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"If we also want to "
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [
{
......@@ -583,7 +532,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"outputs": [
{
......@@ -592,7 +541,7 @@
"dict_keys(['data_adf', 'data_4D', 'calib', 'voltage', 'wavelength', 'aperture', 'planck', 'epsilon0', 'e_charge', 'sigma', 'data_bf', 'cbed', 'beam_x', 'beam_y', 'beam_r', 'inverse', 'YCom', 'XCom', 'angle', 'final_flip', 'XComC', 'YComC', 'MomentumX', 'MomentumY', 'e_fieldX', 'e_fieldY', 'charge', 'phase', 'potential'])"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
......@@ -600,6 +549,33 @@
"source": [
"DPC.__dict__.keys()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-102.66844364666798"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"DPC.angle"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -31,7 +31,8 @@ if not os.getenv("READTHEDOCS"):
"matplotlib-scalebar >= 0.5.0",
"ase >= 3.16.0",
"h5py >= 2.7.0",
"dask >= 2.0.0",
"dask >= 2.0.0",
"numexpr >= 2.6.5",
],
)
else:
......
......@@ -23,7 +23,7 @@ def pol2cart(rho, phi):
def angle_fun(angle, rho_dpc, phi_dpc):
angle = angle * ((np.pi) / 180)
new_phi = phi_dpc + angle
x_dpc, y_dpc = pol2cart(rho_dpc, new_phi)
x_dpc, y_dpc = st.dpc.pol2cart(rho_dpc, new_phi)
charge = np.gradient(x_dpc)[1] + np.gradient(y_dpc)[0]
angle_sum = np.sum(np.abs(charge))
return angle_sum
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment