Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"__nbid__ = '0038'\n",
"__author__ = 'Brian Merino <[email protected]>, Vinicius Placco <[email protected]>'\n",
"__version__ = '20241209' # yyyymmdd; version datestamp of this notebook\n",
"__version__ = '20250912' # yyyymmdd; version datestamp of this notebook\n",
"__keywords__ = ['flamingos-2','gemini','browndwarf','dwarf','dragons']"
]
},
Expand All @@ -21,7 +21,7 @@
"# Gemini Flamingos-2 Brown Dwarf reduction using DRAGONS Python API\n",
"***\n",
"## Public archival data from f2img_tutorial - GS-2013B-Q-15 (WISE J041358.14-475039.3)\n",
"#### adapted from https://dragons.readthedocs.io/projects/f2img-drtutorial/en/v3.2.1/ex1_f2im_ontarget_api.html\n",
"#### adapted from https://dragons.readthedocs.io/projects/f2img-drtutorial/en/v4.0.0/ex1_f2im_ontarget_api.html\n",
"***"
]
},
Expand All @@ -44,15 +44,16 @@
"* [Create Master Flat Field](#Master_Flat)\n",
"* [Reduce Science Images](#Reduce_Science)\n",
"* [Display stacked final image](#Display_Image)\n",
"* [Display final image](#Display_final)\n",
"* [Clean-up (optional)](#Clean-up)\n",
"\n",
" \n",
"<a class=\"anchor\" id=\"goals\"></a>\n",
"# Goals\n",
"Showcase how to reduce Flamingos-2 imaging data using the Gemini DRAGONS package on the Data Lab science platform using a custom DRAGONS kernel `\"DRAGONS (Py3.7)\"`. The steps include downloading data from the Gemini archive, setting up a DRAGONS calibration service, processing flats, darks, a bad pixel mask, and science frames, and creating a single combined stacked image.\n",
"Showcase how to reduce Flamingos-2 imaging data using the Gemini DRAGONS package on the Data Lab science platform using a custom DRAGONS kernel `\"DRAGONS-4.0.0 (DL,Py3.12)\"`. The steps include downloading data from the Gemini archive, setting up a DRAGONS calibration service, processing flats, darks, a bad pixel mask, and science frames, and creating a single combined stacked image.\n",
"\n",
"<a class=\"anchor\" id=\"summary\"></a>\n",
"# Summary\n",
"DRAGONS is a Python-based astronomical data reduction platform written by the Gemini Science User Support Department. It can currently be used to reduce imaging data from Gemini instruments GMOS, NIRI, Flamingos 2, GSAOI, and GNIRS, as well as spectroscopic data taken with GHOST and GMOS in longslit mode. Linked <a href=\"https://dragons.readthedocs.io/en/v3.2.1/\">here</a> is a general list of guides, manuals, and tutorials about the use of DRAGONS.\n",
"DRAGONS is a Python-based astronomical data reduction platform written by the Gemini Science User Support Department. It can currently be used to reduce imaging data from Gemini instruments GMOS, NIRI, Flamingos 2, GSAOI, and GNIRS, as well as spectroscopic data taken with GNIRS, GHOST, and GMOS in longslit mode. Linked <a href=\"https://dragons.readthedocs.io/en/stable/\">here</a> is a general list of guides, manuals, and tutorials about the use of DRAGONS.\n",
"\n",
"The DRAGONS kernel has been made available in the Data Lab environment, allowing users to access the routines without being dependent on installing the software on their local machines. \n",
"\n",
Expand Down Expand Up @@ -576,6 +577,49 @@
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a class=\"anchor\" id=\"Display_final\"></a>\n",
"# Display the final product"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"final_image = \"S20131121S0075_image.fits\"\n",
"hdu_final = fits.open(final_image)\n",
"wcs_final = WCS(hdu_final[1].header)\n",
"hdu_final.info()\n",
"data_final = hdu_final[1].data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The output stack units are in electrons (header keyword BUNIT=electrons). The output stack is stored in a multi-extension FITS (MEF) file. The science signal is in the “SCI” extension, the variance is in the “VAR” extension, and the data quality plane (mask) is in the “DQ” extension.\n",
"\n",
"Note: The upper-left quadrant of this science sequence is rather messy. This is caused by the PWFS2 guide probe (see [Emission from PWFS2 guide probe](https://dragons.readthedocs.io/projects/f2img-drtutorial/en/v4.0.0/05_issues_and_limitations.html#issue-p2)). Photometry in this portion of the image is likely to be seriously compromised."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.imshow(data_final,origin='lower',vmin=0.01,vmax=160)\n",
"\n",
"plt.scatter(1150,1126,marker='o',facecolors='none',s=20,edgecolors='red')\n",
"plt.text(1095,1000,'W0413-4750',c='red')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -603,9 +647,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "DRAGONS-3.2.2 (DL,Py3.10.14)",
"display_name": "DRAGONS-4.0.0 (DL,Py3.12)",
"language": "python",
"name": "dragons-3.2.2"
"name": "dragons-4.0.0"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -617,7 +661,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.10"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7520,7 +7520,7 @@
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">__nbid__</span> <span class="o">=</span> <span class="s1">'0071'</span>
<span class="n">__author__</span> <span class="o">=</span> <span class="s1">'Brian Merino &lt;[email protected]&gt;, Vinicius Placco &lt;[email protected]&gt;'</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'20250515'</span> <span class="c1"># yyyymmdd; version datestamp of this notebook</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'20250912'</span> <span class="c1"># yyyymmdd; version datestamp of this notebook</span>
<span class="n">__keywords__</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'GHOST'</span><span class="p">,</span><span class="s1">'Gemini'</span><span class="p">,</span><span class="s1">'stars'</span><span class="p">,</span><span class="s1">'DRAGONS'</span><span class="p">]</span>
</pre></div>
</div>
Expand Down Expand Up @@ -7591,9 +7591,9 @@ <h2 id="Table-of-contents">Table of contents<a class="anchor-link" href="#Table-
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<p><a class="anchor" id="goals"></a></p>
<h1 id="Goals">Goals<a class="anchor-link" href="#Goals">¶</a></h1><p>Showcase how to reduce GHOST spectroscopy data using the Gemini DRAGONS package on the Data Lab science platform using a custom DRAGONS kernel <code>"DRAGONS-3.2.2 (DL,Py3.10.14)"</code>. The steps include downloading data from the Gemini archive, setting up the DRAGONS calibration service, processing biases, flats, and arcs, creating master flats and slit-flats, reducing the standards and science data, and finally creating the final reduced spectra for GHOST's red and blue arms.</p>
<h1 id="Goals">Goals<a class="anchor-link" href="#Goals">¶</a></h1><p>Showcase how to reduce GHOST spectroscopy data using the Gemini DRAGONS package on the Data Lab science platform using a custom DRAGONS kernel <code>"DRAGONS-4.0.0 (DL,Py3.12)"</code>. The steps include downloading data from the Gemini archive, setting up the DRAGONS calibration service, processing biases, flats, and arcs, creating master flats and slit-flats, reducing the standards and science data, and finally creating the final reduced spectra for GHOST's red and blue arms.</p>
<p><a class="anchor" id="summary"></a></p>
<h1 id="Summary">Summary<a class="anchor-link" href="#Summary">¶</a></h1><p>DRAGONS is a Python-based astronomical data reduction platform written by the Gemini Science User Support Department. It can currently be used to reduce imaging data from Gemini instruments GMOS, NIRI, Flamingos 2, GSAOI, and GNIRS, as well as spectroscopic data taken with GHOST and GMOS in longslit mode. Linked <a href="https://dragons.readthedocs.io/en/v3.2.1/">here</a> is a general list of guides, manuals, and tutorials about the use of DRAGONS.</p>
<h1 id="Summary">Summary<a class="anchor-link" href="#Summary">¶</a></h1><p>DRAGONS is a Python-based astronomical data reduction platform written by the Gemini Science User Support Department. It can currently be used to reduce imaging data from Gemini instruments GMOS, NIRI, Flamingos 2, GSAOI, and GNIRS, as well as spectroscopic data taken with GNIRS, GHOST, and GMOS in longslit mode. Linked <a href="https://dragons.readthedocs.io/en/stable/">here</a> is a general list of guides, manuals, and tutorials about the use of DRAGONS.</p>
<p>The DRAGONS kernel has been made available in the Data Lab environment, allowing users to access the routines without being dependent on installing the software on their local machines. It is important to note that when a DRAGONS command is executed, the output will be displayed inside the cell. Make sure to scroll through the output to ensure no errors are missed.</p>
<p>We present an example of a DRAGONS Jupyter notebook that works in the Data Lab environment to reduce Gemini South GHOST blue:2x2 and red:2x2 spectroscopy data fully. This notebook will not present all of the details of the many options available to adjust or optimize the DRAGONS GHOST data reduction process; rather, it will just show one example of a standard reduction of a GHOST spectroscopic dataset.</p>
<p>The data used in this notebook example is GHOST blue:2x2 and red:2x2 spectroscopy data from the Gemini archive of the star XX Oph from the GHOST commissioning run. Because the data used is from a commissioning run, there is no program information available, but you can find more information about GHOST's red and blue IFUs on the <a href="https://www.gemini.edu/instrumentation/ghost">GHOST instrument page</a>.</p>
Expand Down Expand Up @@ -7964,32 +7964,6 @@ <h1 id="Setting-up-the-DRAGONS-logger">Setting up the DRAGONS logger<a class="an
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=990307b9-71a5-4450-91d7-22a294e28a84">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="Add-the-Bad-Pixel-Masks-to-the-calibration-database">Add the Bad Pixel Masks to the calibration database<a class="anchor-link" href="#Add-the-Bad-Pixel-Masks-to-the-calibration-database">¶</a></h2>
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=27b5dc41-fc3c-4364-9daf-f1272c89a1d7">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">caldb</span><span class="o">.</span><span class="n">add_cal</span><span class="p">(</span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s1">'raw/bpm*.fits'</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">caldb</span><span class="o">.</span><span class="n">add_cal</span><span class="p">(</span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s1">'raw/bpm*.fits'</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=04e1d2fe-cf05-42ac-83fc-5e9b05cbbf3b">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
Expand Down Expand Up @@ -8057,6 +8031,34 @@ <h1 id="update_list()-and-reduce_func()">update_list() and reduce_func()<a class
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=990307b9-71a5-4450-91d7-22a294e28a84">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="Add-the-Bad-Pixel-Masks-to-the-calibration-database">Add the Bad Pixel Masks to the calibration database<a class="anchor-link" href="#Add-the-Bad-Pixel-Masks-to-the-calibration-database">¶</a></h2><p>Starting with DRAGONS v3.1, the static bad pixel masks (BPMs) are now handled as calibrations. They are downloadable from the archive instead of being packaged with the software. They are automatically associated like any other calibrations. This means that the user now must download the BPMs along with the other calibrations and add the BPMs to the local calibration manager.</p>
<p>See <a href="https://dragons.readthedocs.io/projects/gnirsimg-drtutorial/en/stable/05_tips_and_tricks.html#getbpm">Getting Bad Pixel Masks from the archive</a> in Tips and Tricks to learn about the various ways to get the BPMs from the archive.</p>
<p>To add the BPM included in the data package to the local calibration database:</p>
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=27b5dc41-fc3c-4364-9daf-f1272c89a1d7">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">caldb</span><span class="o">.</span><span class="n">add_cal</span><span class="p">(</span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s1">'raw/bpm*.fits'</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">caldb</span><span class="o">.</span><span class="n">add_cal</span><span class="p">(</span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s1">'raw/bpm*.fits'</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=99da7d68-ef56-473f-9033-d857dd6f9b06">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
Expand Down Expand Up @@ -9808,7 +9810,21 @@ <h2 id="Optional:-Clean-up-working-directory.-(uncomment-before-running)">Option
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1"># clean_up(save_reduced=0)</span>
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#clean_up(save_reduced=1)</span>
</pre></div>
</div>
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=459d0bae-5143-42f7-b000-38b7ad7cdfa2">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span>
</pre></div>
</div>
</div>
Expand Down
Loading