Skip to content

Commit

Permalink
Cleaned up Pandeia tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
ojustino committed May 31, 2024
1 parent ad40ffc commit 8955002
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions notebooks/pandeia/pandeia.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"metadata": {},
"outputs": [],
"source": [
"FILTER = 'F129'"
"FILTER = 'f129'"
]
},
{
Expand Down Expand Up @@ -170,23 +170,18 @@
"source": [
"report = perform_calculation(calc)\n",
"sn = report['scalar']['sn']\n",
"print(f'Estimated S/N: {sn:.2f}') ## OJO: EQUALS 28.2??"
"print(f'Estimated S/N: {sn:.2f}')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "61515da4-0ec8-40c8-999b-6af079e86bf7",
"id": "44c3825c-ea41-4270-9a8a-b4f347cc59ca",
"metadata": {},
"source": [
"_This step may generate a WARNING from synphot that the spectrum is extrapolated, which can be ignored._"
]
},
{
"cell_type": "markdown",
"id": "32daac81-5686-44ea-8a2e-333b298aee77",
"metadata": {},
"source": [
"_Running Pandeia for Roman will likely return a warning such as: if np.log(abs(val)) < -1*precision and val != 0.0. This is related to a JWST-specific test for float precision, and can be ignored in this case._"
"_This step may generate a WARNING from synphot that the spectrum is extrapolated, which can be ignored._\n",
"\n",
"_Running Pandeia for Roman may return a warning such as: `if np.log(abs(val)) < -1*precision and val != 0.0`. This is related to a JWST-specific test for float precision, and can be ignored in this case._"
]
},
{
Expand Down Expand Up @@ -306,9 +301,7 @@
"id": "0a547b7c-34d7-4b83-be71-977700f6e244",
"metadata": {},
"source": [
"### Determine optimal number of exposures\n",
"\n",
"**(Sebastian left comment on 4/19 to change 27 to 26. Assuming he meant source magnitude `mag`.)**"
"### Determine optimal number of exposures"
]
},
{
Expand Down Expand Up @@ -343,7 +336,7 @@
" calc['configuration']['detector']['nexp'] = int(nexp)\n",
" etc = perform_calculation(calc)['scalar']\n",
" \n",
" return (sntarget-etc['sn'])**2\n",
" return (sntarget - etc['sn'])**2\n",
" \n",
"def compute_nexp(filt, sn, mag, bracket=(1, 1000), xtol=0.1):\n",
" \"\"\"\n",
Expand Down Expand Up @@ -407,7 +400,7 @@
" \n",
" exptime = report['scalar']['total_exposure_time']\n",
" \n",
" return nexp,report,exptime"
" return nexp, report, exptime"
]
},
{
Expand All @@ -421,28 +414,25 @@
"\n",
"...and these observation parameters:\n",
"* Signal-to-noise ratio: 20\n",
"* Source magnitude: 26 **(NOT 27??)**\n",
"* Source magnitude: 26\n",
"\n",
"...we can use the functions above to determine an optimal number of exposures. For completeness, we also print the actual signal-to-noise ratio achieved and the exposure time needed for that result."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa406c02-06c2-4d87-afe3-16ca778776a5",
"id": "bf43823b-777a-4b15-af60-15eef89d6106",
"metadata": {},
"outputs": [],
"source": [
"sn = 20.\n",
"mag = 27.\n",
"mag = 26.\n",
" \n",
"nexp, etc, exptime = compute_nexp(FILTER, sn, mag)\n",
"print(f'number of exposures: {nexp}')\n",
"print(f'actual S/N reached: {etc[\"scalar\"][\"sn\"]:.2f}')\n",
"print(f'Exposure time: {exptime:.2f}')\n",
"# OJO: This calculation should output Output Product 47 exposures,\n",
"# a signal-to-noise reached of Output Product 20.06 ,\n",
"# and an exposure time of Output Product 26147.04 seconds. ???"
"print(f'Exposure time: {exptime:.2f}')"
]
},
{
Expand Down Expand Up @@ -513,7 +503,7 @@
"source": [
"report = perform_calculation(calc)\n",
"sn = report['scalar']['sn']\n",
"print(f'Estimated S/N: {sn:.2f}') # OJO: EQUALS 51.91??"
"print(f'Estimated S/N: {sn:.2f}')"
]
},
{
Expand All @@ -522,12 +512,10 @@
"metadata": {},
"source": [
"## Aditional Resources\n",
"While this isn't always necessary, sometimes you want to provide some more resources for the reader who wants to learn something beyond what's in the notebook. Sometimes these don't exist, but if they do, it's good to put them at the end to give the reader somewhere else to go. Usually a list of links using markdown bullet-plus-link format is appropriate:\n",
"\n",
"- [MAST API](https://mast.stsci.edu/api/v0/index.html)\n",
"- [Kepler Archive Page (MAST)](https://archive.stsci.edu/kepler/)\n",
"- [Kepler Archive Manual](https://archive.stsci.edu/kepler/manuals/archive_manual.pdf)\n",
"- [Exo.MAST website](https://exo.mast.stsci.edu/exo/ExoMast/html/exomast.html)"
"- The Roman User Documentation's [\"Pandeia for Roman\"](https://roman-docs.stsci.edu/simulation-tools-handbook-home/pandeia-for-roman) page and associated overview.\n",
"- Full API references for [Pandeia Engine inputs](https://outerspace.stsci.edu/display/PEN/Pandeia+Engine+Input+API) and [Pandeia Engine outputs](https://outerspace.stsci.edu/display/PEN/Pandeia+Engine+Output+API).\n",
"- The [Roman Help Desk](https://roman-docs.stsci.edu/roman-help-desk-at-stsci), an official outlet for user questions about Pandeia."
]
},
{
Expand All @@ -540,7 +528,6 @@
},
"source": [
"## About this notebook\n",
"Let the world know who the author of this great notebook is! If possible/appropriate, include a contact email address for users who might need support (e.g. [email protected])\n",
"\n",
"**Author:** Justin Otor, Staff Scientist II. \n",
"**Updated In:** 2024-05"
Expand Down

0 comments on commit 8955002

Please sign in to comment.