Skip to content

Commit

Permalink
deploy: aa70c0a
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewtownson committed Sep 4, 2023
0 parents commit e91b2b0
Show file tree
Hide file tree
Showing 93 changed files with 15,156 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .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: bd13a08284c44c1698b81771e6e4773a
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/astronomy.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/fft.doctree
Binary file not shown.
Binary file added .doctrees/image_processing.doctree
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/interpolation.doctree
Binary file not shown.
Binary file added .doctrees/introduction.doctree
Binary file not shown.
Binary file added .doctrees/opticalpropagation.doctree
Binary file not shown.
Binary file added .doctrees/pupil.doctree
Binary file not shown.
Binary file added .doctrees/turbulence.doctree
Binary file not shown.
Binary file added .doctrees/wfs.doctree
Binary file not shown.
Binary file added .doctrees/zernike.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
233 changes: 233 additions & 0 deletions _modules/aotools/astronomy/_astronomy.html

Large diffs are not rendered by default.

293 changes: 293 additions & 0 deletions _modules/aotools/fouriertransform.html

Large diffs are not rendered by default.

817 changes: 817 additions & 0 deletions _modules/aotools/functions/karhunenLoeve.html

Large diffs are not rendered by default.

212 changes: 212 additions & 0 deletions _modules/aotools/functions/pupil.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aotools.functions.pupil &mdash; AOtools 0+untagged.1.gaa70c0a documentation</title>
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=16dd3b84"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="../../../index.html" class="icon icon-home">
AOtools
</a>
<div class="version">
1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../turbulence.html">Atmospheric Turbulence</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../image_processing.html">Image Processing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../zernike.html">Circular Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../pupil.html">Telescope Pupils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../wfs.html">Wavefront Sensors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../opticalpropagation.html">Optical Propagation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../astronomy.html">Astronomical Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../fft.html">Normalised Fourier Transforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../interpolation.html">Interpolation</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../index.html">AOtools</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../../index.html">Module code</a></li>
<li class="breadcrumb-item active">aotools.functions.pupil</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>Source code for aotools.functions.pupil</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Pupil Maps</span>
<span class="sd">----------</span>

<span class="sd">Functions for the creation of pupil maps and masks.</span>

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

<span class="kn">import</span> <span class="nn">numpy</span>


<div class="viewcode-block" id="circle">
<a class="viewcode-back" href="../../../pupil.html#aotools.functions.pupil.circle">[docs]</a>
<span class="k">def</span> <span class="nf">circle</span><span class="p">(</span><span class="n">radius</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">circle_centre</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">origin</span><span class="o">=</span><span class="s2">&quot;middle&quot;</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Create a 2-D array: elements equal 1 within a circle and 0 outside.</span>

<span class="sd"> The default centre of the coordinate system is in the middle of the array:</span>
<span class="sd"> circle_centre=(0,0), origin=&quot;middle&quot;</span>
<span class="sd"> This means:</span>
<span class="sd"> if size is odd : the centre is in the middle of the central pixel</span>
<span class="sd"> if size is even : centre is in the corner where the central 4 pixels meet</span>

<span class="sd"> origin = &quot;corner&quot; is used e.g. by psfAnalysis:radialAvg()</span>

<span class="sd"> Examples: ::</span>

<span class="sd"> circle(1,5) circle(0,5) circle(2,5) circle(0,4) circle(0.8,4) circle(2,4)</span>
<span class="sd"> 00000 00000 00100 0000 0000 0110</span>
<span class="sd"> 00100 00000 01110 0000 0110 1111</span>
<span class="sd"> 01110 00100 11111 0000 0110 1111</span>
<span class="sd"> 00100 00000 01110 0000 0000 0110</span>
<span class="sd"> 00000 00000 00100</span>

<span class="sd"> circle(1,5,(0.5,0.5)) circle(1,4,(0.5,0.5))</span>
<span class="sd"> .--&gt;+</span>
<span class="sd"> | 00000 0000</span>
<span class="sd"> | 00000 0010</span>
<span class="sd"> +V 00110 0111</span>
<span class="sd"> 00110 0010</span>
<span class="sd"> 00000</span>

<span class="sd"> Parameters:</span>
<span class="sd"> radius (float) : radius of the circle</span>
<span class="sd"> size (int) : size of the 2-D array in which the circle lies</span>
<span class="sd"> circle_centre (tuple): coords of the centre of the circle</span>
<span class="sd"> origin (str) : where is the origin of the coordinate system</span>
<span class="sd"> in which circle_centre is given;</span>
<span class="sd"> allowed values: {&quot;middle&quot;, &quot;corner&quot;}</span>

<span class="sd"> Returns:</span>
<span class="sd"> ndarray (float64) : the circle array</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># (2) Generate the output array:</span>
<span class="n">C</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="n">size</span><span class="p">,</span> <span class="n">size</span><span class="p">))</span>

<span class="c1"># (3.a) Generate the 1-D coordinates of the pixel&#39;s centres:</span>
<span class="c1"># coords = numpy.linspace(-size/2.,size/2.,size) # Wrong!!:</span>
<span class="c1"># size = 5: coords = array([-2.5 , -1.25, 0. , 1.25, 2.5 ])</span>
<span class="c1"># size = 6: coords = array([-3. , -1.8, -0.6, 0.6, 1.8, 3. ])</span>
<span class="c1"># (2015 Mar 30; delete this comment after Dec 2015 at the latest.)</span>

<span class="c1"># Before 2015 Apr 7 (delete 2015 Dec at the latest):</span>
<span class="c1"># coords = numpy.arange(-size/2.+0.5, size/2.-0.4, 1.0)</span>
<span class="c1"># size = 5: coords = array([-2., -1., 0., 1., 2.])</span>
<span class="c1"># size = 6: coords = array([-2.5, -1.5, -0.5, 0.5, 1.5, 2.5])</span>

<span class="n">coords</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span>
<span class="c1"># size = 5: coords = [ 0.5 1.5 2.5 3.5 4.5]</span>
<span class="c1"># size = 6: coords = [ 0.5 1.5 2.5 3.5 4.5 5.5]</span>

<span class="c1"># (3.b) Just an internal sanity check:</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">coords</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">exceptions</span><span class="o">.</span><span class="n">Bug</span><span class="p">(</span><span class="s2">&quot;len(coords) = </span><span class="si">{0}</span><span class="s2">, &quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">coords</span><span class="p">))</span> <span class="o">+</span>
<span class="s2">&quot;size = </span><span class="si">{0}</span><span class="s2">. They must be equal.&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">size</span><span class="p">)</span> <span class="o">+</span>
<span class="s2">&quot;</span><span class="se">\n</span><span class="s2"> Debug the line </span><span class="se">\&quot;</span><span class="s2">coords = ...</span><span class="se">\&quot;</span><span class="s2">.&quot;</span><span class="p">)</span>

<span class="c1"># (3.c) Generate the 2-D coordinates of the pixel&#39;s centres:</span>
<span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="n">coords</span><span class="p">,</span> <span class="n">coords</span><span class="p">)</span>

<span class="c1"># (3.d) Move the circle origin to the middle of the grid, if required:</span>
<span class="k">if</span> <span class="n">origin</span> <span class="o">==</span> <span class="s2">&quot;middle&quot;</span><span class="p">:</span>
<span class="n">x</span> <span class="o">-=</span> <span class="n">size</span> <span class="o">/</span> <span class="mf">2.</span>
<span class="n">y</span> <span class="o">-=</span> <span class="n">size</span> <span class="o">/</span> <span class="mf">2.</span>

<span class="c1"># (3.e) Move the circle centre to the alternative position, if provided:</span>
<span class="n">x</span> <span class="o">-=</span> <span class="n">circle_centre</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">y</span> <span class="o">-=</span> <span class="n">circle_centre</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>

<span class="c1"># (4) Calculate the output:</span>
<span class="c1"># if distance(pixel&#39;s centre, circle_centre) &lt;= radius:</span>
<span class="c1"># output = 1</span>
<span class="c1"># else:</span>
<span class="c1"># output = 0</span>
<span class="n">mask</span> <span class="o">=</span> <span class="n">x</span> <span class="o">*</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span> <span class="o">*</span> <span class="n">y</span> <span class="o">&lt;=</span> <span class="n">radius</span> <span class="o">*</span> <span class="n">radius</span>
<span class="n">C</span><span class="p">[</span><span class="n">mask</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>

<span class="c1"># (5) Return:</span>
<span class="k">return</span> <span class="n">C</span></div>

</pre></div>

</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2019, The Authors.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
Loading

0 comments on commit e91b2b0

Please sign in to comment.