Commit d9372cd1 authored by Leon Merten Lohse's avatar Leon Merten Lohse
Browse files

remove mask from multislice propagation kernel

parent 8f31ee2b
Pipeline #181964 passed with stages
in 1 minute and 17 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -4,7 +4,21 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'pyfftw'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-9a70ce741ace>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mfresnel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpropagate\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpropagate\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/.local/lib/python3.9/site-packages/fresnel/propagate.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mfinite_differences\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mmisc\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mfftfreqn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0m_lambda0\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;31m# all lengths are in units of the wavelength\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.9/site-packages/fresnel/misc.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpyfftw\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minterfaces\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnumpy_fft\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mfftfreq\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mfftfreqn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0md\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pyfftw'"
]
}
],
"source": [
"import numpy as np\n",
"import xraylib as xrl\n",
......@@ -15,7 +29,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -24,17 +38,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dx: 1.18151617196322, dz: 3871.592192289079 wavelengths\n"
]
}
],
"outputs": [],
"source": [
"energy = 12. # keV\n",
"\n",
......@@ -58,9 +64,21 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'xrl' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-dd74c4c06808>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdensity_Ge\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mElementDensity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSymbolToAtomicNumber\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Ge'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdensity_Polyimide\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1.42\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdensity_Si\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mElementDensity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSymbolToAtomicNumber\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Si'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mn_Ge\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRefractive_Index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Ge'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0menergy\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdensity_Ge\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mn_Si\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mxrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRefractive_Index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Si'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0menergy\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdensity_Si\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'xrl' is not defined"
]
}
],
"source": [
"density_Ge = xrl.ElementDensity(xrl.SymbolToAtomicNumber('Ge'))\n",
"density_Polyimide = 1.42\n",
......@@ -178,7 +196,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.7"
"version": "3.9.1"
}
},
"nbformat": 4,
......
This diff is collapsed.
......@@ -24,11 +24,13 @@ def rayleighSommerfeldTF(shape, dperp, k, dz):
f = fftfreqn(shape, dperp) # spatial frequencies
f2 = squaresum(f)
mask = f2 < 1 / wl
# mask = f2 < 1 / wl
phasechirp = np.sqrt(1 - wl ** 2 * (mask * f2))
# phasechirp = np.sqrt(1 - wl ** 2 * (mask * f2))
phasechirp = np.sqrt(1 - wl ** 2 * f2)
TF = mask * np.exp(1j * k * dz * phasechirp)
# TF = mask * np.exp(1j * k * dz * phasechirp)
TF = np.exp(1j * k * dz * phasechirp)
return TF
......
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