diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c90246b..226fa1a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort diff --git a/architect/libs/utillib.py b/architect/libs/utillib.py index 348e5c2..9fa1583 100644 --- a/architect/libs/utillib.py +++ b/architect/libs/utillib.py @@ -31,3 +31,43 @@ def hypercast(*arrays) -> list[np.ndarray]: hyperarrays.append(array_broadcasted) return hyperarrays + + +def orient_tensor(a, dim: int, dims: int) -> np.ndarray: + """Orient a tensor in a given dimensionality. + + Args: + a: array tensor. + dim: index of the dimension axis on which to orient the tensor. + dims: dimensionality of the tensor space. + + Returns: + The oriented tensor. + + """ + shape = [1] * dims + shape[dim] = -1 + + return np.reshape(a=a, newshape=shape) + + +def orient_and_broadcast(a, dim: int, shape) -> np.ndarray: + """Orient and broadcast a tensor into a given dimensionality. + + Args: + a: array tensor. + dim: index of the dimension axis on which to orient the tensor. + shape: dimensionality and size of broadcasted tensor. + + Returns: + The broadcasted tensor. + + """ + + a_oriented = orient_tensor(a=a, dim=dim, dims=len(shape)) + a_broadcasted = np.broadcast_to(array=a_oriented, shape=shape) + + if isinstance(a, Quantity): + a_broadcasted *= a.unit + + return a_broadcasted diff --git a/tradebooks/grism_efficency_vs_fringe_frequency.ipynb b/tradebooks/grism_efficency_vs_fringe_frequency.ipynb index 2f282a7..6b3b7dd 100644 --- a/tradebooks/grism_efficency_vs_fringe_frequency.ipynb +++ b/tradebooks/grism_efficency_vs_fringe_frequency.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ "import plot\n", "\n", "# project\n", - "from architect import components" + "from architect.systems.optical import diffractors" ] }, { @@ -40,18 +40,18 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "# region constant\n", - "\n", + "# region constants\n", "d = 2.5 * unit.mm\n", "n_2 = 1.52 * unit.dimensionless_unscaled\n", "n_g = 0.1 * unit.dimensionless_unscaled\n", "incident_angle = 60 * unit.rad\n", "# endregion\n", "\n", + "# region variables\n", "fringe_frequency = np.arange(start=10, stop=1200, step=10) * 1 / unit.mm\n", "# endregion" ] @@ -65,17 +65,18 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "# region components\n", - "diffractor = components.diffractors.VPHGrism(\n", + "diffractor = diffractors.VPHGrism(\n", " index_dcg_amplitude=n_g,\n", " index_dcg=n_2,\n", " dcg_thickness=d,\n", " fringe_frequency=fringe_frequency,\n", - ")" + ")\n", + "# endregion" ] }, { @@ -88,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -108,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -119,8 +120,8 @@ }, "data": [ { - "hovertemplate": "variable=Grism Efficiency
Fringe Frequency=%{x}
value=%{y}", - "legendgroup": "Grism Efficiency", + "hovertemplate": "Fringe Frequency [1 / mm]=%{x}
Grism Efficiency []=%{y}", + "legendgroup": "", "line": { "color": "#636efa", "dash": "solid" @@ -129,9 +130,9 @@ "symbol": "circle" }, "mode": "lines", - "name": "Grism Efficiency", + "name": "", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 10, @@ -298,7 +299,7 @@ 0.18283076476340177, 0.0849684972102143, 0.02225904188522381, - 1.3835855601248883e-05, + 0.000013835855601248883, 0.020117028987762953, 0.08086589807006146, 0.17711506600808222, @@ -341,7 +342,7 @@ 0.18571502331415382, 0.08705430775830264, 0.023369738066646835, - 5.5342656681394646e-05, + 0.000055342656681394646, 0.019085830818050105, 0.07884933652987386, 0.17428394212980192, @@ -381,9 +382,6 @@ ], "layout": { "legend": { - "title": { - "text": "variable" - }, "tracegroupgap": 0 }, "template": { @@ -391,14 +389,14 @@ "bar": [ { "error_x": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "error_y": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -414,7 +412,7 @@ { "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -429,18 +427,18 @@ "carpet": [ { "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "type": "carpet" } @@ -758,10 +756,10 @@ ], "scatter": [ { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 + "marker": { + "line": { + "color": "#283442" + } }, "type": "scatter" } @@ -808,9 +806,8 @@ "scattergl": [ { "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" + "line": { + "color": "#283442" } }, "type": "scattergl" @@ -915,18 +912,18 @@ { "cells": { "fill": { - "color": "#EBF0F8" + "color": "#506784" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "header": { "fill": { - "color": "#C8D4E3" + "color": "#2a3f5f" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "type": "table" @@ -935,7 +932,7 @@ }, "layout": { "annotationdefaults": { - "arrowcolor": "#2a3f5f", + "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1 }, @@ -1091,119 +1088,129 @@ "#FECB52" ], "font": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, - "subunitcolor": "white" + "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { - "style": "light" + "style": "dark" }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", "polar": { "angularaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "radialaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { - "color": "#2a3f5f" + "color": "#f2f5fa" } }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, "ternary": { "aaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, "baxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "caxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, "xaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { - "text": "Grism Efficiency versus Fringe Density" + "text": "Grism Efficiency vs. Fringe Density" }, "xaxis": { "anchor": "y", @@ -1212,7 +1219,7 @@ 1 ], "title": { - "text": "Fringe Frequency" + "text": "Fringe Frequency [1 / mm]" } }, "yaxis": { @@ -1222,7 +1229,7 @@ 1 ], "title": { - "text": "value" + "text": "Grism Efficiency []" } } } @@ -1252,8 +1259,8 @@ " \n", " \n", " \n", - " Fringe Frequency\n", - " Grism Efficiency\n", + " Fringe Frequency [1 / mm]\n", + " Grism Efficiency []\n", " \n", " \n", " \n", @@ -1318,18 +1325,18 @@ "" ], "text/plain": [ - " Fringe Frequency Grism Efficiency\n", - "0 10.0 0.021175\n", - "1 20.0 0.082906\n", - "2 30.0 0.179964\n", - "3 40.0 0.304129\n", - "4 50.0 0.444884\n", - ".. ... ...\n", - "114 1150.0 0.782782\n", - "115 1160.0 0.889536\n", - "116 1170.0 0.963297\n", - "117 1180.0 0.997817\n", - "118 1190.0 0.990173\n", + " Fringe Frequency [1 / mm] Grism Efficiency []\n", + "0 10.0 0.021175\n", + "1 20.0 0.082906\n", + "2 30.0 0.179964\n", + "3 40.0 0.304129\n", + "4 50.0 0.444884\n", + ".. ... ...\n", + "114 1150.0 0.782782\n", + "115 1160.0 0.889536\n", + "116 1170.0 0.963297\n", + "117 1180.0 0.997817\n", + "118 1190.0 0.990173\n", "\n", "[119 rows x 2 columns]" ] @@ -1339,21 +1346,24 @@ } ], "source": [ - "fringe_frequency_label = f\"Fringe Frequency\"\n", - "grism_efficiency_label = f\"Grism Efficiency\"\n", + "fringe_frequency_label = f\"Fringe Frequency [{fringe_frequency.unit}]\"\n", + "grism_efficiency_label = f\"Grism Efficiency [{efficiency.unit}]\"\n", + "\n", "data = {\n", " fringe_frequency_label: fringe_frequency[:],\n", " grism_efficiency_label: efficiency[:],\n", "}\n", "\n", "df = pd.DataFrame.from_dict(data=data)\n", + "\n", "graph = plot.line(\n", " df=df,\n", " x=fringe_frequency_label,\n", - " y=[grism_efficiency_label],\n", - " title=\"Grism Efficiency versus Fringe Density\",\n", - " dark=False,\n", + " y=grism_efficiency_label,\n", + " title=\"Grism Efficiency vs. Fringe Density\",\n", + " dark=True,\n", ")\n", + "\n", "graph.show()\n", "display(df)" ] @@ -1375,7 +1385,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { diff --git a/tradebooks/ground_target_error_tradebook.ipynb b/tradebooks/ground_target_error_tradebook.ipynb index f92ad43..c593063 100644 --- a/tradebooks/ground_target_error_tradebook.ipynb +++ b/tradebooks/ground_target_error_tradebook.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -26,19 +26,20 @@ "from IPython.display import display\n", "\n", "# project\n", - "from architect.systems.optical.spectrometers import HyperspectralImager" + "from architect.systems.optical import spectrometers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Setup" + "## Setup\n", + "Run this section onwards when a parameter is updated." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -61,11 +62,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ - "system = HyperspectralImager()" + "system = spectrometers.HyperspectralImager()" ] }, { @@ -77,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -92,33 +93,1229 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Plot" + "## Plots" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "Pointing Accuracy [deg]=%{x}
Ground Target Error [m]=%{y}", + "legendgroup": "", + "line": { + "color": "#636efa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 0.0001, + 0.0011, + 0.0021, + 0.0031, + 0.0041, + 0.0051, + 0.0061, + 0.0071, + 0.0081, + 0.0091, + 0.0101, + 0.011099999999999999, + 0.0121, + 0.0131, + 0.0141, + 0.015099999999999999, + 0.0161, + 0.0171, + 0.0181, + 0.0191, + 0.0201, + 0.0211, + 0.022099999999999998, + 0.0231, + 0.0241, + 0.0251, + 0.0261, + 0.0271, + 0.0281, + 0.0291, + 0.0301, + 0.0311, + 0.032100000000000004, + 0.033100000000000004, + 0.034100000000000005, + 0.035100000000000006, + 0.03610000000000001, + 0.0371, + 0.0381, + 0.0391, + 0.040100000000000004, + 0.041100000000000005, + 0.042100000000000005, + 0.043100000000000006, + 0.0441, + 0.0451, + 0.0461, + 0.0471, + 0.048100000000000004, + 0.049100000000000005, + 0.050100000000000006, + 0.051100000000000007, + 0.05210000000000001, + 0.0531, + 0.0541, + 0.0551, + 0.056100000000000004, + 0.057100000000000005, + 0.058100000000000006, + 0.05910000000000001, + 0.0601, + 0.0611, + 0.0621, + 0.0631, + 0.0641, + 0.0651, + 0.0661, + 0.0671, + 0.06810000000000001, + 0.06910000000000001, + 0.07010000000000001, + 0.07110000000000001, + 0.07210000000000001, + 0.0731, + 0.0741, + 0.0751, + 0.0761, + 0.0771, + 0.0781, + 0.0791, + 0.0801, + 0.0811, + 0.0821, + 0.08310000000000001, + 0.08410000000000001, + 0.08510000000000001, + 0.08610000000000001, + 0.08710000000000001, + 0.0881, + 0.0891, + 0.0901, + 0.0911, + 0.0921, + 0.0931, + 0.0941, + 0.0951, + 0.0961, + 0.0971, + 0.0981, + 0.09910000000000001 + ], + "xaxis": "x", + "y": [ + 0.872664625998051, + 9.599310887148205, + 18.325957154146597, + 27.052603432309798, + 35.77924972695439, + 44.50589604339695, + 53.232542386954044, + 61.95918876294227, + 70.68583517667817, + 79.41248163347838, + 88.13912813865942, + 96.86577469753786, + 105.59242131543036, + 114.31906799765342, + 123.04571474952363, + 131.77236157635758, + 140.49900848347187, + 149.22565547618308, + 157.95230255980775, + 166.67894973966244, + 175.4055970210638, + 184.13224440932834, + 192.8588919097727, + 201.58553952771345, + 210.3121872684671, + 219.03883513735033, + 227.7654831396797, + 236.4921312807717, + 245.218779565943, + 253.94542800051016, + 262.67207658978975, + 271.3987253390984, + 280.12537425375274, + 288.85202333906915, + 297.57867260036437, + 306.30532204295497, + 315.0319716721574, + 323.75862149328844, + 332.48527151166456, + 341.21192173260243, + 349.9385721614186, + 358.6652228034297, + 367.3918736639521, + 376.1185247483027, + 384.84517606179776, + 393.57182760975417, + 402.2984793974884, + 411.02513143031706, + 419.7517837135566, + 428.4784362525239, + 437.2050890525353, + 445.9317421189075, + 454.65839545695695, + 463.38504907200047, + 472.11170296935455, + 480.83835715433577, + 489.5650116322608, + 498.2916664084461, + 507.01832148820836, + 515.7449768768641, + 524.4716325797301, + 533.1982886021227, + 541.9249449493589, + 550.6516016267548, + 559.3782586396273, + 568.1049159932929, + 576.8315736930683, + 585.5582317442701, + 594.2848901522149, + 603.0115489222193, + 611.7382080595999, + 620.4648675696731, + 629.1915274577559, + 637.9181877291644, + 646.6448483892157, + 655.3715094432262, + 664.0981708965126, + 672.8248327543914, + 681.5514950221793, + 690.2781577051929, + 699.004820808749, + 707.7314843381636, + 716.4581482987539, + 725.1848126958365, + 733.911477534728, + 742.6381428207447, + 751.3648085592034, + 760.0914747554208, + 768.8181414147134, + 777.5448085423978, + 786.271476143791, + 794.9981442242093, + 803.7248127889693, + 812.451481843388, + 821.1781513927814, + 829.9048214424666, + 838.6314919977603, + 847.3581630639787, + 856.0848346464389, + 864.8115067504572 + ], + "yaxis": "y" + } + ], + "layout": { + "legend": { + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Ground Target Error vs. Relative Pointing Accuracy" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Pointing Accuracy [deg]" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Ground Target Error [m]" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Pointing Accuracy [deg]Ground Target Error [m]
00.00010.872665
10.00119.599311
20.002118.325957
30.003127.052603
40.004135.779250
.........
950.0951829.904821
960.0961838.631492
970.0971847.358163
980.0981856.084835
990.0991864.811507
\n", + "

100 rows × 2 columns

\n", + "
" + ], + "text/plain": [ + " Pointing Accuracy [deg] Ground Target Error [m]\n", + "0 0.0001 0.872665\n", + "1 0.0011 9.599311\n", + "2 0.0021 18.325957\n", + "3 0.0031 27.052603\n", + "4 0.0041 35.779250\n", + ".. ... ...\n", + "95 0.0951 829.904821\n", + "96 0.0961 838.631492\n", + "97 0.0971 847.358163\n", + "98 0.0981 856.084835\n", + "99 0.0991 864.811507\n", + "\n", + "[100 rows x 2 columns]" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "pointing_accuracy_label = f\"Pointing Accuracy [{pointing_accuracy.unit}]\"\n", "ground_target_error_label = f\"Ground Target Error [{ground_target_error.unit}]\"\n", "\n", "data = {\n", - " pointing_accuracy_label: pointing_accuracy,\n", - " ground_target_error_label: ground_target_error,\n", + " pointing_accuracy_label: pointing_accuracy[:],\n", + " ground_target_error_label: ground_target_error[:],\n", "}\n", "\n", "df = pd.DataFrame.from_dict(data=data)\n", - "fig = plot.line(\n", + "\n", + "graph = plot.line(\n", " df=df,\n", " x=pointing_accuracy_label,\n", " y=ground_target_error_label,\n", - " title=\"Ground Target Error vs Relative Pointing Accuracy\",\n", + " title=\"Ground Target Error vs. Relative Pointing Accuracy\",\n", " dark=True,\n", ")\n", "\n", - "fig.show()\n", + "graph.show()\n", "display(df)" ] }, @@ -153,7 +1350,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { diff --git a/tradebooks/sensor_wavelength_mapping.ipynb b/tradebooks/sensor_wavelength_mapping.ipynb index 4cce407..0cc4d7a 100644 --- a/tradebooks/sensor_wavelength_mapping.ipynb +++ b/tradebooks/sensor_wavelength_mapping.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -21,8 +21,13 @@ "from IPython.display import display\n", "\n", "# project\n", - "from architect import components, systems\n", - "from architect.libs import utillib" + "from architect.systems.optical import (\n", + " diffractors,\n", + " foreoptics,\n", + " lenses,\n", + " masks,\n", + " spectrometers,\n", + ")" ] }, { @@ -42,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -64,25 +69,25 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# region components\n", - "foreoptic = components.foreoptics.Chromar()\n", - "slit = components.masks.RectSlit()\n", - "collimator = components.lenses.Lens()\n", - "grism = components.diffractors.VPHGrism(\n", + "foreoptic = foreoptics.Foreoptic()\n", + "slit = masks.RectSlit()\n", + "collimator = lenses.Lens()\n", + "grism = diffractors.VPHGrism(\n", " fringe_frequency=fringe_frequency,\n", " apex_angle=45 * unit.deg,\n", " index_prism=1,\n", " index_seal=1,\n", ")\n", - "focuser = components.lenses.Lens(focal_length=0.5 * unit.mm)\n", + "focuser = lenses.Lens(focal_length=0.5 * unit.mm)\n", "# endregion\n", "\n", "# region systems\n", - "payload = systems.spectrometers.FINCHEye(\n", + "payload = spectrometers.FINCHEye(\n", " foreoptic=foreoptic,\n", " slit=slit,\n", " collimator=collimator,\n", @@ -102,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -131,7 +136,7 @@ }, "data": [ { - "hovertemplate": "Wavelength (nm)=%{x}
Sensor Height (mm)=%{y}", + "hovertemplate": "Wavelength [nm]=%{x}
Sensor Height [mm]=%{y}", "legendgroup": "", "line": { "color": "#636efa", @@ -1762,14 +1767,14 @@ "bar": [ { "error_x": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "error_y": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -1785,7 +1790,7 @@ { "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -1800,18 +1805,18 @@ "carpet": [ { "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "type": "carpet" } @@ -2129,10 +2134,10 @@ ], "scatter": [ { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 + "marker": { + "line": { + "color": "#283442" + } }, "type": "scatter" } @@ -2179,9 +2184,8 @@ "scattergl": [ { "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" + "line": { + "color": "#283442" } }, "type": "scattergl" @@ -2286,18 +2290,18 @@ { "cells": { "fill": { - "color": "#EBF0F8" + "color": "#506784" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "header": { "fill": { - "color": "#C8D4E3" + "color": "#2a3f5f" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "type": "table" @@ -2306,7 +2310,7 @@ }, "layout": { "annotationdefaults": { - "arrowcolor": "#2a3f5f", + "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1 }, @@ -2462,119 +2466,129 @@ "#FECB52" ], "font": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, - "subunitcolor": "white" + "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { - "style": "light" + "style": "dark" }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", "polar": { "angularaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "radialaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { - "color": "#2a3f5f" + "color": "#f2f5fa" } }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, "ternary": { "aaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, "baxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "caxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, "xaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { - "text": "Sensor Height v/s Wavelength" + "text": "Sensor Height vs. Wavelength" }, "xaxis": { "anchor": "y", @@ -2583,7 +2597,7 @@ 1 ], "title": { - "text": "Wavelength (nm)" + "text": "Wavelength [nm]" } }, "yaxis": { @@ -2593,7 +2607,7 @@ 1 ], "title": { - "text": "Sensor Height (mm)" + "text": "Sensor Height [mm]" } } } @@ -2623,8 +2637,8 @@ " \n", " \n", " \n", - " Wavelength (nm)\n", - " Sensor Height (mm)\n", + " Wavelength [nm]\n", + " Sensor Height [mm]\n", " \n", " \n", " \n", @@ -2689,7 +2703,7 @@ "" ], "text/plain": [ - " Wavelength (nm) Sensor Height (mm)\n", + " Wavelength [nm] Sensor Height [mm]\n", "0 900.0 -0.311110\n", "1 901.0 -0.311589\n", "2 902.0 -0.312070\n", @@ -2710,8 +2724,8 @@ } ], "source": [ - "wavelength_label = f\"Wavelength (nm)\"\n", - "sensor_height_label = f\"Sensor Height (mm)\"\n", + "wavelength_label = f\"Wavelength [{wavelength.unit}]\"\n", + "sensor_height_label = f\"Sensor Height [{sensor_height.unit}]\"\n", "\n", "data = {\n", " wavelength_label: wavelength[:],\n", @@ -2724,8 +2738,8 @@ " df=df,\n", " x=wavelength_label,\n", " y=sensor_height_label,\n", - " title=\"Sensor Height v/s Wavelength\",\n", - " dark=False,\n", + " title=\"Sensor Height vs. Wavelength\",\n", + " dark=True,\n", ")\n", "\n", "graph.show()\n", @@ -2749,7 +2763,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { diff --git a/tradebooks/snr.ipynb b/tradebooks/snr.ipynb index e7206fa..4b03561 100644 --- a/tradebooks/snr.ipynb +++ b/tradebooks/snr.ipynb @@ -7,13 +7,6 @@ "# SNR vs Wavelengths (900 - 1700 nm)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Setup" - ] - }, { "cell_type": "code", "execution_count": 1, @@ -33,10 +26,17 @@ "\n", "# project\n", "from architect import luts\n", - "from architect.libs import utillib\n", "from architect.systems.optical import foreoptics, masks, sensors, spectrometers" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Setup\n", + "Run this section onwards when a parameter is updated." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -50,10 +50,9 @@ "metadata": {}, "outputs": [], "source": [ - "# constants\n", - "\n", - "# variables\n", - "wavelength = np.arange(start=900, stop=1700, step=25) * unit.nm" + "# region variables\n", + "wavelength = np.arange(start=900, stop=1700, step=25) * unit.nm\n", + "# endregion" ] }, { @@ -69,17 +68,19 @@ "metadata": {}, "outputs": [], "source": [ - "# components\n", + "# region components\n", "sensor = sensors.TauSWIR()\n", "foreoptic = foreoptics.Foreoptic(\n", " focal_length=100 * unit.mm, diameter=35 * unit.mm, image_diameter=10 * unit.mm\n", ")\n", "slit = masks.RectSlit(size=(1 * unit.mm, 20 * unit.mm))\n", + "# endregion\n", "\n", - "# systems\n", + "# region systems\n", "payload = spectrometers.HyperspectralImager(\n", " sensor=sensor, foreoptic=foreoptic, slit=slit\n", - ")" + ")\n", + "# endregion" ] }, { @@ -140,7 +141,7 @@ }, "data": [ { - "hovertemplate": "Wavelengths=%{x}
SNR=%{y}", + "hovertemplate": "Wavelengths [nm]=%{x}
SNR []=%{y}", "legendgroup": "", "line": { "color": "#636efa", @@ -235,14 +236,14 @@ "bar": [ { "error_x": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "error_y": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -258,7 +259,7 @@ { "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -273,18 +274,18 @@ "carpet": [ { "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "type": "carpet" } @@ -602,10 +603,10 @@ ], "scatter": [ { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 + "marker": { + "line": { + "color": "#283442" + } }, "type": "scatter" } @@ -652,9 +653,8 @@ "scattergl": [ { "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" + "line": { + "color": "#283442" } }, "type": "scattergl" @@ -759,18 +759,18 @@ { "cells": { "fill": { - "color": "#EBF0F8" + "color": "#506784" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "header": { "fill": { - "color": "#C8D4E3" + "color": "#2a3f5f" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "type": "table" @@ -779,7 +779,7 @@ }, "layout": { "annotationdefaults": { - "arrowcolor": "#2a3f5f", + "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1 }, @@ -935,119 +935,129 @@ "#FECB52" ], "font": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, - "subunitcolor": "white" + "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { - "style": "light" + "style": "dark" }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", "polar": { "angularaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "radialaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { - "color": "#2a3f5f" + "color": "#f2f5fa" } }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, "ternary": { "aaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, "baxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "caxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, "xaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "title": { - "text": "SNR versus Wavelengths" + "text": "SNR vs. Wavelengths" }, "xaxis": { "anchor": "y", @@ -1056,7 +1066,7 @@ 1 ], "title": { - "text": "Wavelengths" + "text": "Wavelengths [nm]" } }, "yaxis": { @@ -1066,7 +1076,7 @@ 1 ], "title": { - "text": "SNR" + "text": "SNR []" } } } @@ -1096,8 +1106,8 @@ " \n", " \n", " \n", - " Wavelengths\n", - " SNR\n", + " Wavelengths [nm]\n", + " SNR []\n", " \n", " \n", " \n", @@ -1266,39 +1276,39 @@ "" ], "text/plain": [ - " Wavelengths SNR\n", - "0 900.0 188.531710\n", - "1 925.0 234.440639\n", - "2 950.0 152.394612\n", - "3 975.0 259.417087\n", - "4 1000.0 352.754914\n", - "5 1025.0 330.737355\n", - "6 1050.0 305.680311\n", - "7 1075.0 271.573063\n", - "8 1100.0 209.625120\n", - "9 1125.0 76.595719\n", - "10 1150.0 90.342279\n", - "11 1175.0 159.867381\n", - "12 1200.0 156.744057\n", - "13 1225.0 168.617259\n", - "14 1250.0 163.347480\n", - "15 1275.0 140.412845\n", - "16 1300.0 130.627403\n", - "17 1325.0 96.983911\n", - "18 1350.0 26.571521\n", - "19 1375.0 13.750956\n", - "20 1400.0 11.952794\n", - "21 1425.0 21.395375\n", - "22 1450.0 26.481642\n", - "23 1475.0 42.954339\n", - "24 1500.0 64.154504\n", - "25 1525.0 74.058795\n", - "26 1550.0 75.042837\n", - "27 1575.0 64.684128\n", - "28 1600.0 61.530669\n", - "29 1625.0 57.798496\n", - "30 1650.0 49.053235\n", - "31 1675.0 42.764089" + " Wavelengths [nm] SNR []\n", + "0 900.0 188.531710\n", + "1 925.0 234.440639\n", + "2 950.0 152.394612\n", + "3 975.0 259.417087\n", + "4 1000.0 352.754914\n", + "5 1025.0 330.737355\n", + "6 1050.0 305.680311\n", + "7 1075.0 271.573063\n", + "8 1100.0 209.625120\n", + "9 1125.0 76.595719\n", + "10 1150.0 90.342279\n", + "11 1175.0 159.867381\n", + "12 1200.0 156.744057\n", + "13 1225.0 168.617259\n", + "14 1250.0 163.347480\n", + "15 1275.0 140.412845\n", + "16 1300.0 130.627403\n", + "17 1325.0 96.983911\n", + "18 1350.0 26.571521\n", + "19 1375.0 13.750956\n", + "20 1400.0 11.952794\n", + "21 1425.0 21.395375\n", + "22 1450.0 26.481642\n", + "23 1475.0 42.954339\n", + "24 1500.0 64.154504\n", + "25 1525.0 74.058795\n", + "26 1550.0 75.042837\n", + "27 1575.0 64.684128\n", + "28 1600.0 61.530669\n", + "29 1625.0 57.798496\n", + "30 1650.0 49.053235\n", + "31 1675.0 42.764089" ] }, "metadata": {}, @@ -1306,22 +1316,25 @@ } ], "source": [ - "wavelength_label = f\"Wavelengths\"\n", - "snr_label = f\"SNR\"\n", + "wavelength_label = f\"Wavelengths [{wavelength.unit}]\"\n", + "snr_label = f\"SNR [{snr.unit}]\"\n", + "\n", "data = {\n", " wavelength_label: wavelength[:],\n", " snr_label: snr[:],\n", "}\n", "\n", "df = pd.DataFrame.from_dict(data=data)\n", - "fig = plot.line(\n", + "\n", + "graph = plot.line(\n", " df=df,\n", " x=wavelength_label,\n", " y=snr_label,\n", - " title=\"SNR versus Wavelengths\",\n", - " dark=False,\n", + " title=\"SNR vs. Wavelengths\",\n", + " dark=True,\n", ")\n", - "fig.show()\n", + "\n", + "graph.show()\n", "display(df)" ] }, @@ -1331,19 +1344,14 @@ "metadata": {}, "outputs": [ { - "ename": "ValueError", - "evalue": "\nImage export using the \"kaleido\" engine requires the kaleido package,\nwhich can be installed using pip:\n $ pip install -U kaleido\n", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32mc:\\Users\\David\\Workbench\\payload-designer\\tradebooks\\snr.ipynb Cell 12\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m output_path\u001b[39m.\u001b[39mmkdir(parents\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m, exist_ok\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n\u001b[0;32m 5\u001b[0m df\u001b[39m.\u001b[39mto_csv(output_path \u001b[39m/\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mdata.csv\u001b[39m\u001b[39m\"\u001b[39m, index\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m)\n\u001b[1;32m----> 6\u001b[0m plot\u001b[39m.\u001b[39;49msave(fig\u001b[39m=\u001b[39;49mfig, name\u001b[39m=\u001b[39;49mfile_name, path\u001b[39m=\u001b[39;49moutput_path)\n", - "File \u001b[1;32mc:\\Users\\David\\Workbench\\payload-designer\\.venv\\lib\\site-packages\\plot\\functions.py:291\u001b[0m, in \u001b[0;36msave\u001b[1;34m(fig, name, path)\u001b[0m\n\u001b[0;32m 287\u001b[0m timestamp \u001b[39m=\u001b[39m datetime\u001b[39m.\u001b[39mnow()\u001b[39m.\u001b[39mstrftime(\u001b[39m\"\u001b[39m\u001b[39m%\u001b[39m\u001b[39mY-\u001b[39m\u001b[39m%\u001b[39m\u001b[39mm-\u001b[39m\u001b[39m%d\u001b[39;00m\u001b[39m_\u001b[39m\u001b[39m%\u001b[39m\u001b[39mH:\u001b[39m\u001b[39m%\u001b[39m\u001b[39mM:\u001b[39m\u001b[39m%\u001b[39m\u001b[39mS.\u001b[39m\u001b[39m%f\u001b[39;00m\u001b[39m\"\u001b[39m)\n\u001b[0;32m 289\u001b[0m filepath \u001b[39m=\u001b[39m path \u001b[39m/\u001b[39m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mname\u001b[39m}\u001b[39;00m\u001b[39m_\u001b[39m\u001b[39m{\u001b[39;00mtimestamp\u001b[39m}\u001b[39;00m\u001b[39m.png\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m--> 291\u001b[0m fig\u001b[39m.\u001b[39;49mwrite_image(filepath)\n\u001b[0;32m 293\u001b[0m LOG\u001b[39m.\u001b[39minfo(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mSaved figure to \u001b[39m\u001b[39m{\u001b[39;00mfilepath\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m)\n", - "File \u001b[1;32mc:\\Users\\David\\Workbench\\payload-designer\\.venv\\lib\\site-packages\\plotly\\basedatatypes.py:3829\u001b[0m, in \u001b[0;36mBaseFigure.write_image\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 3769\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 3770\u001b[0m \u001b[39mConvert a figure to a static image and write it to a file or writeable\u001b[39;00m\n\u001b[0;32m 3771\u001b[0m \u001b[39mobject\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3825\u001b[0m \u001b[39mNone\u001b[39;00m\n\u001b[0;32m 3826\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 3827\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mplotly\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mio\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mpio\u001b[39;00m\n\u001b[1;32m-> 3829\u001b[0m \u001b[39mreturn\u001b[39;00m pio\u001b[39m.\u001b[39mwrite_image(\u001b[39mself\u001b[39m, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n", - "File \u001b[1;32mc:\\Users\\David\\Workbench\\payload-designer\\.venv\\lib\\site-packages\\plotly\\io\\_kaleido.py:267\u001b[0m, in \u001b[0;36mwrite_image\u001b[1;34m(fig, file, format, scale, width, height, validate, engine)\u001b[0m\n\u001b[0;32m 251\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 252\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 253\u001b[0m \u001b[39mCannot infer image type from output path '{file}'.\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 261\u001b[0m )\n\u001b[0;32m 262\u001b[0m )\n\u001b[0;32m 264\u001b[0m \u001b[39m# Request image\u001b[39;00m\n\u001b[0;32m 265\u001b[0m \u001b[39m# -------------\u001b[39;00m\n\u001b[0;32m 266\u001b[0m \u001b[39m# Do this first so we don't create a file if image conversion fails\u001b[39;00m\n\u001b[1;32m--> 267\u001b[0m img_data \u001b[39m=\u001b[39m to_image(\n\u001b[0;32m 268\u001b[0m fig,\n\u001b[0;32m 269\u001b[0m \u001b[39mformat\u001b[39;49m\u001b[39m=\u001b[39;49m\u001b[39mformat\u001b[39;49m,\n\u001b[0;32m 270\u001b[0m scale\u001b[39m=\u001b[39;49mscale,\n\u001b[0;32m 271\u001b[0m width\u001b[39m=\u001b[39;49mwidth,\n\u001b[0;32m 272\u001b[0m height\u001b[39m=\u001b[39;49mheight,\n\u001b[0;32m 273\u001b[0m validate\u001b[39m=\u001b[39;49mvalidate,\n\u001b[0;32m 274\u001b[0m engine\u001b[39m=\u001b[39;49mengine,\n\u001b[0;32m 275\u001b[0m )\n\u001b[0;32m 277\u001b[0m \u001b[39m# Open file\u001b[39;00m\n\u001b[0;32m 278\u001b[0m \u001b[39m# ---------\u001b[39;00m\n\u001b[0;32m 279\u001b[0m \u001b[39mif\u001b[39;00m path \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 280\u001b[0m \u001b[39m# We previously failed to make sense of `file` as a pathlib object.\u001b[39;00m\n\u001b[0;32m 281\u001b[0m \u001b[39m# Attempt to write to `file` as an open file descriptor.\u001b[39;00m\n", - "File \u001b[1;32mc:\\Users\\David\\Workbench\\payload-designer\\.venv\\lib\\site-packages\\plotly\\io\\_kaleido.py:133\u001b[0m, in \u001b[0;36mto_image\u001b[1;34m(fig, format, width, height, scale, validate, engine)\u001b[0m\n\u001b[0;32m 131\u001b[0m \u001b[39m# Raise informative error message if Kaleido is not installed\u001b[39;00m\n\u001b[0;32m 132\u001b[0m \u001b[39mif\u001b[39;00m scope \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m--> 133\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 134\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 135\u001b[0m \u001b[39mImage export using the \"kaleido\" engine requires the kaleido package,\u001b[39;00m\n\u001b[0;32m 136\u001b[0m \u001b[39mwhich can be installed using pip:\u001b[39;00m\n\u001b[0;32m 137\u001b[0m \u001b[39m $ pip install -U kaleido\u001b[39;00m\n\u001b[0;32m 138\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 139\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[39m# Validate figure\u001b[39;00m\n\u001b[0;32m 142\u001b[0m \u001b[39m# ---------------\u001b[39;00m\n\u001b[0;32m 143\u001b[0m fig_dict \u001b[39m=\u001b[39m validate_coerce_fig_to_dict(fig, validate)\n", - "\u001b[1;31mValueError\u001b[0m: \nImage export using the \"kaleido\" engine requires the kaleido package,\nwhich can be installed using pip:\n $ pip install -U kaleido\n" - ] + "data": { + "text/plain": [ + "WindowsPath('output/snr_tradebook/snr_tradebook_2023-11-30_15-28-39-332675.html')" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -1352,7 +1360,7 @@ "output_path.mkdir(parents=True, exist_ok=True)\n", "\n", "df.to_csv(output_path / \"data.csv\", index=False)\n", - "plot.save(fig=fig, name=file_name, path=output_path)" + "plot.save(fig=graph, name=file_name, path=output_path)" ] } ], @@ -1372,7 +1380,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { diff --git a/tradebooks/spatial_resolution_&_swath_vs_focal_length_trade.ipynb b/tradebooks/spatial_resolution_&_swath_vs_focal_length_trade.ipynb index fc956d4..5e2a9d2 100644 --- a/tradebooks/spatial_resolution_&_swath_vs_focal_length_trade.ipynb +++ b/tradebooks/spatial_resolution_&_swath_vs_focal_length_trade.ipynb @@ -25,15 +25,16 @@ "from IPython.display import display\n", "\n", "# project\n", - "from architect import components, systems\n", - "from architect.libs import utillib" + "from architect.libs.utillib import orient_and_broadcast\n", + "from architect.systems.optical import foreoptics, masks, sensors, spectrometers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Setup" + "## Setup\n", + "Run this section onwards when a parameter is updated." ] }, { @@ -59,21 +60,22 @@ "metadata": {}, "outputs": [], "source": [ - "# constants\n", + "# region constants\n", "orbital_altitude = 550 * unit.km\n", "foreoptic_diameter = 44 * unit.mm\n", "skew_angle = np.array([0, 0]) * unit.deg\n", "slit_size = np.array([3, 1]) * unit.mm\n", "target_wavelength = 1300 * unit.nm\n", + "# endregion\n", "\n", - "# variables\n", + "# region variables\n", "focal_length = np.arange(start=10, stop=300, step=10) * unit.mm\n", + "# endregion\n", "\n", - "# vectorization\n", + "# region vectorization\n", "parameter_space_shape = (focal_length.size, slit_size.size)\n", - "focal_length = utillib.orient_and_broadcast(\n", - " a=focal_length, dim=0, shape=parameter_space_shape\n", - ")" + "focal_length = orient_and_broadcast(a=focal_length, dim=0, shape=parameter_space_shape)\n", + "# endregion" ] }, { @@ -89,19 +91,17 @@ "metadata": {}, "outputs": [], "source": [ - "# components\n", - "sensor = components.sensors.TauSWIR()\n", + "# region components\n", + "sensor = sensors.TauSWIR()\n", + "foreoptic = foreoptics.Foreoptic(diameter=foreoptic_diameter, focal_length=focal_length)\n", + "slit = masks.RectSlit(size=slit_size)\n", + "# endregion\n", "\n", - "foreoptic = components.foreoptics.Foreoptic(\n", - " diameter=foreoptic_diameter, focal_length=focal_length\n", - ")\n", - "\n", - "slit = components.masks.RectSlit(size=slit_size)\n", - "\n", - "# systems\n", - "payload = systems.spectrometers.HyperspectralImager(\n", + "# region systems\n", + "payload = spectrometers.HyperspectralImager(\n", " sensor=sensor, foreoptic=foreoptic, slit=slit\n", - ")" + ")\n", + "# endregion" ] }, { @@ -125,13 +125,6 @@ "metadata": {}, "output_type": "display_data" }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError. [astropy.units.quantity]\n" - ] - }, { "data": { "text/plain": [ @@ -424,9 +417,6 @@ }, "tracegroupgap": 0 }, - "margin": { - "t": 60 - }, "template": { "data": { "bar": [ @@ -1252,6 +1242,9 @@ } } }, + "title": { + "text": "Spatial Resolution and Swath vs. Focal Length" + }, "xaxis": { "anchor": "y", "domain": [ @@ -1614,15 +1607,50 @@ " None\n", " \n", " \n", - " components\n", + " systems\n", " list [4]\n", " None\n", " \n", + " \n", + " dimensions\n", + " None\n", + " None\n", + " \n", + " \n", + " mass\n", + " None\n", + " None\n", + " \n", + " \n", + " volume\n", + " None\n", + " None\n", + " \n", + " \n", + " density\n", + " None\n", + " None\n", + " \n", + " \n", + " index\n", + " None\n", + " None\n", + " \n", + " \n", + " transmittance\n", + " None\n", + " None\n", + " \n", + " \n", + " spatial_resolution\n", + " None\n", + " None\n", + " \n", " \n", "" ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -1646,7 +1674,8 @@ "}\n", "\n", "df = pd.DataFrame.from_dict(data=data)\n", - "fig = plot.line(\n", + "\n", + "graph = plot.line(\n", " df=df,\n", " x=focal_length_label,\n", " y=[\n", @@ -1654,16 +1683,16 @@ " swath_label_x,\n", " swath_label_y,\n", " ],\n", - " title=None,\n", + " title=\"Spatial Resolution and Swath vs. Focal Length\",\n", " dark=True,\n", ")\n", + "\n", "df.to_csv(output_dir / \"data.csv\", index=False)\n", "plot.save(\n", - " fig=fig, name=\"spatial_resolution_&_swath_vs_focal_length_trade\", path=output_dir\n", + " fig=graph, name=\"spatial_resolution_&_swath_vs_focal_length_trade\", path=output_dir\n", ")\n", "\n", - "\n", - "fig.show()\n", + "graph.show()\n", "display(df)\n", "display(payload)" ] @@ -1685,7 +1714,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { diff --git a/tradebooks/spectral_resolution_&_efficiency_vs_grism_resolvance_.ipynb b/tradebooks/spectral_resolution_&_efficiency_vs_grism_resolvance_.ipynb index 33669ed..37da53a 100644 --- a/tradebooks/spectral_resolution_&_efficiency_vs_grism_resolvance_.ipynb +++ b/tradebooks/spectral_resolution_&_efficiency_vs_grism_resolvance_.ipynb @@ -21,8 +21,7 @@ "from IPython.display import display\n", "\n", "# project\n", - "from architect import components, systems\n", - "from architect.libs import utillib" + "from architect.systems.optical import diffractors, sensors, spectrometers" ] }, { @@ -68,19 +67,17 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# region components\n", - "sensor = components.sensors.TauSWIR()\n", - "diffractor = components.diffractors.VPHGrism(fringe_frequency=fringe_frequency)\n", + "sensor = sensors.TauSWIR()\n", + "diffractor = diffractors.VPHGrism(fringe_frequency=fringe_frequency)\n", "# endregion\n", "\n", "# region systems\n", - "payload = systems.spectrometers.HyperspectralImager(\n", - " sensor=sensor, diffractor=diffractor\n", - ")\n", + "payload = spectrometers.HyperspectralImager(sensor=sensor, diffractor=diffractor)\n", "# endregion" ] }, @@ -93,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -124,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -399,22 +396,19 @@ "legend": { "tracegroupgap": 0 }, - "margin": { - "t": 60 - }, "template": { "data": { "bar": [ { "error_x": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "error_y": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -430,7 +424,7 @@ { "marker": { "line": { - "color": "#E5ECF6", + "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { @@ -445,18 +439,18 @@ "carpet": [ { "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" }, "type": "carpet" } @@ -774,10 +768,10 @@ ], "scatter": [ { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 + "marker": { + "line": { + "color": "#283442" + } }, "type": "scatter" } @@ -824,9 +818,8 @@ "scattergl": [ { "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" + "line": { + "color": "#283442" } }, "type": "scattergl" @@ -931,18 +924,18 @@ { "cells": { "fill": { - "color": "#EBF0F8" + "color": "#506784" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "header": { "fill": { - "color": "#C8D4E3" + "color": "#2a3f5f" }, "line": { - "color": "white" + "color": "rgb(17,17,17)" } }, "type": "table" @@ -951,7 +944,7 @@ }, "layout": { "annotationdefaults": { - "arrowcolor": "#2a3f5f", + "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1 }, @@ -1107,117 +1100,130 @@ "#FECB52" ], "font": { - "color": "#2a3f5f" + "color": "#f2f5fa" }, "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, - "subunitcolor": "white" + "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { - "style": "light" + "style": "dark" }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", "polar": { "angularaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "radialaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" }, "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#506784", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { - "color": "#2a3f5f" + "color": "#f2f5fa" } }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, "ternary": { "aaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, "baxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "rgb(17,17,17)", "caxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#506784", + "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, "xaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#283442", + "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, + "title": { + "text": "Spatial Resolution and Efficiency vs. Grism Resolvance" + }, "xaxis": { "anchor": "y", "domain": [ @@ -1366,8 +1372,8 @@ " df=df,\n", " x=fringe_frequency_label,\n", " y=spectral_reolution_label,\n", - " title=None,\n", - " dark=False,\n", + " title=\"Spatial Resolution and Efficiency vs. Grism Resolvance\",\n", + " dark=True,\n", ")\n", "\n", "graph.show()\n", @@ -1391,7 +1397,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.10.2" }, "orig_nbformat": 4, "vscode": {