Calculations/Siemens star Analyzer/Siemens star analysis.ipynb

294 lines
4.2 MiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "dd7a79da",
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"\n",
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.ticker as mtick\n",
"\n",
"import scipy\n",
"from scipy.signal import savgol_filter\n",
"from scipy.optimize import curve_fit\n",
"\n",
"from Analyzer import *"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "0da7ff81",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9AAAAPHCAYAAADAfaHLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d4xk2XUfjn8qV+ece3p68uyEzRR3uUEUuVxJDBIoQSJBBdMW4BxkyTAgGwZk/yFbBmzLkGBBcpAFC4JkSSZNWsGkRFIkd7ncwA2zuzO7k6dnuns6x6rqir8/5nfefN6pc1+o7qW8++0DFKrqvRvPPfeke+69iUaj0cA+7MM+7MM+7MM+7MM+7MM+7MM+7MM+BELyr7oB+7AP+7AP+7AP+7AP+7AP+7AP+7AP7wbYN6D3YR/2YR/2YR/2YR/2YR/2YR/2YR8iwL4BvQ/7sA/7sA/7sA/7sA/7sA/7sA/7EAH2Deh92Id92Id92Id92Id92Id92Id92IcIsG9A78M+7MM+7MM+7MM+7MM+7MM+7MM+RIB9A3of9mEf9mEf9mEf9mEf9mEf9mEf9iEC7BvQ+7AP+7AP+7AP+7AP+7AP+7AP+7APESD9V92AVqBer2N2dhZdXV1IJBJ/1c3Zh33Yh33Yh33Yh33Yh33Yh33Yh3cpNBoNbG5uYnx8HMlk8Brzu9KAnp2dxYEDB/6qm7EP+7AP+7AP+7AP+7A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rfRw5y2ApTMCdOdje3u7jtTzPZYXNyqvb4OKX/K3xxzTIfavX61hfX28K32yFZwYp0i4I0l2EPjKZDKamptD
"text/plain": [
"<Figure size 1800x1200 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data = cv2.imread(\"ss.png\",cv2.IMREAD_GRAYSCALE)\n",
"\n",
"fig = plt.figure(figsize=(18,12))\n",
"\n",
"plt.imshow(data,origin='lower',cmap='gray')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d550c6fd",
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x216d1fcd7c0>]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9AAAAPHCAYAAADAfaHLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz917MsS5beif3cPSJSbL2PPufqW3WrurqquxpoAQ30DDjQIAbDsZkHjsH4QPXCJ5rxYf4KmtFoxgea8ZHkAAQxQ+NgFAg1GHah0Wh0V3epW/fWVUeLrVNEuDsfXIRHZGRm5D77VqOKe5nl3pkhPCJWeHj4t9a31hLWWsu1XMu1XMu1XMu1XMu1XMu1XMu1XMu1rBT5R30C13It13It13It13It13It13It13ItPwtyDaCv5Vqu5Vqu5Vqu5Vqu5Vqu5Vqu5Vp6yDWAvpZruZZruZZruZZruZZruZZruZZr6SHXAPparuVaruVaruVaruVaruVaruVarqWHXAPoa7mWa7mWa7mWa7mWa7mWa7mWa7mWHnINoK/lWq7lWq7lWq7lWq7lWq7lWq7lWnrINYC+lmu5lmu5lmu5lmu5lmu5lmu5lmvpIdkf9QlcRowxPHz4kJ2dHYQQf9Sncy3Xci3X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d6btxrKmUOYL2HG+GNJLoBugup0arCDAxmbwtxeubOu6oS798aT2nX8mSdUB3r2vu3PI2Nl7LRZBMQp5kzIKjK6cVIz5QQznuVGH+ksA3Pc+afbcd2qJcbK5jbuo8VUjtjkag9rGFcmZusbsO3LYSlyDRGCVB1uzZFPQsTWVb3ua7t2221Pfb
"text/plain": [
"<Figure size 1800x1200 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAzYAAAMyCAYAAAC/3lRXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9WbMlO3YeCH4L7ns48xBzxI075Z1yZuVAUhQpqUplGqqtzfQmq/4FMj5JfJJMT9IL/4HUD2q966HLrLutJVPTWlUtUlSxRCrJJJnDzcw7R8SN6czn7NGBfgAWsACH+/Z9TlymIrmX2T77bHcADiwHFtYMMsYYrGAFK1jBClawghWsYAUrWMFLDOrn3YEVrGAFK1jBClawghWsYAUruCqsBJsVrGAFK1jBClawghWsYAUvPawEmxWsYAUrWMEKVrCCFaxgBS89rASbFaxgBStYwQpWsIIVrGAFLz2sBJsVrGAFK1jBClawghWsYAUvPawEmxWsYAUrWMEKVrCCFaxgBS89rASbFaxgBStYwQpWsIIVrGAFLz2sBJsVrGAFK1jBClawghWsYAUvPawEmxWsYAUrWMEKVrCCFaxgBS89rASbFaxgBStYwQpWsIIVrGAFLz38XAWbf/Ev/gXeeOMNDIdDfPvb38bv/u7v/jy7s4IVrGAFK1jBClawghWs4CWFn5tg82/+zb/BP/yH/xD/9J/+U3zve9/Db/zGb+Dv/t2/i08++eTn1aUVrGAFK1jBClawghWsYAUvKZAxxvw8Hvwrv/Ir+Na3voV/+S//pb/25S9/GX/v7/09/PZv/3ZrXa01Hj58iK2tLRDRF93VF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WLr+g4GQYgHD8+SxcBgMBgMBoPBYDAYDEYVmKxmMBgMxprCe295DIHCTxNz1aXNFYFEWd0l9Kx+7MQCAOC6qJmiCs/zcP0u2WSRyWoGg8FgMBgMBoPBYLgDk9UMBoPBWDM4cHIRn7pHqKq9SOQcWFJW5zVXBOx5VqvvlYW0AmHfagaDwWAwGAwGg8FguAST1QwGg8FYdXjg0Cxe9Udfxts/uzflw/yeWx7DMAjxqqu2Y31H9BgOXCurLdiASELe80ZtSADg+l3nAADufvIMWQwMBoPBYDAYDAaDwWBUgclqBoPBYKw6fHHPMew7uYg/v3UffuDdX8XdT55JqarfeuPl8CPillJZfXx+BSfmu/A84Kqd07nPsaKsjv5Ev4CsftaujWj6Hp46s4wnTi2SxcFgMBgMBoPBYDAYDEYZmKxmMBgMxqrD8fmV+OvHTyziR95/G37uQ3diGIR45ZXb8KxdmyB7HVI2WNx7ZB4AsHvrFNa1m7nP6TQbAIAuIVkdxmR1/s+nJ1p4/sWbAQA37T1OFocOVvrD2LaEwWAwGAwGg8FgMBhrC0xWMxgMBmPV4dhcFwDwW993Ff7Vs89HEAL7TgjF8FtffQUAKMpqujj2Hin3qwaATqysHhY+5+lCEvJFymoAuPHq7QCAm/ceI4ujDEEQ4iO3P4Hn/febcOOf3Io7D5x2EgeDwWAwGAwGg8FgMNyByWoGg8FgrDpIZfUVO9bjHT9+Pf7i3zwPV+xYj5990UVxM0EbDRZnlvoAgB0bJgqfE9uADG14Vhc/59VX7wAA3LH/NOZW+mSx5OHg6SX89Ae+if/3Uw9goTvA/pOL+LE//wZ+99N7sNyjI/EZDAaDwWAwGAwGg1EvMFnNYDAYjFUHqazePi1I4tdcswNf+LWX422vuzZ+jmw2GNBxxLGiuVHkvwFbDRbFY1GDRQC4eOsULtk2hUEQ4iuPnCCLRUUYhvj
"text/plain": [
"<Figure size 1800x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"shape = data.shape[0]\n",
"R_max = 300\n",
"N_theta = 300\n",
"theta = np.linspace(0, 2*np.pi, N_theta) \n",
"N_radii = 120\n",
"radii = R_max*1/1.05**np.arange(1, N_radii) ## we take a logarithmic range of radii\n",
"\n",
"N_p = 36 # angular frequency (number of dark (bright) lines)\n",
"\n",
"# center of the target (determined manually)\n",
"x_c = 345\n",
"y_c = 335\n",
"\n",
"plt.figure(figsize=(18,12))\n",
"plt.imshow(data, origin='lower')\n",
"for r in radii:\n",
"\n",
" freq = get_freq(r, N_p)\n",
" I,x,y = get_line(data,theta,r,x_c,y_c)\n",
" plt.plot(x,y)\n",
"\n",
"r = radii[10]\n",
"I,x,y = get_line(data,theta,r,x_c,y_c)\n",
"\n",
"p0 = [(I.max()-I.min())/2, (I.max() -(I.max()-I.min())/2)/5, -(I.max()-I.min())/2 ]\n",
"m,popt = fit_sinusoid(I,theta,p0)\n",
"\n",
"plt.figure(figsize=(18,10)) \n",
"plt.imshow(data)\n",
"ax = plt.gca() \n",
"ax.set_aspect(1) \n",
"plt.plot(x,y)\n",
"\n",
"\n",
"plt.figure(figsize=(18,10))\n",
"plt.plot(theta,I)\n",
"xnew = np.linspace(0,theta.max(),1000)\n",
"ynew = sinusoidal(xnew,*popt)\n",
"plt.plot(xnew,ynew)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "c457fdba",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Karthik\\AppData\\Local\\Temp\\ipykernel_13568\\853626961.py:77: RuntimeWarning: invalid value encountered in arccos\n",
" phi = np.arccos(freq_all/freq_c)\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x216e5ec6760>"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/plain": [
"<Figure size 640x480 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAE5EAAA3PCAYAAACjn/CuAAAAOXRFWHRTb2Z0d2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tatG/Xq1YtatWpFTk5OljcDAAAAAAAAAGBTatSosfF/JxKJWL16dSxfvjxWrFjxi9offzdEkFzJCJEDAAAAAAAAAAAAoFxZvXr1rwbIVa9ePRo1avSTXzYGAAAAAAAAAKB8ysnJidq1a0ft2rVj6623joULF8a6det+UjN//vyoVKlS1KpVq4y2rLhyy3oBAAAAAAAAAAAAAPhRYWFhLFy48Bd/v9VWW8Uuu+wiQA4AAAAAAAAAoAKqUaNG7LLLLrHVVlv94tjChQsjkUiUwVYVmxA5AAAAAAAAAAAAAMqNpUuXxoYNG37yd1tttVU0bNgwcnJyymgrAAAAAAAAAABKKycnJxo2bPiLILkNGzbE0qVLy2irikuIHAAAAAAAAAAAAADlQn5+fixZsuQnf1e9enUBcgAAAAAAAAAAm4kfg+SqV6/+k79fvHhx5Ofnl9FWFZMQOQAAAAAAAAAAAADKhRUrVkQikfjJ3zVq1EiAHAAAAAAAAADAZiQnJycaNWr0k79LJBKxYsWKMtqoYhIiBwAAAAAAAAAAAEC58PNfBK5bt27UqFGjjLYBAAAAAAAAACBTatSoEXXr1v3J3wmRKx4hcgAAAAAAAAAAAACUuby8vFi7du1P/q5evXpltA0AAAAAAAAAAJn2898NWbt2beTl5ZXRNhWPEDkAAAAAAAAAAAAAytyqVat+8ufc3NyoVatWGW0DAAAAAAAAAECm1apVK3JzfxqF9vPfIWHThMgBAAAAAAAAAAAAUOY2bNjwkz/Xrl07cnJyymgbAAAAAAAAAAAyLScn5xf/yODPf4eETRMiBwA
"text/plain": [
"<Figure size 6000x4200 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"lines = np.zeros((N_radii,2))\n",
"n=0\n",
"for r in radii:\n",
"\n",
" freq = N_p/(2*np.pi*r)\n",
" I,x,y = get_line(data,theta,r,x_c,y_c)\n",
"\n",
" if freq<0.45:\n",
" yhat = savgol_filter(I, 11, 2)\n",
" elif freq>=0.45:\n",
" yhat = savgol_filter(I, 15, 2) \n",
"\n",
" maximums = scipy.signal.argrelextrema(yhat, np.greater,order=2)\n",
" minimums = scipy.signal.argrelextrema(yhat, np.less,order=2)\n",
"\n",
"\n",
" m = (I[maximums].mean() - I[minimums].mean())/(I[maximums].mean() + I[minimums].mean())\n",
"\n",
" lines[n][0] = freq; lines[n][1] = m\n",
"\n",
" n=n+1\n",
"\n",
"plt.clf()\n",
"figure=plt.figure(figsize=(20,14),dpi=300)\n",
"ax = figure.add_subplot(111)\n",
"ax.set_xlabel('Cycles/pixel',fontsize=24)\n",
"ax.set_ylabel('MTF',fontsize=24)\n",
"# major_ticks = np.arange(0, 2,0.5)\n",
"# minor_ticks = np.arange(0, 2, 0.1)\n",
"# major_ticks_y = np.arange(0, 1.8,0.2)\n",
"# minor_ticks_y = np.arange(0, 1.8, 0.05)\n",
"# ax.set_xticks(major_ticks)\n",
"# ax.set_xticks(minor_ticks, minor = True)\n",
"# ax.set_yticks(major_ticks_y)\n",
"# ax.set_yticks(minor_ticks_y, minor = True)\n",
"ax.tick_params(axis = 'both', which = 'major', length=6, width=1,labelsize = 22)\n",
"ax.tick_params(axis = 'both', which = 'minor', length=3, width=1,labelsize=22)\n",
"\n",
"\n",
"freq_all = lines[:,0]\n",
"M_all = lines[:,1]\n",
"\n",
"# remove last outlier point\n",
"freq_all =freq_all[:-1]#/ 0.5\n",
"M_all = M_all[:-1]\n",
"#M_all =M_all/M_all.max()\n",
"\n",
"## fit MTF with a gaussian\n",
"p0_g = [1,0,0.5]\n",
"popt, pcov = curve_fit(Gaussian,freq_all[:100],M_all[:100],p0_g,maxfev=8000)\n",
"xnew = np.linspace(0,2,1000)\n",
"ynew = Gaussian(xnew,*popt)\n",
"\n",
"## perfect MTF (circular aperture, no aberrations):\n",
"\n",
"# D = \n",
"# f = \n",
"# f_stop = f/D\n",
"\n",
"NA = 0.6\n",
"lam = 532*10**(-6)\n",
"\n",
"#in pixels\n",
"# freq_c = 1/(lam * f_stop * 100)\n",
"\n",
"freq_c = (2*NA)/(lam * 100)\n",
"\n",
"#in arcsec\n",
"#freq_c = D/(1.22*lam*206265)\n",
"\n",
"## plot results\n",
"plt.plot(freq_all,M_all,label='Dark subtracted star modulation')\n",
"plt.plot(xnew,ynew,'r',label='Gaussian fit')\n",
"plt.axhline(y=0,linestyle='dashed',color='red')\n",
"\n",
"freq_all = np.arange(0.02, 2*freq_c, 0.01)\n",
"phi = np.arccos(freq_all/freq_c)\n",
"MTF_p = (2/np.pi)*(phi - (np.cos(phi))*np.sin(phi))\n",
"plt.plot(freq_all,MTF_p,label='Theoretical MTF for circular aperture',color='darkcyan',linestyle='-.',linewidth=3)\n",
"\n",
"ax.legend(loc='best',fancybox=True, handlelength=4,fontsize=22)\n",
"# ax.set_xlim(0,0.7)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}