-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
- Loading branch information
There are no files selected for viewing
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: 060cbbd8ea6b8c947c6c595b60eccb00 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<!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>astrophot.models.flatsky_model — AstroPhot 0.13.0 documentation</title> | ||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> | ||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> | ||
<link rel="shortcut icon" href="../../../_static/AP_logo_favicon.ico"/> | ||
<!--[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=1019fba8"></script> | ||
<script src="../../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></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 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"> | ||
AstroPhot | ||
</a> | ||
<div class="version"> | ||
0.13 | ||
</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="../../../install.html">Installation</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../getting_started.html">Getting Started</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../tutorials.html">Tutorials</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../coordinates.html">Coordinates</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../troubleshooting.html">Troubleshooting</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../citation.html">Citing AstroPhot</a></li> | ||
</ul> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">astrophot</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../configfile_interface.html">Configuration File Interface</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../license.html">LICENSE</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html">Contributing</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">AstroPhot</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"><a href="../../astrophot.html">astrophot</a></li> | ||
<li class="breadcrumb-item active">astrophot.models.flatsky_model</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 astrophot.models.flatsky_model</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> | ||
<span class="kn">from</span> <span class="nn">scipy.stats</span> <span class="kn">import</span> <span class="n">iqr</span> | ||
<span class="kn">import</span> <span class="nn">torch</span> | ||
|
||
<span class="kn">from</span> <span class="nn">..utils.decorators</span> <span class="kn">import</span> <span class="n">ignore_numpy_warnings</span><span class="p">,</span> <span class="n">default_internal</span> | ||
<span class="kn">from</span> <span class="nn">..param</span> <span class="kn">import</span> <span class="n">Param_Unlock</span><span class="p">,</span> <span class="n">Param_SoftLimits</span> | ||
<span class="kn">from</span> <span class="nn">.sky_model_object</span> <span class="kn">import</span> <span class="n">Sky_Model</span> | ||
<span class="kn">from</span> <span class="nn">._shared_methods</span> <span class="kn">import</span> <span class="n">select_target</span> | ||
|
||
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"Flat_Sky"</span><span class="p">]</span> | ||
|
||
|
||
<div class="viewcode-block" id="Flat_Sky"> | ||
<a class="viewcode-back" href="../../../astrophot.models.html#astrophot.models.flatsky_model.Flat_Sky">[docs]</a> | ||
<span class="k">class</span> <span class="nc">Flat_Sky</span><span class="p">(</span><span class="n">Sky_Model</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""Model for the sky background in which all values across the image</span> | ||
<span class="sd"> are the same.</span> | ||
|
||
<span class="sd"> Parameters:</span> | ||
<span class="sd"> sky: brightness for the sky, represented as the log of the brightness over pixel scale squared, this is proportional to a surface brightness</span> | ||
|
||
<span class="sd"> """</span> | ||
|
||
<span class="n">model_type</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"flat </span><span class="si">{</span><span class="n">Sky_Model</span><span class="o">.</span><span class="n">model_type</span><span class="si">}</span><span class="s2">"</span> | ||
<span class="n">parameter_specs</span> <span class="o">=</span> <span class="p">{</span> | ||
<span class="s2">"F"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"units"</span><span class="p">:</span> <span class="s2">"log10(flux/arcsec^2)"</span><span class="p">},</span> | ||
<span class="p">}</span> | ||
<span class="n">_parameter_order</span> <span class="o">=</span> <span class="n">Sky_Model</span><span class="o">.</span><span class="n">_parameter_order</span> <span class="o">+</span> <span class="p">(</span><span class="s2">"F"</span><span class="p">,)</span> | ||
<span class="n">useable</span> <span class="o">=</span> <span class="kc">True</span> | ||
|
||
<div class="viewcode-block" id="Flat_Sky.initialize"> | ||
<a class="viewcode-back" href="../../../astrophot.models.html#astrophot.models.flatsky_model.Flat_Sky.initialize">[docs]</a> | ||
<span class="nd">@torch</span><span class="o">.</span><span class="n">no_grad</span><span class="p">()</span> | ||
<span class="nd">@ignore_numpy_warnings</span> | ||
<span class="nd">@select_target</span> | ||
<span class="nd">@default_internal</span> | ||
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | ||
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="n">target</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="n">parameters</span><span class="p">)</span> | ||
|
||
<span class="k">with</span> <span class="n">Param_Unlock</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]),</span> <span class="n">Param_SoftLimits</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]):</span> | ||
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">median</span><span class="p">(</span><span class="n">target</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">window</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> <span class="o">/</span> <span class="n">target</span><span class="o">.</span><span class="n">pixel_area</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">uncertainty</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">uncertainty</span> <span class="o">=</span> <span class="p">(</span> | ||
<span class="p">(</span> | ||
<span class="n">iqr</span><span class="p">(</span> | ||
<span class="n">target</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">window</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">(),</span> | ||
<span class="n">rng</span><span class="o">=</span><span class="p">(</span><span class="mf">31.731</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">100</span> <span class="o">-</span> <span class="mf">31.731</span> <span class="o">/</span> <span class="mi">2</span><span class="p">),</span> | ||
<span class="p">)</span> | ||
<span class="o">/</span> <span class="p">(</span><span class="mf">2.0</span> <span class="o">*</span> <span class="n">target</span><span class="o">.</span><span class="n">pixel_area</span><span class="o">.</span><span class="n">item</span><span class="p">())</span> | ||
<span class="p">)</span> | ||
<span class="o">/</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">prod</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">window</span><span class="o">.</span><span class="n">shape</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()))</span> | ||
<span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="mi">10</span> <span class="o">**</span> <span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="o">.</span><span class="n">item</span><span class="p">()</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="mi">10</span><span class="p">))</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="Flat_Sky.evaluate_model"> | ||
<a class="viewcode-back" href="../../../astrophot.models.html#astrophot.models.flatsky_model.Flat_Sky.evaluate_model">[docs]</a> | ||
<span class="k">def</span> <span class="nf">evaluate_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">X</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">Y</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | ||
<span class="n">ref</span> <span class="o">=</span> <span class="n">image</span><span class="o">.</span><span class="n">data</span> <span class="k">if</span> <span class="n">X</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">X</span> | ||
<span class="k">return</span> <span class="n">torch</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">ref</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">image</span><span class="o">.</span><span class="n">pixel_area</span> <span class="o">*</span> <span class="mi">10</span> <span class="o">**</span> <span class="n">parameters</span><span class="p">[</span><span class="s2">"F"</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2023, Connor Stone.</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> |