cpism.html 128 KB
Newer Older
GZhao's avatar
GZhao committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!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>
For faster browsing, not all history is shown. View entire blame