Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke-takase committed Apr 30, 2024
1 parent 2023516 commit 5e25a9e
Show file tree
Hide file tree
Showing 36 changed files with 7,934 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
grasp2alm.egg-info/
grasp2alm/__pycache__/
dist/
build/
docs/_build/
docs/_templates/
test/__pycache__
.pytest_cache/
Binary file added docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/grasp2alm.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/modules.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +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: 0036968fc7396876b56011d33976fa9e
tags: 645f666f9bcd5a90fca523b33c5a78b7
250 changes: 250 additions & 0 deletions docs/_build/html/_modules/grasp2alm/beam2alm.html

Large diffs are not rendered by default.

302 changes: 302 additions & 0 deletions docs/_build/html/_modules/grasp2alm/beam_cut.html

Large diffs are not rendered by default.

362 changes: 362 additions & 0 deletions docs/_build/html/_modules/grasp2alm/beam_grid.html

Large diffs are not rendered by default.

227 changes: 227 additions & 0 deletions docs/_build/html/_modules/grasp2alm/beam_map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<!DOCTYPE html>

<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>grasp2alm.beam_map &#8212; grasp2alm 0.1.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=12dfc556" />
<script src="../../_static/documentation_options.js?v=01f34227"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />

<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />





</head><body>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">


<div class="body" role="main">

<h1>Source code for grasp2alm.beam_map</h1><div class="highlight"><pre>
<span></span><span class="c1"># -*- encoding: utf-8 -*-</span>

<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">healpy</span> <span class="k">as</span> <span class="nn">hp</span>

<div class="viewcode-block" id="BeamMap">
<a class="viewcode-back" href="../../grasp2alm.html#grasp2alm.beam_map.BeamMap">[docs]</a>
<span class="k">class</span> <span class="nc">BeamMap</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Represents a beam map.</span>

<span class="sd"> Attributes:</span>
<span class="sd"> nside (int): The resolution parameter of the map.</span>
<span class="sd"> map (numpy.ndarray): The beam map data.</span>

<span class="sd"> Methods:</span>
<span class="sd"> to_alm(lmax, mmax): Converts the beam map to spherical harmonic coefficients.</span>

<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">map</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nside</span> <span class="o">=</span> <span class="n">hp</span><span class="o">.</span><span class="n">npix2nside</span><span class="p">(</span><span class="nb">map</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">map</span> <span class="o">=</span> <span class="nb">map</span>

<div class="viewcode-block" id="BeamMap.to_alm">
<a class="viewcode-back" href="../../grasp2alm.html#grasp2alm.beam_map.BeamMap.to_alm">[docs]</a>
<span class="k">def</span> <span class="nf">to_alm</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">lmax</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">mmax</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="nb">iter</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
<span class="n">pol</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">use_weights</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">datapath</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">gal_cut</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">use_pixel_weights</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Converts the beam map to spherical harmonic coefficients.</span>

<span class="sd"> Args:</span>
<span class="sd"> lmax (int): Maximum l value for the spherical harmonic expansion.</span>
<span class="sd"> mmax (int): Maximum m value for the spherical harmonic expansion.</span>
<span class="sd"> iter : int, scalar, optional</span>
<span class="sd"> Number of iteration (default: 3)</span>
<span class="sd"> pol : bool, optional</span>
<span class="sd"> If True, assumes input maps are TQU. Output will be TEB alm&#39;s.</span>
<span class="sd"> (input must be 1 or 3 maps)</span>
<span class="sd"> If False, apply spin 0 harmonic transform to each map.</span>
<span class="sd"> (input can be any number of maps)</span>
<span class="sd"> If there is only one input map, it has no effect. Default: True.</span>
<span class="sd"> use_weights : bool, scalar, optional</span>
<span class="sd"> If True, use the ring weighting. Default: False.</span>
<span class="sd"> datapath : None or str, optional</span>
<span class="sd"> If given, the directory where to find the pixel weights.</span>
<span class="sd"> See in the docstring above details on how to set it up.</span>
<span class="sd"> gal_cut : float [degrees]</span>
<span class="sd"> pixels at latitude in [-gal_cut;+gal_cut] are not taken into account</span>
<span class="sd"> use_pixel_weights: bool, optional</span>
<span class="sd"> If True, use pixel by pixel weighting, healpy will automatically download the weights, if needed</span>

<span class="sd"> Returns:</span>
<span class="sd"> numpy.ndarray: The spherical harmonic coefficients.</span>

<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If lmax is greater than 3*nside-1 or if mmax is greater than lmax.</span>

<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">map</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&lt;=</span><span class="mi">3</span> <span class="p">,</span> <span class="s2">&quot;Error in BeamMap.to_alm: map has more than 3 Stokes parameters&quot;</span>

<span class="n">alm</span> <span class="o">=</span> <span class="n">hp</span><span class="o">.</span><span class="n">map2alm</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">map</span><span class="p">,</span>
<span class="n">lmax</span><span class="o">=</span><span class="n">lmax</span><span class="p">,</span>
<span class="n">mmax</span><span class="o">=</span><span class="n">mmax</span><span class="p">,</span>
<span class="nb">iter</span><span class="o">=</span><span class="nb">iter</span><span class="p">,</span>
<span class="n">pol</span><span class="o">=</span><span class="n">pol</span><span class="p">,</span>
<span class="n">use_weights</span><span class="o">=</span><span class="n">use_weights</span><span class="p">,</span>
<span class="n">datapath</span><span class="o">=</span><span class="n">datapath</span><span class="p">,</span>
<span class="n">gal_cut</span><span class="o">=</span><span class="n">gal_cut</span><span class="p">,</span>
<span class="n">use_pixel_weights</span><span class="o">=</span><span class="n">use_pixel_weights</span>
<span class="p">)</span>
<span class="k">return</span> <span class="n">alm</span></div>


<div class="viewcode-block" id="BeamMap.to_alm_lsq">
<a class="viewcode-back" href="../../grasp2alm.html#grasp2alm.beam_map.BeamMap.to_alm_lsq">[docs]</a>
<span class="k">def</span> <span class="nf">to_alm_lsq</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">lmax</span><span class="p">,</span>
<span class="n">mmax</span><span class="p">,</span>
<span class="n">pol</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">tol</span><span class="o">=</span><span class="mf">1e-10</span><span class="p">,</span>
<span class="n">maxiter</span><span class="o">=</span><span class="mi">20</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Converts the beam map to spherical harmonic coefficients by using healpy.map2alm_lsq.</span>

<span class="sd"> Args:</span>
<span class="sd"> lmax, mmax : int</span>
<span class="sd"> The desired lmax and mmax parameters for the analysis</span>
<span class="sd"> pol : bool, optional</span>
<span class="sd"> If True, assumes input maps are TQU. Output will be TEB alm&#39;s.</span>
<span class="sd"> (input must be 1 or 3 maps)</span>
<span class="sd"> If False, apply spin 0 harmonic transform to each map.</span>
<span class="sd"> (input can be any number of maps)</span>
<span class="sd"> If there is only one input map, it has no effect. Default: True.</span>
<span class="sd"> tol : float</span>
<span class="sd"> The desired accuracy for the result. Once this is reached,</span>
<span class="sd"> the iteration stops.</span>
<span class="sd"> maxiter : int</span>
<span class="sd"> maximum iteration count after which the minimization is stopped</span>

<span class="sd"> Returns:</span>
<span class="sd"> numpy.ndarray: The spherical harmonic coefficients.</span>

<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If lmax is greater than 3*nside-1 or if mmax is greater than lmax.</span>

<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">map</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&lt;=</span><span class="mi">3</span> <span class="p">,</span> <span class="s2">&quot;Error in BeamMap.to_alm: map has more than 3 Stokes parameters&quot;</span>

<span class="n">alm</span> <span class="o">=</span> <span class="n">hp</span><span class="o">.</span><span class="n">map2alm_lsq</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">map</span><span class="p">,</span>
<span class="n">lmax</span><span class="p">,</span>
<span class="n">mmax</span><span class="p">,</span>
<span class="n">pol</span><span class="o">=</span><span class="n">pol</span><span class="p">,</span>
<span class="n">tol</span><span class="o">=</span><span class="n">tol</span><span class="p">,</span>
<span class="n">maxiter</span><span class="o">=</span><span class="n">maxiter</span>
<span class="p">)</span>
<span class="k">return</span> <span class="n">alm</span></div>
</div>

</pre></div>

</div>

</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../index.html">grasp2alm</a></h1>








<h3>Navigation</h3>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>








</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, Yusuke Takase.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>

</div>




</body>
</html>
Loading

0 comments on commit 5e25a9e

Please sign in to comment.