Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zkbt/8356845f54e31f12213224bf959e54ac to your computer and use it in GitHub Desktop.
Save zkbt/8356845f54e31f12213224bf959e54ac to your computer and use it in GitHub Desktop.
Shared Wavelength Bins for the `ers-transit` Data Challenge
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "7a56c7a0",
"metadata": {},
"source": [
"# Shared Wavelength Bins for the `ers-transit` Data Challenge\n",
"\n",
"This notebook states what wavelength bins should be used for the ers-transit Data Challenge with Simluated Data, if you want to be able to compare your results directly with others'. The aim is to provide wavelength grids that are (a) easy to implement by simply binning together a fixed number of pixels and (b) provide a similar median effective spectral resolution across all four instruments."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "78e32ff4",
"metadata": {},
"outputs": [],
"source": [
"from chromatic import *"
]
},
{
"cell_type": "markdown",
"id": "fde4c140",
"metadata": {},
"source": [
"Let's load the extracted 1D time-series spectra for all four instruments."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8aa1ff3d",
"metadata": {},
"outputs": [],
"source": [
"instruments = ['MIRI', 'NIRCam', 'NIRSpec', 'NIRISS-O1', 'NIRISS-O2']\n",
"rainbows = {k:Rainbow(f'{k}.rainbow.npy') for k in instruments}"
]
},
{
"cell_type": "markdown",
"id": "56f17f81",
"metadata": {},
"source": [
"Let's define a function that will summarize the wavelength bins for a particular instrument."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "0daa51b3",
"metadata": {},
"outputs": [],
"source": [
"def describe_wavelength_bins(k, target_median_R=80):\n",
" '''\n",
" Parameters\n",
" ----------\n",
" k : str\n",
" The name of the instrument/order.\n",
" target_median_R : float\n",
" The target median spectral resolution. \n",
" '''\n",
" rainbow = rainbows[k]\n",
" \n",
" # get the single-pixel resolution of the dataset\n",
" R = rainbow.get_spectral_resolution(pixels_per_resolution_element=1)\n",
" \n",
" # calculate number of pixels to bin by to achieve target median resolution\n",
" npixels = int(np.median(R)/target_median_R)\n",
"\n",
" # calculate the adjusted resolution and number of bins\n",
" adjusted_R = rainbow.get_spectral_resolution(pixels_per_resolution_element=npixels)\n",
" nbins = int(len(rainbow.wavelength)/npixels)\n",
" \n",
" # figure out the bin indices\n",
" i = np.arange(rainbow.nwave)\n",
" if rainbow.wavelength[0] > rainbow.wavelength[-1]:\n",
" direction = 'decrease'\n",
" else:\n",
" direction = 'increase'\n",
" left_indices = i[::npixels]\n",
" right_indices = i[npixels::npixels]\n",
" \n",
" # make sure there are the same number of left and right edges\n",
" left_indices = left_indices[:len(right_indices)]\n",
" \n",
" # define a short cut \n",
" def copy_pastable_integers(x):\n",
" return '[' + ','.join(map(str,x)) + ']'\n",
"\n",
" def copy_pastable_quantities(x):\n",
" return '[' + ','.join(map(str,x.value)) + f']*u.Unit(\"{x.unit}\")'\n",
" \n",
" print(f'''\n",
"{'*'*(len(k)+4)}\n",
"* {k} * \n",
"{'*'*(len(k)+4)}\n",
"\n",
"⧲⧲⧲ Please bin by {npixels} pixels (={nbins} bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R={np.median(adjusted_R):.1f},\n",
"ranging from R={min(adjusted_R):.1f} to R={max(adjusted_R):.1f}.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"{copy_pastable_integers(left_indices)}\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"{copy_pastable_integers(right_indices)}\n",
"\n",
"For this instrument, wavelengths *{direction}* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"{copy_pastable_quantities(rainbow.wavelength[left_indices])}\n",
"\n",
"and\n",
"\n",
"{copy_pastable_quantities(rainbow.wavelength[right_indices])}\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" ''')"
]
},
{
"cell_type": "markdown",
"id": "812868b9",
"metadata": {},
"source": [
"## NIRSpec/PRISM\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "8970c9a7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"***********\n",
"* NIRSpec * \n",
"***********\n",
"\n",
"⧲⧲⧲ Please bin by 3 pixels (=144 bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R=99.0,\n",
"ranging from R=22.2 to R=247.6.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"[0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345,348,351,354,357,360,363,366,369,372,375,378,381,384,387,390,393,396,399,402,405,408,411,414,417,420,423,426,429]\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"[3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345,348,351,354,357,360,363,366,369,372,375,378,381,384,387,390,393,396,399,402,405,408,411,414,417,420,423,426,429]\n",
"\n",
"For this instrument, wavelengths *increase* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"[0.552779495716095,0.5631539821624756,0.5741130113601685,0.5857142210006714,0.5980156660079956,0.6110759377479553,0.624974250793457,0.6397919058799744,0.655619740486145,0.6725602746009827,0.69073086977005,0.7102572321891785,0.7312809824943542,0.7539597153663635,0.7784621119499207,0.8049720525741577,0.8336771726608276,0.8647741079330444,0.8984494805335999,0.9348728060722351,0.9741821885108948,1.0164588689804077,1.0617154836654663,1.109877109527588,1.1607739925384521,1.2141430377960205,1.2696436643600464,1.3268816471099854,1.3854389190673828,1.4449026584625244,1.5048885345458984,1.5650571584701538,1.6251220703125,1.684849739074707,1.7440576553344727,1.8026081323623657,1.8603999614715576,1.9173643589019775,1.9734560251235962,2.028649091720581,2.0829336643218994,2.1363086700439453,2.1887829303741455,2.240370988845825,2.2910914421081543,2.3409652709960938,2.3900160789489746,2.4382681846618652,2.485746383666992,2.532475709915161,2.5784804821014404,2.6237857341766357,2.668414831161499,2.7123897075653076,2.7557339668273926,2.7984683513641357,2.840613603591919,2.8821887969970703,2.923213481903076,2.96370530128479,3.0036814212799072,3.0431582927703857,3.0821521282196045,3.1206777095794678,3.1587493419647217,3.196380853652954,3.2335853576660156,3.2703757286071777,3.306762933731079,3.342759370803833,3.3783764839172363,3.413623809814453,3.4485116004943848,3.4830498695373535,3.517247438430786,3.5511136054992676,3.5846571922302246,3.6178853511810303,3.6508069038391113,3.6834282875061035,3.7157580852508545,3.747802734375,3.779568910598755,3.811063051223755,3.8422908782958984,3.8732597827911377,3.9039740562438965,3.9344398975372314,3.964662790298462,3.994647741317749,4.024399757385254,4.053924083709717,4.083224773406982,4.112307071685791,4.141174793243408,4.169832229614258,4.198283672332764,4.226532936096191,4.254584789276123,4.282441139221191,4.3101067543029785,4.337584972381592,4.364879131317139,4.391993522644043,4.418929576873779,4.445691108703613,4.4722819328308105,4.498703956604004,4.524960517883301,4.55105447769165,4.576988220214844,4.602764129638672,4.628385066986084,4.6538543701171875,4.679172992706299,4.704344749450684,4.729370594024658,4.754253387451172,4.778995037078857,4.803598880767822,4.828064441680908,4.852396488189697,4.8765950202941895,4.900662899017334,4.924602031707764,4.948413848876953,4.972100734710693,4.995663642883301,5.019104957580566,5.042426109313965,5.0656280517578125,5.088714122772217,5.1116838455200195,5.13454008102417,5.157283782958984,5.1799163818359375,5.202439785003662,5.224854946136475,5.24716329574585,5.26936674118042,5.2914652824401855,5.313461780548096,5.335356712341309,5.357150077819824]*u.Unit(\"um\")\n",
"\n",
"and\n",
"\n",
"[0.5631539821624756,0.5741130113601685,0.5857142210006714,0.5980156660079956,0.6110759377479553,0.624974250793457,0.6397919058799744,0.655619740486145,0.6725602746009827,0.69073086977005,0.7102572321891785,0.7312809824943542,0.7539597153663635,0.7784621119499207,0.8049720525741577,0.8336771726608276,0.8647741079330444,0.8984494805335999,0.9348728060722351,0.9741821885108948,1.0164588689804077,1.0617154836654663,1.109877109527588,1.1607739925384521,1.2141430377960205,1.2696436643600464,1.3268816471099854,1.3854389190673828,1.4449026584625244,1.5048885345458984,1.5650571584701538,1.6251220703125,1.684849739074707,1.7440576553344727,1.8026081323623657,1.8603999614715576,1.9173643589019775,1.9734560251235962,2.028649091720581,2.0829336643218994,2.1363086700439453,2.1887829303741455,2.240370988845825,2.2910914421081543,2.3409652709960938,2.3900160789489746,2.4382681846618652,2.485746383666992,2.532475709915161,2.5784804821014404,2.6237857341766357,2.668414831161499,2.7123897075653076,2.7557339668273926,2.7984683513641357,2.840613603591919,2.8821887969970703,2.923213481903076,2.96370530128479,3.0036814212799072,3.0431582927703857,3.0821521282196045,3.1206777095794678,3.1587493419647217,3.196380853652954,3.2335853576660156,3.2703757286071777,3.306762933731079,3.342759370803833,3.3783764839172363,3.413623809814453,3.4485116004943848,3.4830498695373535,3.517247438430786,3.5511136054992676,3.5846571922302246,3.6178853511810303,3.6508069038391113,3.6834282875061035,3.7157580852508545,3.747802734375,3.779568910598755,3.811063051223755,3.8422908782958984,3.8732597827911377,3.9039740562438965,3.9344398975372314,3.964662790298462,3.994647741317749,4.024399757385254,4.053924083709717,4.083224773406982,4.112307071685791,4.141174793243408,4.169832229614258,4.198283672332764,4.226532936096191,4.254584789276123,4.282441139221191,4.3101067543029785,4.337584972381592,4.364879131317139,4.391993522644043,4.418929576873779,4.445691108703613,4.4722819328308105,4.498703956604004,4.524960517883301,4.55105447769165,4.576988220214844,4.602764129638672,4.628385066986084,4.6538543701171875,4.679172992706299,4.704344749450684,4.729370594024658,4.754253387451172,4.778995037078857,4.803598880767822,4.828064441680908,4.852396488189697,4.8765950202941895,4.900662899017334,4.924602031707764,4.948413848876953,4.972100734710693,4.995663642883301,5.019104957580566,5.042426109313965,5.0656280517578125,5.088714122772217,5.1116838455200195,5.13454008102417,5.157283782958984,5.1799163818359375,5.202439785003662,5.224854946136475,5.24716329574585,5.26936674118042,5.2914652824401855,5.313461780548096,5.335356712341309,5.357150077819824]*u.Unit(\"um\")\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" \n"
]
}
],
"source": [
"describe_wavelength_bins('NIRSpec')"
]
},
{
"cell_type": "markdown",
"id": "2aa3ff2e",
"metadata": {},
"source": [
"## NIRCam/F322W2"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "5cd04ea9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"**********\n",
"* NIRCam * \n",
"**********\n",
"\n",
"⧲⧲⧲ Please bin by 42 pixels (=48 bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R=80.1,\n",
"ranging from R=55.7 to R=104.6.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"[0,42,84,126,168,210,252,294,336,378,420,462,504,546,588,630,672,714,756,798,840,882,924,966,1008,1050,1092,1134,1176,1218,1260,1302,1344,1386,1428,1470,1512,1554,1596,1638,1680,1722,1764,1806,1848,1890,1932,1974,2016]\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"[42,84,126,168,210,252,294,336,378,420,462,504,546,588,630,672,714,756,798,840,882,924,966,1008,1050,1092,1134,1176,1218,1260,1302,1344,1386,1428,1470,1512,1554,1596,1638,1680,1722,1764,1806,1848,1890,1932,1974,2016]\n",
"\n",
"For this instrument, wavelengths *increase* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"[2.3496756553649902,2.391845226287842,2.434011697769165,2.4761807918548584,2.5183470249176025,2.560516119003296,2.6026854515075684,2.6448519229888916,2.687021493911743,2.729187250137329,2.7713570594787598,2.8135228157043457,2.8556926250457764,2.8978588581085205,2.9400289058685303,2.982194185256958,3.024364471435547,3.0665295124053955,3.1087024211883545,3.150867223739624,3.193037748336792,3.2352027893066406,3.2773733139038086,3.3195385932922363,3.3617093563079834,3.403873920440674,3.446044683456421,3.4882092475891113,3.5303800106048584,3.572544574737549,3.614715814590454,3.6568868160247803,3.6990511417388916,3.741222381591797,3.783386468887329,3.8255581855773926,3.867722272872925,3.9098939895629883,3.9520578384399414,3.994229316711426,4.036393165588379,4.078566074371338,4.120730400085449,4.162901878356934,4.205066680908203,4.247236728668213,4.289401531219482,4.331573009490967,4.3737382888793945]*u.Unit(\"um\")\n",
"\n",
"and\n",
"\n",
"[2.391845226287842,2.434011697769165,2.4761807918548584,2.5183470249176025,2.560516119003296,2.6026854515075684,2.6448519229888916,2.687021493911743,2.729187250137329,2.7713570594787598,2.8135228157043457,2.8556926250457764,2.8978588581085205,2.9400289058685303,2.982194185256958,3.024364471435547,3.0665295124053955,3.1087024211883545,3.150867223739624,3.193037748336792,3.2352027893066406,3.2773733139038086,3.3195385932922363,3.3617093563079834,3.403873920440674,3.446044683456421,3.4882092475891113,3.5303800106048584,3.572544574737549,3.614715814590454,3.6568868160247803,3.6990511417388916,3.741222381591797,3.783386468887329,3.8255581855773926,3.867722272872925,3.9098939895629883,3.9520578384399414,3.994229316711426,4.036393165588379,4.078566074371338,4.120730400085449,4.162901878356934,4.205066680908203,4.247236728668213,4.289401531219482,4.331573009490967,4.3737382888793945]*u.Unit(\"um\")\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" \n"
]
}
],
"source": [
"describe_wavelength_bins('NIRCam')"
]
},
{
"cell_type": "markdown",
"id": "0f17d42b",
"metadata": {},
"source": [
"# NIRISS/SOSS"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "adaca855",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"*************\n",
"* NIRISS-O1 * \n",
"*************\n",
"\n",
"⧲⧲⧲ Please bin by 23 pixels (=88 bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R=80.9,\n",
"ranging from R=38.9 to R=121.5.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"[0,23,46,69,92,115,138,161,184,207,230,253,276,299,322,345,368,391,414,437,460,483,506,529,552,575,598,621,644,667,690,713,736,759,782,805,828,851,874,897,920,943,966,989,1012,1035,1058,1081,1104,1127,1150,1173,1196,1219,1242,1265,1288,1311,1334,1357,1380,1403,1426,1449,1472,1495,1518,1541,1564,1587,1610,1633,1656,1679,1702,1725,1748,1771,1794,1817,1840,1863,1886,1909,1932,1955,1978,2001,2024]\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"[23,46,69,92,115,138,161,184,207,230,253,276,299,322,345,368,391,414,437,460,483,506,529,552,575,598,621,644,667,690,713,736,759,782,805,828,851,874,897,920,943,966,989,1012,1035,1058,1081,1104,1127,1150,1173,1196,1219,1242,1265,1288,1311,1334,1357,1380,1403,1426,1449,1472,1495,1518,1541,1564,1587,1610,1633,1656,1679,1702,1725,1748,1771,1794,1817,1840,1863,1886,1909,1932,1955,1978,2001,2024]\n",
"\n",
"For this instrument, wavelengths *decrease* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"[2.8305157331319957,2.807210848881648,2.7839138263311143,2.7606474741911278,2.7374005012023144,2.714172907364674,2.6909534075321297,2.667764724829258,2.6445955435434976,2.621445894241333,2.598315789149358,2.575216543980134,2.552125563988319,2.529054189339662,2.506002426147461,2.482970262185121,2.45995770356594,2.4369647686298075,2.4139914451501308,2.391048926573533,2.3681148198934703,2.3452003185565653,2.3223054042229285,2.2994412642258863,2.2765855300120816,2.253749370574951,2.2309327859144945,2.2081468961177726,2.1853694121042886,2.162611496754182,2.1398731011610765,2.1171542436648636,2.094466032126011,2.0717861652374268,2.049125848672329,2.026485021297748,2.0038637014535756,1.9812729053008251,1.9586905302145543,1.9361276412621522,1.91358421704708,1.8910602575693376,1.8685667361968603,1.8460816756272926,1.8236160583985157,1.8011698845105293,1.7787540906514876,1.7563467637086525,1.7339697984548716,1.7116012970606487,1.6892521992707863,1.6669334081503062,1.6446230961726263,1.6223430389013045,1.600071445489541,1.5778300853875966,1.5556080341339111,1.533394455909729,1.5112109612195919,1.4890467539811745,1.4668909555826433,1.4447651856984847,1.4226585932267017,1.4005711384308643,1.3785027815745428,1.35645347680801,1.3344231905081334,1.3124226056612456,1.290430166782477,1.2684565721414027,1.2465124527613323,1.2245870522963695,1.2026695257578142,1.1807812268917377,1.1589113535025182,1.1370597986074595,1.1152264521672175,1.0934218626755934,1.0716245694038196,1.049855751869006,1.0281045956489367,1.006370960137783,0.9846546695782588,0.9629555497414026,0.9412734034733895,0.91961864171884,0.8979698419570923,0.8763479590415955,0.8547421632668911]*u.Unit(\"micron\")\n",
"\n",
"and\n",
"\n",
"[2.807210848881648,2.7839138263311143,2.7606474741911278,2.7374005012023144,2.714172907364674,2.6909534075321297,2.667764724829258,2.6445955435434976,2.621445894241333,2.598315789149358,2.575216543980134,2.552125563988319,2.529054189339662,2.506002426147461,2.482970262185121,2.45995770356594,2.4369647686298075,2.4139914451501308,2.391048926573533,2.3681148198934703,2.3452003185565653,2.3223054042229285,2.2994412642258863,2.2765855300120816,2.253749370574951,2.2309327859144945,2.2081468961177726,2.1853694121042886,2.162611496754182,2.1398731011610765,2.1171542436648636,2.094466032126011,2.0717861652374268,2.049125848672329,2.026485021297748,2.0038637014535756,1.9812729053008251,1.9586905302145543,1.9361276412621522,1.91358421704708,1.8910602575693376,1.8685667361968603,1.8460816756272926,1.8236160583985157,1.8011698845105293,1.7787540906514876,1.7563467637086525,1.7339697984548716,1.7116012970606487,1.6892521992707863,1.6669334081503062,1.6446230961726263,1.6223430389013045,1.600071445489541,1.5778300853875966,1.5556080341339111,1.533394455909729,1.5112109612195919,1.4890467539811745,1.4668909555826433,1.4447651856984847,1.4226585932267017,1.4005711384308643,1.3785027815745428,1.35645347680801,1.3344231905081334,1.3124226056612456,1.290430166782477,1.2684565721414027,1.2465124527613323,1.2245870522963695,1.2026695257578142,1.1807812268917377,1.1589113535025182,1.1370597986074595,1.1152264521672175,1.0934218626755934,1.0716245694038196,1.049855751869006,1.0281045956489367,1.006370960137783,0.9846546695782588,0.9629555497414026,0.9412734034733895,0.91961864171884,0.8979698419570923,0.8763479590415955,0.8547421632668911]*u.Unit(\"micron\")\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" \n"
]
}
],
"source": [
"describe_wavelength_bins('NIRISS-O1')"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "52fc4707",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"*************\n",
"* NIRISS-O2 * \n",
"*************\n",
"\n",
"⧲⧲⧲ Please bin by 23 pixels (=53 bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R=78.5,\n",
"ranging from R=51.4 to R=105.4.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"[0,23,46,69,92,115,138,161,184,207,230,253,276,299,322,345,368,391,414,437,460,483,506,529,552,575,598,621,644,667,690,713,736,759,782,805,828,851,874,897,920,943,966,989,1012,1035,1058,1081,1104,1127,1150,1173,1196,1219]\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"[23,46,69,92,115,138,161,184,207,230,253,276,299,322,345,368,391,414,437,460,483,506,529,552,575,598,621,644,667,690,713,736,759,782,805,828,851,874,897,920,943,966,989,1012,1035,1058,1081,1104,1127,1150,1173,1196,1219]\n",
"\n",
"For this instrument, wavelengths *decrease* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"[1.1309373195354755,1.1202101768591466,1.1094776391983032,1.0987448753454747,1.0880171549625886,1.0772839540090315,1.066550490183708,1.0558167604299693,1.0450880007866101,1.0343537330627441,1.0236244109960704,1.012889528885866,1.0021595863195567,0.9914293059935937,0.9806986802663559,0.9699729283650717,0.9592415552872878,0.9485097710902874,0.9377828194544866,0.9270554169630393,0.9163222985389905,0.9055939393165784,0.8948650589356055,0.8841356359995328,0.8734056338285788,0.8626750233845834,0.8519437695160891,0.8412118370716388,0.8304791863148029,0.8197510288311884,0.8090168191836431,0.7982870172231625,0.7875510637576764,0.7768194262798016,0.766086784692911,0.7553530885623052,0.7446182798116635,0.7338875486300542,0.7231503205421643,0.7124170355307751,0.7016823689142863,0.6909462458048111,0.6802085867294898,0.6694693030455173,0.658728315280034,0.6479855271486136,0.6372408454234784,0.6264994419538058,0.6157559400949723,0.6050102450908759,0.5942622362039028,0.5835118018663846,0.5727640894743112,0.5620084359095647]*u.Unit(\"micron\")\n",
"\n",
"and\n",
"\n",
"[1.1202101768591466,1.1094776391983032,1.0987448753454747,1.0880171549625886,1.0772839540090315,1.066550490183708,1.0558167604299693,1.0450880007866101,1.0343537330627441,1.0236244109960704,1.012889528885866,1.0021595863195567,0.9914293059935937,0.9806986802663559,0.9699729283650717,0.9592415552872878,0.9485097710902874,0.9377828194544866,0.9270554169630393,0.9163222985389905,0.9055939393165784,0.8948650589356055,0.8841356359995328,0.8734056338285788,0.8626750233845834,0.8519437695160891,0.8412118370716388,0.8304791863148029,0.8197510288311884,0.8090168191836431,0.7982870172231625,0.7875510637576764,0.7768194262798016,0.766086784692911,0.7553530885623052,0.7446182798116635,0.7338875486300542,0.7231503205421643,0.7124170355307751,0.7016823689142863,0.6909462458048111,0.6802085867294898,0.6694693030455173,0.658728315280034,0.6479855271486136,0.6372408454234784,0.6264994419538058,0.6157559400949723,0.6050102450908759,0.5942622362039028,0.5835118018663846,0.5727640894743112,0.5620084359095647]*u.Unit(\"micron\")\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" \n"
]
}
],
"source": [
"# kludge this by a little to make it match order 1\n",
"describe_wavelength_bins('NIRISS-O2', target_median_R=78)"
]
},
{
"cell_type": "markdown",
"id": "ca596294",
"metadata": {},
"source": [
"# MIRI/LRS"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "a126e2bc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"********\n",
"* MIRI * \n",
"********\n",
"\n",
"⧲⧲⧲ Please bin by 6 pixels (=64 bins). ⧲⧲⧲\n",
"\n",
"The median resolution will then be R=83.6,\n",
"ranging from R=3.5 to R=155.1.\n",
"\n",
"The bins should start at pixel indices of\n",
"\n",
"[0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222,228,234,240,246,252,258,264,270,276,282,288,294,300,306,312,318,324,330,336,342,348,354,360,366,372,378,384]\n",
"\n",
"and end at (but not include) pixel indices of\n",
"\n",
"[6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222,228,234,240,246,252,258,264,270,276,282,288,294,300,306,312,318,324,330,336,342,348,354,360,366,372,378,384]\n",
"\n",
"For this instrument, wavelengths *decrease* with increasing pixel index.\n",
"So, these bin edges correspond, respectively, to wavelengths of\n",
"\n",
"[14.381652160965587,14.288677904576316,14.19513408781059,14.100980573697965,14.006177225268003,13.910683905550258,13.8144604775743,13.717466804369684,13.619662748965977,13.521008174392746,13.421462943679536,13.320986919855926,13.219539965951462,13.11708194499571,13.013572720018242,12.908972154048605,12.80324011011637,12.696336451251092,12.588221040482336,12.478853740839668,12.368194415352635,12.256202927050817,12.142839138963758,12.028062914121033,11.911834115552194,11.794112606286804,11.674858249354436,11.554030907784638,11.43159044460697,11.307496722851006,11.181709605546294,11.054188955722402,10.924894636408892,10.79377768500125,10.660713593028873,10.525537680761987,10.388084800856134,10.24818980596687,10.10568754874973,9.960412881860275,9.812200657954042,9.660885729686585,9.506302949713447,9.348287170690178,9.186673245272322,9.021296026115431,8.851990365875047,8.678591117206723,8.500933132766,8.318830052232263,8.131749185076377,7.938862820869209,7.739332921546813,7.532321449045231,7.316990365300507,7.092501632248685,6.858017211825813,6.612596995199266,6.353587450934058,6.076851473815935,5.778198650331425,5.452977959680217,5.088694610654769,4.662908440624926,4.069082812451281]*u.Unit(\"um\")\n",
"\n",
"and\n",
"\n",
"[14.288677904576316,14.19513408781059,14.100980573697965,14.006177225268003,13.910683905550258,13.8144604775743,13.717466804369684,13.619662748965977,13.521008174392746,13.421462943679536,13.320986919855926,13.219539965951462,13.11708194499571,13.013572720018242,12.908972154048605,12.80324011011637,12.696336451251092,12.588221040482336,12.478853740839668,12.368194415352635,12.256202927050817,12.142839138963758,12.028062914121033,11.911834115552194,11.794112606286804,11.674858249354436,11.554030907784638,11.43159044460697,11.307496722851006,11.181709605546294,11.054188955722402,10.924894636408892,10.79377768500125,10.660713593028873,10.525537680761987,10.388084800856134,10.24818980596687,10.10568754874973,9.960412881860275,9.812200657954042,9.660885729686585,9.506302949713447,9.348287170690178,9.186673245272322,9.021296026115431,8.851990365875047,8.678591117206723,8.500933132766,8.318830052232263,8.131749185076377,7.938862820869209,7.739332921546813,7.532321449045231,7.316990365300507,7.092501632248685,6.858017211825813,6.612596995199266,6.353587450934058,6.076851473815935,5.778198650331425,5.452977959680217,5.088694610654769,4.662908440624926,4.069082812451281]*u.Unit(\"um\")\n",
"\n",
"at least according to the wavelengths in the x1dints extracted spectra \n",
"files included with the Stage 2 data products. They may be slightly\n",
"different depending on your estimated wavelength calibration.\n",
"\n",
"*Please note*: \n",
"Some of these wavelength bins may ultimately contain nan's or be \n",
"too noisy to be useful. It's OK to skip bad bins in your fits.\n",
" \n"
]
}
],
"source": [
"describe_wavelength_bins('MIRI')"
]
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment