Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9c93fcc 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Aug 29, 2023
1 parent 4f40e1f commit 065ca25
Show file tree
Hide file tree
Showing 158 changed files with 198,177 additions and 1,863 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: eb0e45bbee06ee7a51ab1bc473d6129c
config: 4d5ac573c37e2cd08cc5c72be4182d3f
tags: 645f666f9bcd5a90fca523b33c5a78b7
675 changes: 675 additions & 0 deletions _collections/notebooks/00-MOCpy_introduction.html

Large diffs are not rendered by default.

84,595 changes: 84,595 additions & 0 deletions _collections/notebooks/00-MOCpy_introduction.ipynb

Large diffs are not rendered by default.

287 changes: 287 additions & 0 deletions _collections/notebooks/FITS-image-pixels-intersecting-MOC.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
<!DOCTYPE html>

<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<title>Overlay the MOC of Spitzer on a 2MASS cutout &#8212; MOCPy 0.13.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/mocpy.css?v=b2680190" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../../_static/sg_gallery.css?v=61a4c737" />
<link rel="stylesheet" type="text/css" href="../../_static/nbsphinx-code-cells.css" />

<script src="../../_static/documentation_options.js?v=1019fba8"></script>
<script src="../../_static/doctools.js?v=888ff710"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../../_static/copybutton.js?v=f281be69"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script>window.MathJax = {"tex": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true}, "options": {"ignoreHtmlClass": "tex2jax_ignore|mathjax_ignore|document", "processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script type="text/javascript" src="../../_static/sidebar.js"></script>
<script type="text/javascript" src="../../_static/copybutton.js"></script>
<link rel="icon" href="../../_static/MOCpy-icon.svg"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Create a MOC from an astropy Table" href="from_astropy_table.html" />
<link rel="prev" title="Create a MOC from a filtered astropy Table" href="filtering_astropy_table.html" />
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600' rel='stylesheet' type='text/css'/>

</head><body>
<div class="topbar">
<a class="brand" title="Documentation Home" href="../../index.html"><span id="logotext1">MOC</span><span id="logotext2">py</span><span id="logotext3">:docs</span></a>
<ul>

<li><a class="homelink" title="Astropy Homepage" href="http://www.astropy.org"></a></li>
<li><a title="General Index" href="../../genindex.html">Index</a></li>
<li><a title="Module Index" href="../../py-modindex.html">Modules</a></li>
<li>


<form action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>

</li>
</ul>
</div>

<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right">
<a href="from_astropy_table.html" title="Create a MOC from an astropy Table">
next &raquo;
</a>
</li>
<li class="right">
<a href="filtering_astropy_table.html" title="Create a MOC from a filtered astropy Table">
&laquo; previous
</a>
|
</li>
<li>
<a href="../../index.html">MOCPy 0.13.0 documentation</a>
&#187;
</li>
<li><a href="../../examples/user_documentation.html" accesskey="U">User documentation</a> &#187;</li>

<li>Overlay the MOC of Spitzer on a 2MASS cutout</li>
</ul>
</div>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<section id="Overlay-the-MOC-of-Spitzer-on-a-2MASS-cutout">
<h1>Overlay the MOC of Spitzer on a 2MASS cutout<a class="headerlink" href="#Overlay-the-MOC-of-Spitzer-on-a-2MASS-cutout" title="Link to this heading"></a></h1>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>from astropy.io import fits
from astropy.wcs import WCS as WCS
from mocpy import MOC
from astropy.visualization import simple_norm
import astropy.units as u
import numpy as np
import matplotlib.pyplot as plt
</pre></div>
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[2]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># load 2MASS cutout covering the galactic plane
hdu = fits.open(
&quot;http://alasky.u-strasbg.fr/hips-image-services/hips2fits?hips=CDS%2FP%2F2MASS%2FK&amp;width=1200&amp;height=700&amp;fov=30&amp;projection=TAN&amp;coordsys=galactic&amp;rotation_angle=0.0&amp;object=gal%20center&amp;format=fits&quot;,
)
</pre></div>
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[3]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># load Spitzer MOC
moc = MOC.from_fits(&quot;http://skies.esac.esa.int/Spitzer/IRAC1_bright_ISM/Moc.fits&quot;)
</pre></div>
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[4]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># create WCS from 2MASS image header
twomass_wcs = WCS(header=hdu[0].header)
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[5]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>fig = plt.figure(111, figsize=(15, 10))
ax = fig.add_subplot(1, 1, 1, projection=twomass_wcs)
moc.fill(ax=ax, wcs=twomass_wcs, alpha=0.3, color=&quot;red&quot;)
im = ax.imshow(
hdu[0].data,
origin=&quot;lower&quot;,
norm=simple_norm(hdu[0].data, &quot;sqrt&quot;, min_cut=0, max_cut=150),
)
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../../_images/_collections_notebooks_FITS-image-pixels-intersecting-MOC_5_0.png" src="../../_images/_collections_notebooks_FITS-image-pixels-intersecting-MOC_5_0.png" />
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[6]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># compute skycoords for every pixel of the image
width = hdu[0].header[&quot;NAXIS1&quot;]
height = hdu[0].header[&quot;NAXIS2&quot;]

xv, yv = np.meshgrid(np.arange(0, width), np.arange(0, height))
skycoords = twomass_wcs.pixel_to_world(xv, yv)
</pre></div>
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[7]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>ra, dec = skycoords.icrs.ra.deg, skycoords.icrs.dec.deg
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[8]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>mask_in_moc = moc.contains(ra * u.deg, dec * u.deg)
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area stderr docutils container">
<div class="highlight"><pre>
/tmp/ipykernel_326933/2840231297.py:1: DeprecationWarning: This method is deprecated and has been replaced by contains_lonlat
mask_in_moc = moc.contains(ra * u.deg, dec * u.deg)
</pre></div></div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[9]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>img = hdu[0].data
img_test = img.copy()

img_test[~mask_in_moc] = 0
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[10]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>fig = plt.figure(111, figsize=(15, 10))
ax = fig.add_subplot(1, 1, 1, projection=twomass_wcs)

im = ax.imshow(
img_test,
origin=&quot;lower&quot;,
norm=simple_norm(hdu[0].data, &quot;sqrt&quot;, min_cut=0, max_cut=150),
)
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../../_images/_collections_notebooks_FITS-image-pixels-intersecting-MOC_10_0.png" src="../../_images/_collections_notebooks_FITS-image-pixels-intersecting-MOC_10_0.png" />
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[11]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># number of pixels in the mask
np.sum(img[mask_in_moc])
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[11]:
</pre></div>
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
8690767.0
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[12]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># number of pixels in the entire image
np.sum(img)
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[12]:
</pre></div>
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
14976694.0
</pre></div></div>
</div>
</section>


<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"><h3>Page Contents</h3>
<ul>
<li><a class="reference internal" href="#">Overlay the MOC of Spitzer on a 2MASS cutout</a></li>
</ul>


</div>
</div>
<div class="clearer"></div>
</div>
<footer class="footer">
<p class="pull-right">
<a href="../../_sources/_collections/notebooks/FITS-image-pixels-intersecting-MOC.ipynb.txt"
rel="nofollow">Page Source</a> &nbsp;
<a href="#">Back to Top</a></p>
<p>
&copy; Copyright 2023, Matthieu Baumann &lt;matthieu.baumann@astro.unistra.fr&gt; Thomas Boch &lt;thomas.boch@astro.unistra.fr&gt; Manon Marchand &lt;manon.marchand@astro.unistra.fr&gt; F.-X. Pineau &lt;francois-xavier.pineau@astro.unistra.fr&gt;.<br/>
Last built 29 Aug 2023. <br/>
</p>
</footer>
</body>
</html>
246 changes: 246 additions & 0 deletions _collections/notebooks/FITS-image-pixels-intersecting-MOC.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 065ca25

Please sign in to comment.