Commit 403203d6 authored by GZhao's avatar GZhao
Browse files

test import html

parent b8ecf971
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>csst_cpic_sim package &mdash; csst_cpic_sim 1.0.0 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 data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></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" />
<link rel="prev" title="点扩散函数仿真" href="notebooks/5_psf_example.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">
csst_cpic_sim
</a>
<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 class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">程序安装</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorials.html">使用说明</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">代码说明</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-main-module">csst_cpic_sim.main module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-target-module">csst_cpic_sim.target module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-optics-module">csst_cpic_sim.optics module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-camera-module">csst_cpic_sim.camera module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-io-module">csst_cpic_sim.io module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-config-module">csst_cpic_sim.config module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#csst-cpic-sim-utils-module">csst_cpic_sim.utils module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-csst_cpic_sim">Module contents</a></li>
</ul>
</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">csst_cpic_sim</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 active">csst_cpic_sim package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cpism.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="csst-cpic-sim-package">
<h1>csst_cpic_sim package<a class="headerlink" href="#csst-cpic-sim-package" title="Permalink to this heading"></a></h1>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading"></a></h2>
</section>
<section id="csst-cpic-sim-main-module">
<h2>csst_cpic_sim.main module<a class="headerlink" href="#csst-cpic-sim-main-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.main"></span><dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.main.deduplicate_names_add_count">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.main.</span></span><span class="sig-name descname"><span class="pre">deduplicate_names_add_count</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">names</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.main.deduplicate_names_add_count" title="Permalink to this definition"></a></dt>
<dd><p>remove duplicate names and add count</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.main.main">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.main.</span></span><span class="sig-name descname"><span class="pre">main</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.main.main" title="Permalink to this definition"></a></dt>
<dd><p>Command line interface of csst_cpic_sim</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>argv</strong> (<em>list</em>) – input arguments. Default is None. If None, sys.argv is used.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.main.observation_simulation_from_config">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.main.</span></span><span class="sig-name descname"><span class="pre">observation_simulation_from_config</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obs_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config_file</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.main.observation_simulation_from_config" title="Permalink to this definition"></a></dt>
<dd><p>Run observation simulation from config file</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obs_file</strong> (<em>str</em>) – observation file or folder.</p></li>
<li><p><strong>config_file</strong> (<em>str</em>) – config file.</p></li>
<li><p><strong>Examples</strong> – see examples in <cite>example</cite> folder.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.main.quick_run_v2">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.main.</span></span><span class="sig-name descname"><span class="pre">quick_run_v2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target_str</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">band</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expt</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">emgain</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nframe</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skybg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rotation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shift</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[0,</span> <span class="pre">0]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">emset_input</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cr_frame</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">camera_effect</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prograss_bar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.main.quick_run_v2" title="Permalink to this definition"></a></dt>
<dd><p>A quick run function for CPIC.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target_str</strong> (<em>str</em>) – target string. See the input of <cite>target.target_file_load</cite> for more details.</p></li>
<li><p><strong>band</strong> (<em>str</em>) – band name</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – exposure time in unit of second</p></li>
<li><p><strong>emgain</strong> (<em>float</em>) – EM gain value. Note that emgain is not the same as emset, controled by emset_input keyword.</p></li>
<li><p><strong>nframe</strong> (<em>int</em>) – number of frames</p></li>
<li><p><strong>skybg</strong> (<em>float</em><em> or </em><em>None</em>) – sky background in unit of magnitude. If None, sky background will not be set.</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – rotation of the telescope. in unit of degree. 0 means North is up.</p></li>
<li><p><strong>shift</strong> (<em>list</em>) – target shift in unit of arcsec</p></li>
<li><p><strong>emset_input</strong> (<em>bool</em>) – if True, emgain paramter is emset. Else, emgain is set using emgain parameter.</p></li>
<li><p><strong>cr_frame</strong> (<em>bool</em>) – if True, cosmic ray frame will be added to the image.</p></li>
<li><p><strong>camera_effect</strong> (<em>bool</em>) – if True, camera effect will be added to the image.</p></li>
<li><p><strong>prograss_bar</strong> (<em>bool</em>) – if True, a prograss_bar will be shown.</p></li>
<li><p><strong>output</strong> (<em>str</em>) – the output directory.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image_cube</strong></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.main.vis_observation">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.main.</span></span><span class="sig-name descname"><span class="pre">vis_observation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">target:</span> <span class="pre">dict,</span> <span class="pre">skybg:</span> <span class="pre">float,</span> <span class="pre">expt:</span> <span class="pre">float,</span> <span class="pre">nframe:</span> <span class="pre">int,</span> <span class="pre">band:</span> <span class="pre">str,</span> <span class="pre">emset:</span> <span class="pre">int,</span> <span class="pre">obsid:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">41000000000,</span> <span class="pre">rotation:</span> <span class="pre">float</span> <span class="pre">=</span> <span class="pre">0,</span> <span class="pre">shift:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">[0,</span> <span class="pre">0],</span> <span class="pre">gnc_info:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">{},</span> <span class="pre">csst_format:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">True,</span> <span class="pre">camera=&lt;csst_cpic_sim.camera.CpicVisEmccd</span> <span class="pre">object&gt;,</span> <span class="pre">crmaker=&lt;csst_cpic_sim.camera.CosmicRayFrameMaker</span> <span class="pre">object&gt;,</span> <span class="pre">nsample:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">1,</span> <span class="pre">emgain=None,</span> <span class="pre">prograss_bar=None,</span> <span class="pre">output='./'</span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.main.vis_observation" title="Permalink to this definition"></a></dt>
<dd><p>Observation simulation main process on visable band using EMCCD.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<em>dict</em>) – target dictionary. See the input of <cite>target.spectrum_generator</cite> for more details.</p></li>
<li><p><strong>skybg</strong> (<em>float</em>) – sky background in unit of magnitude/arcsec^2</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – exposure time in unit of second</p></li>
<li><p><strong>nframe</strong> (<em>int</em>) – number of frames</p></li>
<li><p><strong>band</strong> (<em>str</em>) – band name</p></li>
<li><p><strong>emset</strong> (<em>int</em>) – EM gain setting value. 1023(0x3FF) for ~1.0× EM gain.</p></li>
<li><p><strong>obsid</strong> (<em>int</em>) – observation ID. Start from 4 for CPIC, 01 for science observation. See the input of io.obsid_parser for more details.</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – rotation of the telescope. in unit of degree. 0 means North is up.</p></li>
<li><p><strong>shift</strong> (<em>list</em>) – target shift in unit of arcsec</p></li>
<li><p><strong>gnc_info</strong> (<em>dict</em>) – gnc_info dictionary. See the input of io.primary_hdu for more details.</p></li>
<li><p><strong>csst_format</strong> (<em>bool</em>) – if True, the output fits file will be in the csst format.</p></li>
<li><p><strong>crmaker</strong> (<a class="reference internal" href="#csst_cpic_sim.camera.CosmicRayFrameMaker" title="csst_cpic_sim.camera.CosmicRayFrameMaker"><em>CosmicRayFrameMaker</em></a>) – CosmicRayFrameMaker object. See the input of camera.CosmicRayFrameMaker for more details.</p></li>
<li><p><strong>nsample</strong> (<em>int</em>) – number of samples for wide bandpass.</p></li>
<li><p><strong>emgain</strong> (<em>float</em><em> or </em><em>None</em>) – if None, emgain are set using emset parameter. Else, emgain are set using emgain parameter.</p></li>
<li><p><strong>prograss_bar</strong> (<em>bool</em>) – if True, a prograss_bar will be shown.</p></li>
<li><p><strong>output</strong> (<em>str</em>) – the output directory.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image_cube</strong></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="csst-cpic-sim-target-module">
<h2>csst_cpic_sim.target module<a class="headerlink" href="#csst-cpic-sim-target-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.target"></span><dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.target.AlbedoCat">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">AlbedoCat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">phase</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metallicity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">f_sed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.target.AlbedoCat" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">TabularSpectralElement</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">Icat</span></code></p>
<p>Generate albedo spectrum from the planet reflection model in Batalha et al. 2018</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>phase</strong> (<em>float</em>) – [degree], The phase angle of the planet, range from 0 to 180.</p></li>
<li><p><strong>metallicity</strong> (<em>float</em>) – The metallicity of the planet. log(Z/Zsun), range from 0 to 2.</p></li>
<li><p><strong>f_sed</strong> (<em>float</em>) – The sedimentation efficiency of the cloud. log(f_sed), range from -2 to 2. 2 is for cloud free case.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>f_sed is only reliable between -2 and log10(6) and the cloud free case (2).
Values between log10(6) and 2 are interpolated from the cloud free case (2) and log10(6).</p>
<p>Color Classification of Extrasolar Giant Planets: Prospects and Cautions
Natasha E. Batalha et al 2018 AJ 156 158</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">TargetOjbect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cstar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>A helper class to generate target spectrum and albedo spectrum</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.x">
<span class="sig-name descname"><span class="pre">x</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.x" title="Permalink to this definition"></a></dt>
<dd><p>x of target in arcsec</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.y">
<span class="sig-name descname"><span class="pre">y</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.y" title="Permalink to this definition"></a></dt>
<dd><p>y of target in arcsec</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>fload</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.ra">
<span class="sig-name descname"><span class="pre">ra</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.ra" title="Permalink to this definition"></a></dt>
<dd><p>ra string for center star, such as ‘15d23m05s’</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.dec">
<span class="sig-name descname"><span class="pre">dec</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.dec" title="Permalink to this definition"></a></dt>
<dd><p>dec string for center star</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.distance">
<span class="sig-name descname"><span class="pre">distance</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.distance" title="Permalink to this definition"></a></dt>
<dd><p>distance of center star in pc</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.image">
<span class="sig-name descname"><span class="pre">image</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.image" title="Permalink to this definition"></a></dt>
<dd><p>image of the target</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>2d np.array</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.target.TargetOjbect.spectrum">
<span class="sig-name descname"><span class="pre">spectrum</span></span><a class="headerlink" href="#csst_cpic_sim.target.TargetOjbect.spectrum" title="Permalink to this definition"></a></dt>
<dd><p>spectrum of the target</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>pysynphot.spectrum.Spectrum</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.bcc_spectrum">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">bcc_spectrum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coe_cloud</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coe_metalicity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ArraySpectralElement</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.bcc_spectrum" title="Permalink to this definition"></a></dt>
<dd><p>Albedo spectrum of planet using BCC model (Batalha et al. 2018),</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coe_cloud</strong> (<em>float</em>) – The sedimentation efficiency of the cloud. log(f_sed), range from -2 to 2. 2 is for cloud free case.</p></li>
<li><p><strong>coe_metalicity</strong> (<em>float</em>) – The metallicity of the planet. log(Z/Zsun), range from 0 to 2.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>albedo spectrum of the planet</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pysynphot.spectrum.ArrayBandpass</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.detect_template_path">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">detect_template_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.detect_template_path" title="Permalink to this definition"></a></dt>
<dd><p>Find template file in catalog folder or current folder.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>template</strong> (<em>str</em>) – template file name</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>absolute path of template file</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.extract_target_x_y">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">extract_target_x_y</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ra0</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dec0</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.extract_target_x_y" title="Permalink to this definition"></a></dt>
<dd><p>extract x, y of target from target dict</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<em>dict</em>) – target dict. must contain either (ra, dec) or (pangle, spearation)</p></li>
<li><p><strong>ra0</strong> (<em>str</em>) – ra of center star. must be provided if (ra, dec) of target is used</p></li>
<li><p><strong>dec0</strong> (<em>str</em>) – dec of center star. must be provided if (ra, dec) of target is used</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>x, y</strong> – x, y of target in arcsec</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>ValueError</strong> – if (ra, dec) of target is used but (ra, dec) of center star is not provided.</p></li>
<li><p><strong>ValueError</strong> – one of (ra, dec) or (pangle, spearation) is not provided.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.hybrid_albedo_spectrum">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">hybrid_albedo_spectrum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coe_b</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coe_r</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ArraySpectralElement</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.hybrid_albedo_spectrum" title="Permalink to this definition"></a></dt>
<dd><p>Albedo spectrum of planet using hybrid-jupiter-neptune model (Lacy et al. 2018)
jupiter and neptune spectrum is from Karkoschka’s 1994</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coe_b</strong> (<em>float</em>) – coefficient of blue spectrum, 1 for jupiter, 0 for neptune</p></li>
<li><p><strong>coe_r</strong> (<em>float</em>) – coefficient of red spectrum, 1 for jupiter, 0 for neptune</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>albedo spectrum of the planet</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pysynphot.spectrum.ArrayBandpass</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.planet_contrast">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">planet_contrast</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">planet_x_au</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">planet_y_au</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">phase_angle</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">radius</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">float</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.planet_contrast" title="Permalink to this definition"></a></dt>
<dd><p>calculate the contrast of a planet</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>planet_x_au</strong> (<em>float</em>) – x position of the planet in au</p></li>
<li><p><strong>planet_y_au</strong> (<em>float</em>) – y position of the planet in au</p></li>
<li><p><strong>phase_angle</strong> (<em>float</em>) – phase angle of the planet in degree</p></li>
<li><p><strong>radius</strong> (<em>float</em>) – radius of the planet in jupiter radius</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>contrast</strong> – contrast of the planet</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.spectrum_generator">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">spectrum_generator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">targets</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.spectrum_generator" title="Permalink to this definition"></a></dt>
<dd><p>generate the spectrum due to the input target list</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>targets</strong> (<em>dict</em>) – <p>target dictionary which contains keyword ‘cstar’ (necessary), ‘stars’(optional), ‘planets’ (optional).
The values are:
- cstar: dict</p>
<blockquote>
<div><ul class="simple">
<li><p>center star information. must contain keywords ra, dec, distance, magnitude, sptype</p></li>
</ul>
</div></blockquote>
<ul class="simple">
<li><dl class="simple">
<dt>objects: list of dict, optional, recommended! V2.0 new!</dt><dd><ul>
<li><p>list of targets. each dict must contain ra, dec, magnitude, sptype</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>obj_sp_list</strong> – list of [x, y, spectrum, image] of each target</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>list</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.standard_spectrum">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">standard_spectrum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">magnitude</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ArraySourceSpectrum</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.standard_spectrum" title="Permalink to this definition"></a></dt>
<dd><p>Standard spectrum of magnitude system.
For example, the standard_spectrum of vega megnitude is vega spectrum.
The standard spectrum of ab magnitude is a flat spectrum.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>magnitude</strong> (<em>float</em>) – magnitude of the standard spectrum</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>star_sp</strong></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>S.spectrum.Spectrum</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.star_photlam">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">star_photlam</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">magnitude</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sptype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_blackbody</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mag_input_band</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'f661'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ArraySourceSpectrum</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.star_photlam" title="Permalink to this definition"></a></dt>
<dd><p>genrate flux spectrum of a star by its observal magnitude and spectral type</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>magnitude</strong> (<em>float</em>) – magnitude of the star</p></li>
<li><p><strong>sptype</strong> (<em>str</em>) – spectral type of the star</p></li>
<li><p><strong>is_blackbody</strong> (<em>bool</em>) – if True, use blackbody spectrum instead of ck04model</p></li>
<li><p><strong>mag_input_band</strong> (<em>str</em>) – bandpass of the input magnitude, default is f661</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>spectrum of the star in photlam unit</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pysynphot.spectrum.ArraySpectrum</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.target.target_file_load">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.target.</span></span><span class="sig-name descname"><span class="pre">target_file_load</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">dict</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#csst_cpic_sim.target.target_file_load" title="Permalink to this definition"></a></dt>
<dd><p>Generate target dict from file, string or dict.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<em>dict</em>) – target file name, formated string or target dict.</p></li>
<li><p><strong>Outputs</strong></p></li>
<li><p><strong>--------</strong></p></li>
<li><p><strong>target</strong> – dictionary of target. Format of input</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If target is a string start with <a href="#id1"><span class="problematic" id="id2">*</span></a>, it will be treated as a formatted string.
e.g. “<a href="#id3"><span class="problematic" id="id4">*</span></a>5.1/25.3(1.3,1.5)/22.1(2.3,-4.5)” which means a central object
with magnitude 5.1, and two substellar with magnitude 25.3 and 22.1, respectively.
The spectrum of each object is standard refernece spectrum of ABmag.
The first number in the parenthesis is the x position in arcsec, and the second is the y position.</p>
<p>If target is a string without <a href="#id5"><span class="problematic" id="id6">*</span></a>, it will be treated as file name. And find the file in catalog folder.
The file need to be in yaml format.
And end with .yaml (note .yml not work). If not .yaml will be added.</p>
<p>If target is a dict, it will be returned directly.</p>
<p>If all the above conditions are not met, an empty dict will be returned.</p>
</div>
</dd></dl>
</section>
<section id="csst-cpic-sim-optics-module">
<h2>csst_cpic_sim.optics module<a class="headerlink" href="#csst-cpic-sim-optics-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.optics"></span><dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.optics.filter_throughput">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.optics.</span></span><span class="sig-name descname"><span class="pre">filter_throughput</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filter_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.optics.filter_throughput" title="Permalink to this definition"></a></dt>
<dd><p>Totally throughput of the each CPIC band.
Including the throughput of the filter, telescope, cpic, and camera QE.
If the filter_name is not supported, return the throughput of the default filter(f661).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filter_name</strong> (<em>str</em>) – The name of the filter.
One of [‘f565’, ‘f661’(default), ‘f743’, ‘f883’, ‘f940’, ‘f1265’, ‘f1425’, ‘f1542’]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The throughput of the filter.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>synphot.Bandpass</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.optics.focal_convolve">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.optics.</span></span><span class="sig-name descname"><span class="pre">focal_convolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">band</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">targets</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">init_shifts</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[0,</span> <span class="pre">0]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rotation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nsample</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">error</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platesize</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[1024,</span> <span class="pre">1024]</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.optics.focal_convolve" title="Permalink to this definition"></a></dt>
<dd><p>PSF convolution of the ideal focus image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>band</strong> (<em>str</em>) – The name of the band.</p></li>
<li><p><strong>target</strong> (<em>list</em>) – The list of thetargets. See the output of <cite>spectrum_generator</cite> for details.</p></li>
<li><p><strong>init_shifts</strong> (<em>list</em>) – The shifts of the targets to simulate the miss alignment. Unit: arcsec</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – The rotation of the image. Unit: degree</p></li>
<li><p><strong>error</strong> (<em>float</em>) – The error of the DM acceleration. Unit: nm</p></li>
<li><p><strong>platesize</strong> (<em>list</em>) – The size of the image. Unit: pixel</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.optics.focal_mask">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.optics.</span></span><span class="sig-name descname"><span class="pre">focal_mask</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iwa</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platescale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">throughtput</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-06</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.optics.focal_mask" title="Permalink to this definition"></a></dt>
<dd><p>Mask the image outside the inner working angle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image</strong> (<em>np.ndarray</em>) – The image to be masked.</p></li>
<li><p><strong>iwa</strong> (<em>float</em>) – The inner working angle. Unit: arcsec.</p></li>
<li><p><strong>platescale</strong> (<em>float</em>) – The platescale of the image. Unit: arcsec/pixel.</p></li>
<li><p><strong>throughtput</strong> (<em>float</em>) – The throughtput of the mask. The default is 1e-6.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The masked image.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.optics.ideal_focus_image">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.optics.</span></span><span class="sig-name descname"><span class="pre">ideal_focus_image</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bandpass</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">SpectralElement</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">targets</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platescale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platesize</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[1024,</span> <span class="pre">1024]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">init_shifts</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[0,</span> <span class="pre">0]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rotation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.optics.ideal_focus_image" title="Permalink to this definition"></a></dt>
<dd><p>Ideal focus image of the targets.
Each star is a little point of 1pixel.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bandpass</strong> (<em>synphot.SpectralElement</em>) – The bandpass of the filter.</p></li>
<li><p><strong>targets</strong> (<em>list</em>) – The list of the targets. See the output of <cite>spectrum_generator</cite> for details.</p></li>
<li><p><strong>platescale</strong> (<em>float</em>) – The platescale of the camera. Unit: arcsec/pixel</p></li>
<li><p><strong>platesize</strong> (<em>list</em>) – The size of the image. Unit: pixel</p></li>
<li><p><strong>init_shifts</strong> (<em>list</em>) – The shifts of the targets to simulate the miss alignment. Unit: arcsec</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – The rotation of the image. Unit: degree</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The ideal focus image.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="csst-cpic-sim-camera-module">
<h2>csst_cpic_sim.camera module<a class="headerlink" href="#csst-cpic-sim-camera-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.camera"></span><dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CRobj">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.camera.</span></span><span class="sig-name descname"><span class="pre">CRobj</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flux</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">angle</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sigma</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CRobj" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Cosmic ray object.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CRobj.flux">
<span class="sig-name descname"><span class="pre">flux</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CRobj.flux" title="Permalink to this definition"></a></dt>
<dd><p>The flux of the cosmic ray.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CRobj.angle">
<span class="sig-name descname"><span class="pre">angle</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CRobj.angle" title="Permalink to this definition"></a></dt>
<dd><p>The angle of the cosmic ray.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CRobj.sigma">
<span class="sig-name descname"><span class="pre">sigma</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CRobj.sigma" title="Permalink to this definition"></a></dt>
<dd><p>The width of the cosmic ray.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CRobj.length">
<span class="sig-name descname"><span class="pre">length</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CRobj.length" title="Permalink to this definition"></a></dt>
<dd><p>The length of the cosmic ray.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CosmicRayFrameMaker">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.camera.</span></span><span class="sig-name descname"><span class="pre">CosmicRayFrameMaker</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CosmicRayFrameMaker" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Cosmic ray frame maker.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>depth</strong> (<em>float</em>) – The depth of the camera pixel in um.</p></li>
<li><p><strong>pitch</strong> (<em>float</em>) – The pitch of the camera pixel in um.</p></li>
<li><p><strong>cr_rate</strong> (<em>float</em>) – The cosmic ray rate per second per cm2.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CosmicRayFrameMaker.make_CR">
<span class="sig-name descname"><span class="pre">make_CR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">length</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sigma</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CosmicRayFrameMaker.make_CR" title="Permalink to this definition"></a></dt>
<dd><p>make a image of cosmic ray with given length and sigma.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>length</strong> (<em>int</em>) – The length of the cosmic ray in pixel.</p></li>
<li><p><strong>sigma</strong> (<em>float</em>) – The width of the cosmic ray in pixel.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>output</strong> – The image of cosmic ray.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CosmicRayFrameMaker.make_cr_frame">
<span class="sig-name descname"><span class="pre">make_cr_frame</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CosmicRayFrameMaker.make_cr_frame" title="Permalink to this definition"></a></dt>
<dd><p>make a cosmic ray frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>shape</strong> (<em>list</em>) – The size of the image in pixel.</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – The exposure time in second.</p></li>
<li><p><strong>seed</strong> (<em>int</em><em>, </em><em>optional</em>) – The random seed. The default is -1. If seed is -1, the seed will be randomly selected.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image</strong> – The cosmic ray frame.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CosmicRayFrameMaker.random_CR_parameter">
<span class="sig-name descname"><span class="pre">random_CR_parameter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pixsize</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CosmicRayFrameMaker.random_CR_parameter" title="Permalink to this definition"></a></dt>
<dd><p>randomly generate cosmic ray parameters, including number, length, flux, sigma and angle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expt</strong> (<em>float</em>) – The exposure time in second.</p></li>
<li><p><strong>pixsize</strong> (<em>list</em>) – The size of the image in pixel.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>CRs</strong> – A list of cosmic ray objects.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>list</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.camera.</span></span><span class="sig-name descname"><span class="pre">CpicVisEmccd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The class for Cpic EMCCD camera.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.switch">
<span class="sig-name descname"><span class="pre">switch</span></span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.switch" title="Permalink to this definition"></a></dt>
<dd><p>A dictionary to switch on/off the camera effects.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>dict</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.bias_frame">
<span class="sig-name descname"><span class="pre">bias_frame</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.bias_frame" title="Permalink to this definition"></a></dt>
<dd><p>Generate bias frame
The bias frame contains vertical, horizontal, peper-salt noise, bias drift effect.
Can be configurable using self.switch.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>bias frame</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.config_init">
<span class="sig-name descname"><span class="pre">config_init</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.config_init" title="Permalink to this definition"></a></dt>
<dd><p>initialize the camera.
If the config is set, call this function to update the config.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.em_fix_fuc_fit">
<span class="sig-name descname"><span class="pre">em_fix_fuc_fit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">emgain</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.em_fix_fuc_fit" title="Permalink to this definition"></a></dt>
<dd><p>Calculate the emgain fix coeficient to fix the gamma distribution.
The coeficient is from fixing of ideal emgain distribution.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>emgain</strong> (<em>float</em>) – The emgain.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The coeficient.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.emgain_set">
<span class="sig-name descname"><span class="pre">emgain_set</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">em_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ccd_temp</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">self_update</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.emgain_set" title="Permalink to this definition"></a></dt>
<dd><p>Set emgain from em set value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>em_set</strong> (<em>int</em>) – em set value. 3FF is about 1.17×, 200 is about 1000×.</p></li>
<li><p><strong>ccd_temp</strong> (<em>float</em><em>, </em><em>optional</em>) – CCD temperature. If not given, use the current ccd temperature.</p></li>
<li><p><strong>self_update</strong> (<em>bool</em><em>, </em><em>optional</em>) – if True, update the emgain and emset. Default is True.
if False, only return the emgain.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.emregester_blooming">
<span class="sig-name descname"><span class="pre">emregester_blooming</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_iteration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.emregester_blooming" title="Permalink to this definition"></a></dt>
<dd><p>emregester blooming effect</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.nonlinear_effect">
<span class="sig-name descname"><span class="pre">nonlinear_effect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.nonlinear_effect" title="Permalink to this definition"></a></dt>
<dd><p>nonlinear effect</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.readout">
<span class="sig-name descname"><span class="pre">readout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image_focal</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">em_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expt_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_cosmic_ray</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">emgain</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.readout" title="Permalink to this definition"></a></dt>
<dd><p>From focal planet image to ccd output.
Interface function for emccd. Simulate the readout process.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image_focal</strong> (<em>np.ndarray</em>) – focal planet image. Unit: photon-electron/s/pixel</p></li>
<li><p><strong>em_set</strong> (<em>int</em>) – emgain set value.</p></li>
<li><p><strong>expt_set</strong> (<em>float</em>) – exposure time set value. Unit: s (0 mains 1ms)</p></li>
<li><p><strong>image_cosmic_ray</strong> (<em>np.ndarray</em><em>, </em><em>optional</em>) – cosmic ray image. Unit: photon-electron/pixel</p></li>
<li><p><strong>emgain</strong> (<em>float</em><em>, </em><em>optional</em>) – if not None, use the given emgain. Else, calculate the emgain using em_set</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>ccd output image. Unit: ADU</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.time_syn">
<span class="sig-name descname"><span class="pre">time_syn</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">readout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.time_syn" title="Permalink to this definition"></a></dt>
<dd><p>time synchronization and update the system time and ccd temperature</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>t</strong> (<em>float</em>) – relative time</p></li>
<li><p><strong>readout</strong> (<em>bool</em><em>, </em><em>optional</em>) – If the camera is readout before time synchronization, set readout to True
if True, the ccd temperature will increase, otherwise, it will decrease</p></li>
<li><p><strong>initial</strong> (<em>bool</em><em>, </em><em>optional</em>) – If inital is True, the ccd will be intialized to the cooler temperature</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.CpicVisEmccd.vertical_blooming">
<span class="sig-name descname"><span class="pre">vertical_blooming</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.CpicVisEmccd.vertical_blooming" title="Permalink to this definition"></a></dt>
<dd><p>vertical blooming effect</p>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.camera.sky_frame_maker">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.camera.</span></span><span class="sig-name descname"><span class="pre">sky_frame_maker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">band</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skybg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platescale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.camera.sky_frame_maker" title="Permalink to this definition"></a></dt>
<dd><p>generate a sky background frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>band</strong> (<em>str</em>) – The band of the sky background.</p></li>
<li><p><strong>skybg</strong> (<em>str</em>) – The sky background file name.</p></li>
<li><p><strong>platescale</strong> (<em>float</em>) – The platescale of the camera in arcsec/pixel.</p></li>
<li><p><strong>shape</strong> (<em>tuple</em>) – The shape of the output frame. (y, x)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>sky_bkg_frame</strong> – The sky background frame.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="csst-cpic-sim-io-module">
<h2>csst_cpic_sim.io module<a class="headerlink" href="#csst-cpic-sim-io-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.io"></span><dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.check_and_update_fits_header">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">check_and_update_fits_header</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">header</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.check_and_update_fits_header" title="Permalink to this definition"></a></dt>
<dd><p>Check the header keywords and update the description according to the data model.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>header</strong> (<em>astropy.io.fits.header.Header</em>) – The header to be checked.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>None</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.datetime_obj_to_mjd">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">datetime_obj_to_mjd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">time_obj</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.datetime_obj_to_mjd" title="Permalink to this definition"></a></dt>
<dd><p>transfer datetime object to mean julian date (MJD).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>time_obj</strong> (<em>datetime.datetime</em>) – The datetime object.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The mean julian date (MJD).</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.frame_header">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">frame_header</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obs_info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">primary_header</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">camera_dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.frame_header" title="Permalink to this definition"></a></dt>
<dd><p>Generate the header for a single frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obs_info</strong> (<em>dict</em>) – Dictionary of parameters. See <cite>save_fits</cite> function.</p></li>
<li><p><strong>index</strong> (<em>int</em>) – Frame index.</p></li>
<li><p><strong>primary_header</strong> (<em>dict</em>) – Primary header</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>astropy.io.fits.Header</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.obsid_parser">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">obsid_parser</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obsid</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.obsid_parser" title="Permalink to this definition"></a></dt>
<dd><p>Parse the obsid to get the obstype.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>obsid</strong> (<em>str</em>) – The obsid of the observation.
Obsid must be 11 digits and start with 5 for CPIC.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The obstype of the observation.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> – If the obsid is not 11 digits or does not start with 5.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.primary_hdu">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">primary_hdu</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obs_info</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gnc_info</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename_output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.primary_hdu" title="Permalink to this definition"></a></dt>
<dd><p>Generate the primary hdu of the fits file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>obs_info</strong> (<em>dict</em>) – The parameters of the observation. See <cite>save_fits</cite> function.</p></li>
<li><p><strong>gnc_info</strong> (<em>dict</em>) – The gnc information of the observation.</p></li>
<li><p><strong>filename_output</strong> (<em>bool</em><em> (</em><em>optional</em><em>)</em>) – If True, the folder and the filename will be returned.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><ul class="simple">
<li><p><em>fits.PrimaryHDU</em> – The primary hdu of the fits file.</p></li>
<li><p><em>str, str</em> – The folder and filename of the fits file. Only returned if filename_output is True.</p></li>
</ul>
</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The gnc_info dict should contain the information of orbit and observation.
these informations are used to genrated the hdu header. Refer to the data model for more information.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.save_fits">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">save_fits</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">images</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">obs_info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gnc_info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">camera_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">csst_format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_folder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.save_fits" title="Permalink to this definition"></a></dt>
<dd><p>Save the image to a fits file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>images</strong> (<em>numpy.ndarray</em>) – Image array to be saved.</p></li>
<li><p><strong>obs_info</strong> (<em>dict</em>) – <p>Dictionary of observation informations.
Must contain the following keys</p>
<ul>
<li><dl class="simple">
<dt>band: str</dt><dd><ul>
<li><p>Band of the image.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>expt: float</dt><dd><ul>
<li><p>Exposure time of the each image.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>nframe: int</dt><dd><ul>
<li><p>Number of frames in the image.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>emgain: int</dt><dd><ul>
<li><p>EM gain of the camera.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>obsid: str</dt><dd><ul>
<li><p>Observation ID. Obsid must be 11 digits and start with 5 for CPIC. See pharse_obsid() for details.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>rotation: float</dt><dd><ul>
<li><p>Rotation angle of the image.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>shift: list</dt><dd><ul>
<li><p>Shift of the image.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
</p></li>
<li><p><strong>gnc_info</strong> (<em>dict</em>) – Dictionary of GNC information.
Contains the keywords in the primary header. See primary_hdu() for details.</p></li>
<li><p><strong>csst_format</strong> (<em>bool</em><em>, </em><em>optional</em>) – Whether to save the fits file in CSST format, by default True.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.save_fits_simple">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">save_fits_simple</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">images</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">obs_info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_folder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.save_fits_simple" title="Permalink to this definition"></a></dt>
<dd><p>Save the image to a fits file with a simple header to TMP directory.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>images</strong> (<em>numpy.ndarray</em>) – Image array to be written.</p></li>
<li><p><strong>obs_info</strong> (<em>dict</em>) – Dictionary of observation informations. See <cite>save_fits</cite> function.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Filename of the saved fits file.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.io.set_up_logger">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.io.</span></span><span class="sig-name descname"><span class="pre">set_up_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">log_dir</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.io.set_up_logger" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</section>
<section id="csst-cpic-sim-config-module">
<h2>csst_cpic_sim.config module<a class="headerlink" href="#csst-cpic-sim-config-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.config"></span><dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.iso_time">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">iso_time</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">time</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.config.iso_time" title="Permalink to this definition"></a></dt>
<dd><p>Transfer relative time to iso time format</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>time</strong> (<em>str</em><em> or </em><em>float</em>) – The relative time in seconds.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The iso time format.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.load_refdata_path">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">load_refdata_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config_aim</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.config.load_refdata_path" title="Permalink to this definition"></a></dt>
<dd><p>Load refdata path.
The refdata path is stored in config_aim file. If not found, set it.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>config_aim</strong> (<em>str</em>) – config_aim file path</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.relative_time">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">relative_time</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">time</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.config.relative_time" title="Permalink to this definition"></a></dt>
<dd><p>Transfer iso time format to relative time in seconds</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>time</strong> (<em>str</em><em> or </em><em>float</em>) – The iso time format.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The relative time in seconds.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.replace_cpism_refdata">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">replace_cpism_refdata</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'$'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#csst_cpic_sim.config.replace_cpism_refdata" title="Permalink to this definition"></a></dt>
<dd><p>Replace the cpism_refdata in the config.
In the config file, we use ${cpism_refdata} to indicate the cpism_refdata.
This function is used to replace the cpism_refdata in the config, or replace back.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>config</strong> (<em>dict</em>) – config dict.</p></li>
<li><p><strong>output</strong> (<em>str</em>) – ‘$’ or ‘other’. If output is ‘$’, then replace the cpism_refdata in the config with ${cpism_refdata}.
If output is ‘other’, then replace the ${cpism_refdata} in the config file with the real path.
‘$’ is used meanly to generate a demo config file.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.setup_config">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">setup_config</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">new_config</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.config.setup_config" title="Permalink to this definition"></a></dt>
<dd><p>Set up config from a dict.
Some of the configs need to calcuate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>new_config</strong> (<em>dict</em>) – new config dict.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>None</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.config.which_focalplane">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.config.</span></span><span class="sig-name descname"><span class="pre">which_focalplane</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">band</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.config.which_focalplane" title="Permalink to this definition"></a></dt>
<dd><p>Return the name of the focalplane which the band belongs to.
right now only support vis</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>band</strong> (<em>str</em>) – The name of the band.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The name of the focalplane.
‘vis’ or ‘nir’ or ‘wfs’</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> – If the band is not in [‘f565’, ‘f661’, ‘f743’, ‘f883’, ‘f940’, ‘f1265’, ‘f1425’, ‘f1542’, ‘wfs’]</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="csst-cpic-sim-utils-module">
<h2>csst_cpic_sim.utils module<a class="headerlink" href="#csst-cpic-sim-utils-module" title="Permalink to this heading"></a></h2>
<span class="target" id="module-csst_cpic_sim.utils"></span><dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.utils.Logger">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.utils.</span></span><span class="sig-name descname"><span class="pre">Logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'INFO'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.utils.Logger" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.utils.psf_imshow">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.utils.</span></span><span class="sig-name descname"><span class="pre">psf_imshow</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">psf</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">vmin</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-08</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">vmax</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">log</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">region</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.utils.psf_imshow" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.utils.random_seed_select">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.utils.</span></span><span class="sig-name descname"><span class="pre">random_seed_select</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.utils.random_seed_select" title="Permalink to this definition"></a></dt>
<dd><p>Select a random seed for numpy.random and return it.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.utils.region_replace">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.utils.</span></span><span class="sig-name descname"><span class="pre">region_replace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">background</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">ndarray</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">front</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">ndarray</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shift</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bmask</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fmask</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padded_in</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padded_out</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">subpix</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.utils.region_replace" title="Permalink to this definition"></a></dt>
<dd><p>replace a region of the background with the front image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>background</strong> (<em>np.ndarray</em>) – The background image.</p></li>
<li><p><strong>front</strong> (<em>np.ndarray</em>) – The front image.</p></li>
<li><p><strong>shift</strong> (<em>list</em>) – The [x, y] shift of the front image. Unit: pixel.
Relative to the lower-left corner of the background image.
[0, 0] means the lower-left corner of the front image is at the lower-left corner of the background image.</p></li>
<li><p><strong>bmask</strong> (<em>float</em>) – The mask of the background image. Default: 1.0
0.0 means the background image is masked.
1.0 means the background image is fully added.</p></li>
<li><p><strong>fmask</strong> (<em>float</em>) – The mask of the front image. Default: 1.0
0.0 means the front image is masked (not added).
1.0 means the front image is fully added.</p></li>
<li><p><strong>padded_in</strong> (<em>bool</em>) – Whether the input background image is padded. Default: False
In the function, the background image is padded by the size of the front image.
If True, means the background image is padded.</p></li>
<li><p><strong>padded_out</strong> (<em>bool</em>) – Whether the output image is padded. Default: False
In the function, the background image is padded by the size of the front image.
If True, means the output image is padded.
padded_in and padded_out are designed for the case that replace_region fuction is called multiple times.</p></li>
<li><p><strong>subpix</strong> (<em>bool</em>) – Whether the shift is subpixel. Default: False
If True, the shift is subpixel, using scipy.ndimage.shift to shift the front image.
If False, the shift is integer, using numpy slicing to shift the front image.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The output image.
shape = background.shape if padded_out = False
shape = background.shape + 2 * front.shape if padded_out = True</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-csst_cpic_sim">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-csst_cpic_sim" title="Permalink to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="csst_cpic_sim.CosmicRayFrameMaker">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">CosmicRayFrameMaker</span></span><a class="headerlink" href="#csst_cpic_sim.CosmicRayFrameMaker" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Cosmic ray frame maker.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>depth</strong> (<em>float</em>) – The depth of the camera pixel in um.</p></li>
<li><p><strong>pitch</strong> (<em>float</em>) – The pitch of the camera pixel in um.</p></li>
<li><p><strong>cr_rate</strong> (<em>float</em>) – The cosmic ray rate per second per cm2.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.CosmicRayFrameMaker.make_CR">
<span class="sig-name descname"><span class="pre">make_CR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">length</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sigma</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.CosmicRayFrameMaker.make_CR" title="Permalink to this definition"></a></dt>
<dd><p>make a image of cosmic ray with given length and sigma.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>length</strong> (<em>int</em>) – The length of the cosmic ray in pixel.</p></li>
<li><p><strong>sigma</strong> (<em>float</em>) – The width of the cosmic ray in pixel.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>output</strong> – The image of cosmic ray.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.CosmicRayFrameMaker.make_cr_frame">
<span class="sig-name descname"><span class="pre">make_cr_frame</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.CosmicRayFrameMaker.make_cr_frame" title="Permalink to this definition"></a></dt>
<dd><p>make a cosmic ray frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>shape</strong> (<em>list</em>) – The size of the image in pixel.</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – The exposure time in second.</p></li>
<li><p><strong>seed</strong> (<em>int</em><em>, </em><em>optional</em>) – The random seed. The default is -1. If seed is -1, the seed will be randomly selected.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image</strong> – The cosmic ray frame.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="csst_cpic_sim.CosmicRayFrameMaker.random_CR_parameter">
<span class="sig-name descname"><span class="pre">random_CR_parameter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pixsize</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.CosmicRayFrameMaker.random_CR_parameter" title="Permalink to this definition"></a></dt>
<dd><p>randomly generate cosmic ray parameters, including number, length, flux, sigma and angle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expt</strong> (<em>float</em>) – The exposure time in second.</p></li>
<li><p><strong>pixsize</strong> (<em>list</em>) – The size of the image in pixel.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>CRs</strong> – A list of cosmic ray objects.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>list</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.extract_target_x_y">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">extract_target_x_y</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ra0</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dec0</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span></span></span><a class="headerlink" href="#csst_cpic_sim.extract_target_x_y" title="Permalink to this definition"></a></dt>
<dd><p>extract x, y of target from target dict</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<em>dict</em>) – target dict. must contain either (ra, dec) or (pangle, spearation)</p></li>
<li><p><strong>ra0</strong> (<em>str</em>) – ra of center star. must be provided if (ra, dec) of target is used</p></li>
<li><p><strong>dec0</strong> (<em>str</em>) – dec of center star. must be provided if (ra, dec) of target is used</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>x, y</strong> – x, y of target in arcsec</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>ValueError</strong> – if (ra, dec) of target is used but (ra, dec) of center star is not provided.</p></li>
<li><p><strong>ValueError</strong> – one of (ra, dec) or (pangle, spearation) is not provided.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.focal_mask">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">focal_mask</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iwa</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platescale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">throughtput</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-06</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.focal_mask" title="Permalink to this definition"></a></dt>
<dd><p>Mask the image outside the inner working angle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image</strong> (<em>np.ndarray</em>) – The image to be masked.</p></li>
<li><p><strong>iwa</strong> (<em>float</em>) – The inner working angle. Unit: arcsec.</p></li>
<li><p><strong>platescale</strong> (<em>float</em>) – The platescale of the image. Unit: arcsec/pixel.</p></li>
<li><p><strong>throughtput</strong> (<em>float</em>) – The throughtput of the mask. The default is 1e-6.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The masked image.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.planet_contrast">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">planet_contrast</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">planet_x_au</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">planet_y_au</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">phase_angle</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">radius</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">float</span></span></span><a class="headerlink" href="#csst_cpic_sim.planet_contrast" title="Permalink to this definition"></a></dt>
<dd><p>calculate the contrast of a planet</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>planet_x_au</strong> (<em>float</em>) – x position of the planet in au</p></li>
<li><p><strong>planet_y_au</strong> (<em>float</em>) – y position of the planet in au</p></li>
<li><p><strong>phase_angle</strong> (<em>float</em>) – phase angle of the planet in degree</p></li>
<li><p><strong>radius</strong> (<em>float</em>) – radius of the planet in jupiter radius</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>contrast</strong> – contrast of the planet</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.quick_run_v2">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">quick_run_v2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target_str</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">band</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expt</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">emgain</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nframe</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skybg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rotation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shift</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">[0,</span> <span class="pre">0]</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">emset_input</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cr_frame</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">camera_effect</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prograss_bar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.quick_run_v2" title="Permalink to this definition"></a></dt>
<dd><p>A quick run function for CPIC.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target_str</strong> (<em>str</em>) – target string. See the input of <cite>target.target_file_load</cite> for more details.</p></li>
<li><p><strong>band</strong> (<em>str</em>) – band name</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – exposure time in unit of second</p></li>
<li><p><strong>emgain</strong> (<em>float</em>) – EM gain value. Note that emgain is not the same as emset, controled by emset_input keyword.</p></li>
<li><p><strong>nframe</strong> (<em>int</em>) – number of frames</p></li>
<li><p><strong>skybg</strong> (<em>float</em><em> or </em><em>None</em>) – sky background in unit of magnitude. If None, sky background will not be set.</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – rotation of the telescope. in unit of degree. 0 means North is up.</p></li>
<li><p><strong>shift</strong> (<em>list</em>) – target shift in unit of arcsec</p></li>
<li><p><strong>emset_input</strong> (<em>bool</em>) – if True, emgain paramter is emset. Else, emgain is set using emgain parameter.</p></li>
<li><p><strong>cr_frame</strong> (<em>bool</em>) – if True, cosmic ray frame will be added to the image.</p></li>
<li><p><strong>camera_effect</strong> (<em>bool</em>) – if True, camera effect will be added to the image.</p></li>
<li><p><strong>prograss_bar</strong> (<em>bool</em>) – if True, a prograss_bar will be shown.</p></li>
<li><p><strong>output</strong> (<em>str</em>) – the output directory.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image_cube</strong></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.sky_frame_maker">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">sky_frame_maker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">band</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skybg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">platescale</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#csst_cpic_sim.sky_frame_maker" title="Permalink to this definition"></a></dt>
<dd><p>generate a sky background frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>band</strong> (<em>str</em>) – The band of the sky background.</p></li>
<li><p><strong>skybg</strong> (<em>str</em>) – The sky background file name.</p></li>
<li><p><strong>platescale</strong> (<em>float</em>) – The platescale of the camera in arcsec/pixel.</p></li>
<li><p><strong>shape</strong> (<em>tuple</em>) – The shape of the output frame. (y, x)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>sky_bkg_frame</strong> – The sky background frame.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.spectrum_generator">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">spectrum_generator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">targets</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span></span></span><a class="headerlink" href="#csst_cpic_sim.spectrum_generator" title="Permalink to this definition"></a></dt>
<dd><p>generate the spectrum due to the input target list</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>targets</strong> (<em>dict</em>) – <p>target dictionary which contains keyword ‘cstar’ (necessary), ‘stars’(optional), ‘planets’ (optional).
The values are:
- cstar: dict</p>
<blockquote>
<div><ul class="simple">
<li><p>center star information. must contain keywords ra, dec, distance, magnitude, sptype</p></li>
</ul>
</div></blockquote>
<ul class="simple">
<li><dl class="simple">
<dt>objects: list of dict, optional, recommended! V2.0 new!</dt><dd><ul>
<li><p>list of targets. each dict must contain ra, dec, magnitude, sptype</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>obj_sp_list</strong> – list of [x, y, spectrum, image] of each target</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>list</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.star_photlam">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">star_photlam</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">magnitude</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sptype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_blackbody</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mag_input_band</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'f661'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ArraySourceSpectrum</span></span></span><a class="headerlink" href="#csst_cpic_sim.star_photlam" title="Permalink to this definition"></a></dt>
<dd><p>genrate flux spectrum of a star by its observal magnitude and spectral type</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>magnitude</strong> (<em>float</em>) – magnitude of the star</p></li>
<li><p><strong>sptype</strong> (<em>str</em>) – spectral type of the star</p></li>
<li><p><strong>is_blackbody</strong> (<em>bool</em>) – if True, use blackbody spectrum instead of ck04model</p></li>
<li><p><strong>mag_input_band</strong> (<em>str</em>) – bandpass of the input magnitude, default is f661</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>spectrum of the star in photlam unit</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pysynphot.spectrum.ArraySpectrum</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="csst_cpic_sim.vis_observation">
<span class="sig-prename descclassname"><span class="pre">csst_cpic_sim.</span></span><span class="sig-name descname"><span class="pre">vis_observation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">target:</span> <span class="pre">dict,</span> <span class="pre">skybg:</span> <span class="pre">float,</span> <span class="pre">expt:</span> <span class="pre">float,</span> <span class="pre">nframe:</span> <span class="pre">int,</span> <span class="pre">band:</span> <span class="pre">str,</span> <span class="pre">emset:</span> <span class="pre">int,</span> <span class="pre">obsid:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">41000000000,</span> <span class="pre">rotation:</span> <span class="pre">float</span> <span class="pre">=</span> <span class="pre">0,</span> <span class="pre">shift:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">[0,</span> <span class="pre">0],</span> <span class="pre">gnc_info:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">{},</span> <span class="pre">csst_format:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">True,</span> <span class="pre">camera=&lt;csst_cpic_sim.camera.CpicVisEmccd</span> <span class="pre">object&gt;,</span> <span class="pre">crmaker=&lt;csst_cpic_sim.camera.CosmicRayFrameMaker</span> <span class="pre">object&gt;,</span> <span class="pre">nsample:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">1,</span> <span class="pre">emgain=None,</span> <span class="pre">prograss_bar=None,</span> <span class="pre">output='./'</span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">ndarray</span></span></span><a class="headerlink" href="#csst_cpic_sim.vis_observation" title="Permalink to this definition"></a></dt>
<dd><p>Observation simulation main process on visable band using EMCCD.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<em>dict</em>) – target dictionary. See the input of <cite>target.spectrum_generator</cite> for more details.</p></li>
<li><p><strong>skybg</strong> (<em>float</em>) – sky background in unit of magnitude/arcsec^2</p></li>
<li><p><strong>expt</strong> (<em>float</em>) – exposure time in unit of second</p></li>
<li><p><strong>nframe</strong> (<em>int</em>) – number of frames</p></li>
<li><p><strong>band</strong> (<em>str</em>) – band name</p></li>
<li><p><strong>emset</strong> (<em>int</em>) – EM gain setting value. 1023(0x3FF) for ~1.0× EM gain.</p></li>
<li><p><strong>obsid</strong> (<em>int</em>) – observation ID. Start from 4 for CPIC, 01 for science observation. See the input of io.obsid_parser for more details.</p></li>
<li><p><strong>rotation</strong> (<em>float</em>) – rotation of the telescope. in unit of degree. 0 means North is up.</p></li>
<li><p><strong>shift</strong> (<em>list</em>) – target shift in unit of arcsec</p></li>
<li><p><strong>gnc_info</strong> (<em>dict</em>) – gnc_info dictionary. See the input of io.primary_hdu for more details.</p></li>
<li><p><strong>csst_format</strong> (<em>bool</em>) – if True, the output fits file will be in the csst format.</p></li>
<li><p><strong>crmaker</strong> (<a class="reference internal" href="#csst_cpic_sim.CosmicRayFrameMaker" title="csst_cpic_sim.CosmicRayFrameMaker"><em>CosmicRayFrameMaker</em></a>) – CosmicRayFrameMaker object. See the input of camera.CosmicRayFrameMaker for more details.</p></li>
<li><p><strong>nsample</strong> (<em>int</em>) – number of samples for wide bandpass.</p></li>
<li><p><strong>emgain</strong> (<em>float</em><em> or </em><em>None</em>) – if None, emgain are set using emset parameter. Else, emgain are set using emgain parameter.</p></li>
<li><p><strong>prograss_bar</strong> (<em>bool</em>) – if True, a prograss_bar will be shown.</p></li>
<li><p><strong>output</strong> (<em>str</em>) – the output directory.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>image_cube</strong></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="notebooks/5_psf_example.html" class="btn btn-neutral float-left" title="点扩散函数仿真" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2023, CSST/CPIC Group.</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>
\ No newline at end of file
......@@ -20,7 +20,7 @@ CPISM: CSST/CPI-C 观测图像仿真软件包
程序安装 <installation>
使用说明 <tutorials>
代码说明 <cpism>
代码说明 <cpism.html>
......
......@@ -17,8 +17,8 @@ Python版本
.. code-block:: bash
git clone https://csst-tb.bao.ac.cn/code/csst-sims/csst_cpic_sim.git
cd csst_cpic_sim
python setup.py install
cd csst_cpic_sim
python setup.py install
下载数据文件
```````````````````
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment