Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Auth for SPARCL section #248

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
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
37 changes: 15 additions & 22 deletions 04_HowTos/SPARCL/How_to_use_SPARCL.html
Original file line number Diff line number Diff line change
Expand Up @@ -7519,7 +7519,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">'0051'</span>
<span class="n">__author__</span> <span class="o">=</span> <span class="s1">'Alice Jacques &lt;[email protected]&gt;, Steve Pothier &lt;[email protected]&gt;, Adam Bolton &lt;[email protected]&gt;'</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'20240829'</span> <span class="c1"># yyyymmdd</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s1">'20240924'</span> <span class="c1"># yyyymmdd</span>
<span class="n">__datasets__</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'sdss_dr16'</span><span class="p">,</span> <span class="s1">'boss_dr16'</span><span class="p">,</span> <span class="s1">'desi_edr'</span><span class="p">]</span>
<span class="n">__keywords__</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'sparcl'</span><span class="p">,</span> <span class="s1">'spectroscopy'</span><span class="p">,</span> <span class="s1">'HowTo'</span><span class="p">,</span> <span class="s1">'sdss spectra'</span><span class="p">,</span> <span class="s1">'desi spectra'</span><span class="p">,</span> <span class="s1">'tutorial'</span><span class="p">]</span>
</pre></div>
Expand Down Expand Up @@ -7577,7 +7577,7 @@ <h3 id="Table-of-contents">Table of contents<a class="anchor-link" href="#Table-
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<p><a class="anchor" id="goalssummary"></a></p>
<h2 id="Goals-&amp;-Summary">Goals &amp; Summary<a class="anchor-link" href="#Goals-&amp;-Summary">¶</a></h2><p>SPARCL (SPectra Analysis and Retrievable Catalog Lab) is an online service for discovery and retrieval of one-dimensional optical-infrared spectra. SPARCL is designed to work for large survey datasets containing many millions of spectra, and to provide access to multiple different data sets through common methods. For more information, see the <a href="https://astrosparcl.datalab.noirlab.edu/static/SPARCLUserManual.pdf">SPARCL User Guide</a>.</p>
<p>This notebook provides a basic introduction to using the SPARCL client (or sparclclient) to find and retrieve spectroscopic data within a Python notebook context. The sparclclient connects to the SPARCL server at <a href="https://noirlab.edu/public/">NSF's NOIRLab</a> and provides access to the contents of the SPARCL database.</p>
<p>This notebook provides a basic introduction to using the SPARCL client (or sparclclient) to find and retrieve spectroscopic data within a Python notebook context. The sparclclient connects to the SPARCL server at <a href="https://noirlab.edu/public/">NSF NOIRLab</a> and provides access to the contents of the SPARCL database.</p>
<p>To see the current data sets and number of spectra available in the SPARCL database, please visit the <a href="https://astrosparcl.datalab.noirlab.edu/sparc/">SPARCL summary page</a>.</p>
<p>To get the latest sparclclient documentation, visit the <a href="https://sparclclient.readthedocs.io/en/latest/">sparclclient readthedocs site</a>.</p>
<p>Feedback on SPARCL (questions, comments, science use cases, feature requests, bug reports, confusing error messages, etc.) can be submitted to [email protected]. For bug reports and confusing error messages, it's helpful if you include: a log of <em>what you did</em>, <em>the result you got</em>, and <em>the result you expected</em>.</p>
Expand All @@ -7588,6 +7588,11 @@ <h2 id="Goals-&amp;-Summary">Goals &amp; Summary<a class="anchor-link" href="#Go
<li><a href="https://github.com/astro-datalab/notebooks-latest/blob/master/03_ScienceExamples/EmLineGalaxies/01_EmLineGalaxies_SpectraStack.ipynb">Stacking SDSS Spectra of Galaxies Selected from the BPT Diagram</a></li>
<li><a href="https://github.com/astro-datalab/notebooks-latest/blob/master/03_ScienceExamples/EmLineGalaxies/02_EmLineGalaxies_Outliers.ipynb">Multi-wavelength Image Cutouts and SDSS Spectra of Active Galaxies with Extreme Emission-Line Ratios</a></li>
</ul>
<p>And our other How-To notebooks that use SPARCL:</p>
<ul>
<li><a href="https://github.com/astro-datalab/notebooks-latest/blob/master/04_HowTos/SPARCL/Plot_SPARCL_Spectra_with_Jdaviz.ipynb">SPARCL + Jdaviz</a></li>
<li><a href="https://github.com/astro-datalab/notebooks-latest/blob/master/04_HowTos/SPARCL/Plot_SPARCL_Spectra_with_Prospect.ipynb">Obtain and plot spectra data using SPARCL, prospect, and specutils</a></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest making the notebook short descriptions more homogenous, such as: "Obtain spectra with SPARCL and plot them with Jdaviz" and "Obtain spectra with SPARCL and plot them with prospect" (I think specutils is an intermediary step for converting the data format).

</ul>
</div>
</div>
</div>
Expand Down Expand Up @@ -7712,7 +7717,7 @@ <h1 id="Authentication">Authentication<a class="anchor-link" href="#Authenticati
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell" id="cell-id=50a1081b">
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=50a1081b">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
Expand All @@ -7721,24 +7726,12 @@ <h1 id="Authentication">Authentication<a class="anchor-link" href="#Authenticati
<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">#token = ac.login(input("Enter user name: (+ENTER) "),getpass("Enter password: (+ENTER) "))</span>
<span class="n">ac</span><span class="o">.</span><span class="n">whoAmI</span><span class="p">()</span>
<span class="c1">#ac.whoAmI()</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="jp-Cell-outputWrapper">
<div class="jp-Collapser jp-OutputCollapser jp-Cell-outputCollapser">
</div>
<div class="jp-OutputArea jp-Cell-outputArea">
<div class="jp-OutputArea-child jp-OutputArea-executeResult">
<div class="jp-OutputPrompt jp-OutputArea-prompt">Out[4]:</div>
<div class="jp-RenderedText jp-OutputArea-output jp-OutputArea-executeResult" data-mime-type="text/plain" tabindex="0">
<pre>'ajacques'</pre>
</div>
</div>
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=5647c893">
<div class="jp-Cell-inputWrapper" tabindex="0">
Expand Down Expand Up @@ -7785,7 +7778,7 @@ <h4 id="We-now-create-a-SPARCL-client-instance:">We now create a SPARCL client i
<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="auth_sparcl"></a></p>
<h1 id="Authentication-for-SPARCL">Authentication for SPARCL<a class="anchor-link" href="#Authentication-for-SPARCL">¶</a></h1><p>All public SPARCL data sets can be accessed without explicitly logging in. However, some data sets are private and can only be accessed by authorized users. If you are an authorized user and wish to login to SPARCL, un-comment the cell below and enter your SSO user name and password.</p>
<h1 id="Authentication-for-SPARCL">Authentication for SPARCL<a class="anchor-link" href="#Authentication-for-SPARCL">¶</a></h1><p>All public SPARCL data sets can be accessed without explicitly logging in. However, some data sets are private and can only be accessed by authorized users. If you are an authorized user and wish to login to SPARCL, un-comment the cell below and enter your NOIRLab CSDC SSO user name and password. If you need to create an account, sign-up at <a href="https://sso.csdc.noirlab.edu/">https://sso.csdc.noirlab.edu/</a> then email [email protected] with your First Name, Last Name, and Email Address (the same one you used to create your NOIRLab CSDC SSO account).</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"If you need to create an account, sign-up at https://sso.csdc.noirlab.edu." is great but the second part could be misleading because we will already populate the list of authorized SPARCL users (unless there is an issue and a user registers for SSO with different credentials). So let's revise the rest to something like: "If you encounter an issue, email [email protected] with your First Name, Last Name, and Email Address (the same one you used to create your NOIRLab CSDC SSO account)."

<p>To logout of SPARCL after a session, use:</p>
<pre><code>client.logout()
</code></pre>
Expand Down Expand Up @@ -7814,7 +7807,7 @@ <h1 id="Authentication-for-SPARCL">Authentication for SPARCL<a class="anchor-lin
</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">
<h4 id="View-which-data-sets-you-have-access-to:">View which data sets you have access to:<a class="anchor-link" href="#View-which-data-sets-you-have-access-to:">¶</a></h4>
<h4 id="View-which-data-sets-you-have-access-to:">View which data sets you have access to:<a class="anchor-link" href="#View-which-data-sets-you-have-access-to:">¶</a></h4><p><strong>Note:</strong> if you are not logged in or if your SSO user name is not in the authorized list of SPARCL users, you will only see public data sets</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -8816,7 +8809,7 @@ <h4 id="Use-the-sparcl_ids-from-the-output-of-using-client.find()-to-retrieve-re
<div class="jp-OutputPrompt jp-OutputArea-prompt">Out[22]:</div>
<div class="jp-RenderedText jp-OutputArea-output jp-OutputArea-executeResult" data-mime-type="text/plain" tabindex="0">
<pre>{'status': {'success': True,
'info': ["Successfully found 20 records in dr_list={'DESI-EDR', 'BOSS-DR16', 'SDSS-DR16'}"],
'info': ["Successfully found 20 records in dr_list={'SDSS-DR16', 'BOSS-DR16', 'DESI-EDR'}"],
'warnings': []}}</pre>
</div>
</div>
Expand Down Expand Up @@ -8956,7 +8949,7 @@ <h4 id="Use-the-specIDs-from-the-sparcl.main-table-to-retrieve-records-from-SPAR
<div class="jp-OutputPrompt jp-OutputArea-prompt">Out[25]:</div>
<div class="jp-RenderedText jp-OutputArea-output jp-OutputArea-executeResult" data-mime-type="text/plain" tabindex="0">
<pre>{'status': {'success': True,
'info': ["Successfully found 20 records in dr_list={'DESI-EDR', 'BOSS-DR16', 'SDSS-DR16'}"],
'info': ["Successfully found 20 records in dr_list={'SDSS-DR16', 'BOSS-DR16', 'DESI-EDR'}"],
'warnings': []}}</pre>
</div>
</div>
Expand Down Expand Up @@ -9562,7 +9555,7 @@ <h4 id="When-you-try-to-retrieve-records-from-the-SPARCL-database-with-IDs-that-
<div class="jp-OutputArea-child">
<div class="jp-OutputPrompt jp-OutputArea-prompt"></div>
<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="application/vnd.jupyter.stderr" tabindex="0">
<pre>/tmp/ipykernel_2004647/2568251338.py:7: UserWarning: Some UUIDs were not found. 5 out of the 5 requested uuids have no records available in the SPARCL database associated with DataSets {'DESI-EDR', 'BOSS-DR16', 'SDSS-DR16'}.Use "client.missing()" to get a list of the 5 unavailable uuids.
<pre>/tmp/ipykernel_1163822/2568251338.py:7: UserWarning: Some UUIDs were not found. 5 out of the 5 requested uuids have no records available in the SPARCL database associated with DataSets {'SDSS-DR16', 'BOSS-DR16', 'DESI-EDR'}.Use "client.missing()" to get a list of the 5 unavailable uuids.
res_test = client.retrieve(uuid_list=ids_test)
</pre>
</div>
Expand Down Expand Up @@ -9602,8 +9595,8 @@ <h4 id="In-order-to-figure-out-which-of-the-IDs-from-your-list-do-not-exist-in-t
<div class="jp-OutputPrompt jp-OutputArea-prompt">Out[35]:</div>
<div class="jp-RenderedText jp-OutputArea-output jp-OutputArea-executeResult" data-mime-type="text/plain" tabindex="0">
<pre>['0000fabc-0e15-4d76-b44c-4f152f31de09',
'0000403e-51da-43b0-a0e9-e806ea31ca9e',
'00001c20-b7ff-4367-af08-26432cd7e01d',
'0000403e-51da-43b0-a0e9-e806ea31ca9e',
'ddbb57ee-8e90-4a0d-823b-0f5d97028076',
'000025da-914b-4b67-b9a9-97cc811b0459']</pre>
</div>
Expand Down