Last active
January 16, 2023 18:17
-
-
Save jmeyers314/38db2fd38b064be1e12c2992ea9b3e2d to your computer and use it in GitHub Desktop.
FWHM response to annular Zernike wavefront error contribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "5593102c-fbd5-4b54-a0cc-59deea7e6981", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2023-01-16T18:16:37.989035Z", | |
"iopub.status.busy": "2023-01-16T18:16:37.987676Z", | |
"iopub.status.idle": "2023-01-16T18:16:41.216458Z", | |
"shell.execute_reply": "2023-01-16T18:16:41.214912Z", | |
"shell.execute_reply.started": "2023-01-16T18:16:37.988812Z" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import galsim" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "632f3690-27d5-4e94-997f-d20c048a9faf", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2023-01-16T18:16:43.719096Z", | |
"iopub.status.busy": "2023-01-16T18:16:43.718030Z", | |
"iopub.status.idle": "2023-01-16T18:16:43.735573Z", | |
"shell.execute_reply": "2023-01-16T18:16:43.734977Z", | |
"shell.execute_reply.started": "2023-01-16T18:16:43.719044Z" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"def dFWHMdZ(R_outer, R_inner, jmax):\n", | |
" \"\"\"\n", | |
" Params\n", | |
" ------\n", | |
" R_outer : float\n", | |
" Outer radius of entrance pupil annulus in meters\n", | |
" R_inner : float\n", | |
" Inner radius of entrance pupil annulus in meters\n", | |
" jmax : int\n", | |
" Maximum Noll index for which to compute dFWHM/dZ\n", | |
" \n", | |
" Returns\n", | |
" -------\n", | |
" dFWHMdZ : array of float\n", | |
" Derivative of FWHM wrt wavefront error given by annular Zernike coefficient.\n", | |
" Units are arcsec per micron. Indices run from 0 to jmax inclusive, though\n", | |
" results for indices 0-3 are not meaningful.\n", | |
" \"\"\"\n", | |
" out = np.zeros((jmax+1,))\n", | |
" for j in range(4, jmax+1):\n", | |
" coefs = [0]*j + [1]\n", | |
" Z = galsim.zernike.Zernike(coefs, R_outer=R_outer, R_inner=R_inner) \n", | |
" # (Annular) Zernikes are normalized to have rms of 1 over their domain\n", | |
" # So to get rms of Zernike series, just need the RSS of the coefficients. \n", | |
" # For the rms of the tilts, this is the RSS of the coefficients of the\n", | |
" # X/Y gradients expressed as Zernike series.\n", | |
" rms_tilt = np.sqrt(np.sum(Z.gradX.coef**2 + Z.gradY.coef**2)/2) \n", | |
" # Results are in radians per meter right now. Convert to arcsec per micron.\n", | |
" rms_tilt = np.rad2deg(rms_tilt*1e-6)*3600\n", | |
" # rms -> fwhm\n", | |
" fwhm_tilt = rms_tilt*2*np.sqrt(2*np.log(2))\n", | |
" out[j] = fwhm_tilt\n", | |
" return out" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "a517cb24-691b-4825-82c2-38f20b7ed96b", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2023-01-16T18:16:45.115281Z", | |
"iopub.status.busy": "2023-01-16T18:16:45.114476Z", | |
"iopub.status.idle": "2023-01-16T18:16:45.208174Z", | |
"shell.execute_reply": "2023-01-16T18:16:45.207709Z", | |
"shell.execute_reply.started": "2023-01-16T18:16:45.115247Z" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
" 4 3.395\n", | |
" 5 1.969\n", | |
" 6 1.969\n", | |
" 7 4.374\n", | |
" 8 4.374\n", | |
" 9 2.802\n", | |
"10 2.802\n", | |
"11 7.592\n", | |
"12 5.726\n", | |
"13 5.726\n", | |
"14 3.620\n", | |
"15 3.620\n", | |
"16 8.696\n", | |
"17 8.696\n", | |
"18 7.146\n", | |
"19 7.146\n", | |
"20 4.434\n", | |
"21 4.434\n", | |
"22 12.704\n", | |
"23 10.214\n", | |
"24 10.214\n", | |
"25 8.566\n", | |
"26 8.566\n", | |
"27 5.246\n", | |
"28 5.246\n", | |
"29 13.934\n", | |
"30 13.934\n", | |
"31 11.941\n", | |
"32 11.941\n", | |
"33 9.980\n", | |
"34 9.980\n", | |
"35 6.058\n", | |
"36 6.058\n", | |
"37 18.597\n" | |
] | |
} | |
], | |
"source": [ | |
"# AuxTel\n", | |
"for j, coef in enumerate(dFWHMdZ(0.6, 0.3525*0.6, 37)):\n", | |
" if j < 4: \n", | |
" continue\n", | |
" print(f\"{j:2d} {coef:6.3f}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "5db63649-e200-4ced-a077-13fc16f91775", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2023-01-16T18:16:46.344908Z", | |
"iopub.status.busy": "2023-01-16T18:16:46.343745Z", | |
"iopub.status.idle": "2023-01-16T18:16:46.443050Z", | |
"shell.execute_reply": "2023-01-16T18:16:46.442732Z", | |
"shell.execute_reply.started": "2023-01-16T18:16:46.344844Z" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
" 4 0.751\n", | |
" 5 0.271\n", | |
" 6 0.271\n", | |
" 7 0.819\n", | |
" 8 0.819\n", | |
" 9 0.396\n", | |
"10 0.396\n", | |
"11 1.679\n", | |
"12 0.937\n", | |
"13 0.937\n", | |
"14 0.517\n", | |
"15 0.517\n", | |
"16 1.755\n", | |
"17 1.755\n", | |
"18 1.089\n", | |
"19 1.089\n", | |
"20 0.635\n", | |
"21 0.635\n", | |
"22 2.810\n", | |
"23 1.869\n", | |
"24 1.869\n", | |
"25 1.263\n", | |
"26 1.263\n", | |
"27 0.752\n", | |
"28 0.752\n", | |
"29 2.894\n", | |
"30 2.894\n", | |
"31 2.015\n", | |
"32 2.015\n", | |
"33 1.450\n", | |
"34 1.450\n", | |
"35 0.869\n", | |
"36 0.869\n", | |
"37 4.113\n" | |
] | |
} | |
], | |
"source": [ | |
"# Rubin\n", | |
"for j, coef in enumerate(dFWHMdZ(4.18, 4.18*0.61, 37)):\n", | |
" if j < 4: \n", | |
" continue\n", | |
" print(f\"{j:2d} {coef:6.3f}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "f8e5911e-cef1-41c1-b9af-9ceae26fe6fd", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"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.10.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment