using_celme_classes.html
20.1 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>User guide to program with celme Python classes — Mount Control Software 1.0.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Generate this documentation" href="generate_documentation.html" />
<link rel="prev" title="User guide to program with mount Python classes" href="using_mount_classes.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="generate_documentation.html" title="Generate this documentation"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="using_mount_classes.html" title="User guide to program with mount Python classes"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Mount Control Software 1.0.0 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">User guide to program with celme Python classes</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="user-guide-to-program-with-celme-python-classes">
<h1>User guide to program with celme Python classes<a class="headerlink" href="#user-guide-to-program-with-celme-python-classes" title="Permalink to this headline">¶</a></h1>
<p>This section show how to use celme in a Python code.</p>
<div class="section" id="context">
<h2>1. Context<a class="headerlink" href="#context" title="Permalink to this headline">¶</a></h2>
<p>Celestial mechanics allow to compute celestial bodies positions and manage dates, durations, angles, coordinates.</p>
</div>
<div class="section" id="python-classes-provided-by-celme">
<h2>2. Python classes provided by celme<a class="headerlink" href="#python-classes-provided-by-celme" title="Permalink to this headline">¶</a></h2>
<p>Brief descrition of the celme classes:</p>
<blockquote>
<div><ul class="simple">
<li><p>Angle: Convert angles in complex formats.</p></li>
<li><p>Coords: Convert angles in complex formats.</p></li>
<li><p>Home: Define a mount location on the Earth surface.</p></li>
<li><p>Horizon: Define horizon line to set the limits of telescope pointings.</p></li>
<li><p>Atmosphere: Define atmospheric conditions to set the conditions to compute refraction effects.</p></li>
<li><p>Site: Define an observation site by merging Home, Horizon, Atmosphere.</p></li>
<li><p>Date: Convert dates in complex formats.</p></li>
<li><p>Duration: Convert durations in complex formats.</p></li>
<li><p>Mechanics: Low level methods for celestial mechanics</p></li>
<li><p>Targets: High level methods for celestial mechanics</p></li>
</ul>
</div></blockquote>
<img alt="_images/classes_celme.png" src="_images/classes_celme.png" />
</div>
<div class="section" id="using-the-python-module-celme-for-angles">
<h2>3. Using the Python module celme for angles<a class="headerlink" href="#using-the-python-module-celme-for-angles" title="Permalink to this headline">¶</a></h2>
<div class="section" id="simple-example-to-convert-angles">
<h3>3.1. Simple example to convert angles<a class="headerlink" href="#simple-example-to-convert-angles" title="Permalink to this headline">¶</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Angle</span><span class="p">(</span><span class="s2">"2h3m27s"</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"angle deg ="</span><span class="p">,</span> <span class="n">a</span><span class="o">.</span><span class="n">deg</span><span class="p">())</span>
</pre></div>
</div>
<p>angle deg = 30.862499999999994</p>
</div>
<div class="section" id="operation-with-angles">
<h3>3.2. Operation with angles<a class="headerlink" href="#operation-with-angles" title="Permalink to this headline">¶</a></h3>
<p>We want to compute sum of the angles 2h3m27s and -0d28m12.4s. Display the results in sexagesimal format expressed in degrees:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Angle</span><span class="p">(</span><span class="s2">"2h3m27s"</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Angle</span><span class="p">(</span><span class="s2">"-0d28m12.4s"</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">sexagesimal</span><span class="p">(</span><span class="s2">"d"</span><span class="p">)))</span>
</pre></div>
</div>
<p>‘30d23m32.60s’</p>
</div>
</div>
<div class="section" id="using-the-python-module-celme-for-dates">
<h2>4. Using the Python module celme for dates<a class="headerlink" href="#using-the-python-module-celme-for-dates" title="Permalink to this headline">¶</a></h2>
<p>Celme module is located in the folder pyros/src/utils
Examples: pyros/src/utils/report/dates.py
help(Date)</p>
<div class="section" id="simple-example-to-convert-dates">
<h3>4.1. Simple example to convert dates<a class="headerlink" href="#simple-example-to-convert-dates" title="Permalink to this headline">¶</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Date</span><span class="p">(</span><span class="s2">"now"</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"Date ISO ="</span><span class="p">,</span> <span class="n">a</span><span class="o">.</span><span class="n">iso</span><span class="p">())</span>
<span class="n">Date</span> <span class="n">ISO</span> <span class="o">=</span> <span class="mi">2018</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="mi">11</span><span class="n">T22</span><span class="p">:</span><span class="mi">45</span><span class="p">:</span><span class="mf">44.958</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"Date Julian Day ="</span><span class="p">,</span> <span class="n">a</span><span class="o">.</span><span class="n">jd</span><span class="p">())</span>
</pre></div>
</div>
<p>Date Julian Day = 2458403.448437011</p>
</div>
<div class="section" id="operation-with-dates">
<h3>4.2. Operation with dates<a class="headerlink" href="#operation-with-dates" title="Permalink to this headline">¶</a></h3>
<p>We want to compute date corresponding to add 2 days and 28 minutes to the 2018-10-11T22:45:44.958. Display the results in ISO format:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Date</span><span class="p">(</span><span class="s2">"2018-10-11T22:45:44.958"</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Duration</span><span class="p">(</span><span class="s2">"2d28m"</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">"Date ISO ="</span><span class="p">,</span> <span class="n">c</span><span class="o">.</span><span class="n">iso</span><span class="p">())</span>
</pre></div>
</div>
<p>Date ISO = 2018-10-13T23:13:44.958</p>
</div>
</div>
<div class="section" id="using-the-python-module-celme-for-ephemeris">
<h2>5. Using the Python module celme for ephemeris<a class="headerlink" href="#using-the-python-module-celme-for-ephemeris" title="Permalink to this headline">¶</a></h2>
<div class="line-block">
<div class="line">Celme module is located in the folder pyros/src/utils</div>
<div class="line">Examples: pyros/src/utils/report/targets.py</div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">help</span><span class="p">(</span><span class="n">Target</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="simple-example-to-compute-sun-coordinates">
<h3>5.1. Simple example to compute Sun coordinates<a class="headerlink" href="#simple-example-to-compute-sun-coordinates" title="Permalink to this headline">¶</a></h3>
<p>First we compute RA, DEC coordinates of the Sun:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="n">date</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Date</span><span class="p">(</span><span class="s2">"now"</span><span class="p">)</span>
<span class="n">site</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Site</span><span class="p">(</span><span class="s2">"GPS 0 E 49 200"</span><span class="p">)</span>
<span class="n">skyobj</span><span class="o">=</span> <span class="p">{</span><span class="s1">'planet'</span><span class="p">:</span><span class="s1">'Sun'</span><span class="p">}</span>
<span class="n">target</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Target</span><span class="p">()</span>
<span class="n">target</span><span class="o">.</span><span class="n">define</span><span class="p">(</span><span class="n">skyobj</span><span class="p">)</span>
<span class="n">output0s</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'ra'</span><span class="p">,</span><span class="s1">'dec'</span><span class="p">]</span>
<span class="n">results</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">ephem</span><span class="p">(</span><span class="n">date</span><span class="p">,</span><span class="n">site</span><span class="p">,</span><span class="n">output0s</span><span class="p">)</span>
<span class="n">ra</span> <span class="o">=</span> <span class="n">results</span><span class="p">[</span><span class="s1">'RA'</span><span class="p">]</span>
<span class="n">dec</span> <span class="o">=</span> <span class="n">results</span><span class="p">[</span><span class="s1">'DEC'</span><span class="p">]</span>
</pre></div>
</div>
<p>Second, we inject RA, DEC to compute its local coordinates:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">skyobj</span><span class="o">=</span> <span class="p">{</span><span class="s1">'RA'</span><span class="p">:</span><span class="n">ra</span> <span class="p">,</span> <span class="s1">'DEC'</span><span class="p">:</span><span class="n">dec</span> <span class="p">}</span>
<span class="n">outputs</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'elev'</span><span class="p">]</span>
<span class="n">target</span><span class="o">.</span><span class="n">define</span><span class="p">(</span><span class="n">skyobj</span><span class="p">)</span>
<span class="n">results</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">ephem</span><span class="p">(</span><span class="n">date</span><span class="p">,</span><span class="n">site</span><span class="p">,</span><span class="n">outputs</span><span class="p">)</span>
<span class="n">elev</span> <span class="o">=</span> <span class="n">results</span><span class="p">[</span><span class="s1">'ELEV'</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="angle-formats">
<h2>6. Angle formats<a class="headerlink" href="#angle-formats" title="Permalink to this headline">¶</a></h2>
<p>Input accepted formats:</p>
<div class="line-block">
<div class="line">-12.345 : Decimal degrees</div>
<div class="line">-0.3421r : Decimal radians</div>
<div class="line">6h3m2s : Sexagesimal HMS</div>
<div class="line">3mh2s : Sexagesimal MS</div>
<div class="line">2sh : Sexagesimal S</div>
<div class="line">6d3m2s : Sexagesimal dms</div>
<div class="line">3m2s : Sexagesimal ms</div>
<div class="line">2s : Sexagesimal s (i.e. arcsec)</div>
<div class="line">“6 3 2” : Sexagesimal dms</div>
<div class="line">“6:3:2” : Sexagesimal dms</div>
<div class="line">“6h3:2” : Sexagesimal HMS</div>
</div>
<p>Sexagesimal formating using uspzad convention rad is an angle in radian
Sexagesimal format:</p>
<blockquote>
<div><ul class="simple">
<li><p>u (unit) = h,H,d,D (default=D). Capital mean module [0:360[, lower case means module [-180:180[</p></li>
<li><p>s (separator) = ” “,:,”” (default=”” means letters hms or dms)</p></li>
<li><p>p (plus/minus) = +,”” (default=”“)</p></li>
<li><p>z (zeros) = 0,”” (default=”“)</p></li>
<li><p>a (angle_limits) = “”,90, (+/-limit if unit D,H, default=”” means 360)</p></li>
<li><p>d (sec_digits) = “”,”.1”,”.2”,… (default=”“)</p></li>
</ul>
</div></blockquote>
<p>Style 1:</p>
<blockquote>
<div><ul class="simple">
<li><p>To Display a R.A.: “H0.2” => 23h07m42.49s</p></li>
<li><p>To Display a Decl.: “d+090.1” => +00d34m22.6s</p></li>
<li><p>To Display a H.A.: “h0.2” => -08h43m16.05s</p></li>
</ul>
</div></blockquote>
<p>Style 2:</p>
<blockquote>
<div><ul class="simple">
<li><p>To Display a R.A.: “H 0.2” => 23 07 42.49</p></li>
<li><p>To Display a Decl.: “d +090.1” => -00 34 22.6</p></li>
<li><p>To Display a H.A.: “h 0.2” => -08 43 16.05</p></li>
</ul>
</div></blockquote>
<p>Style 3:</p>
<blockquote>
<div><ul class="simple">
<li><p>To Display a R.A.: “H:0.2” => 23:07:42.49</p></li>
<li><p>To Display a Decl.: “d:+090.1” => -00:34:22.6</p></li>
<li><p>To Display a H.A.: “h:0.2” => -08:43:16.05</p></li>
</ul>
</div></blockquote>
</div>
<div class="section" id="date-formats">
<h2>7. Date formats<a class="headerlink" href="#date-formats" title="Permalink to this headline">¶</a></h2>
<p>Input accepted formats:</p>
<ul class="simple">
<li><p>now = Now. e.g. “now”</p></li>
<li><p>jd = Julian day. e.g. 24504527.45678</p></li>
<li><p>iso = ISO 8601. e.g. 2018-02-28T12:34:55.23</p></li>
<li><p>sql = ISO 8601. e.g. 2018-02-28 12:34:55.23</p></li>
<li><p>ymdhms = Calendar. e.g. 2018 2 28 12 34 55.23</p></li>
<li><p>equinox = Equinox. e.g. J2000,0</p></li>
<li><p>digits = Pure digits e.g. 20180228123455.23</p></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">User guide to program with celme Python classes</a><ul>
<li><a class="reference internal" href="#context">1. Context</a></li>
<li><a class="reference internal" href="#python-classes-provided-by-celme">2. Python classes provided by celme</a></li>
<li><a class="reference internal" href="#using-the-python-module-celme-for-angles">3. Using the Python module celme for angles</a><ul>
<li><a class="reference internal" href="#simple-example-to-convert-angles">3.1. Simple example to convert angles</a></li>
<li><a class="reference internal" href="#operation-with-angles">3.2. Operation with angles</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-the-python-module-celme-for-dates">4. Using the Python module celme for dates</a><ul>
<li><a class="reference internal" href="#simple-example-to-convert-dates">4.1. Simple example to convert dates</a></li>
<li><a class="reference internal" href="#operation-with-dates">4.2. Operation with dates</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-the-python-module-celme-for-ephemeris">5. Using the Python module celme for ephemeris</a><ul>
<li><a class="reference internal" href="#simple-example-to-compute-sun-coordinates">5.1. Simple example to compute Sun coordinates</a></li>
</ul>
</li>
<li><a class="reference internal" href="#angle-formats">6. Angle formats</a></li>
<li><a class="reference internal" href="#date-formats">7. Date formats</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="using_mount_classes.html"
title="previous chapter">User guide to program with mount Python classes</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="generate_documentation.html"
title="next chapter">Generate this documentation</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/using_celme_classes.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="generate_documentation.html" title="Generate this documentation"
>next</a> |</li>
<li class="right" >
<a href="using_mount_classes.html" title="User guide to program with mount Python classes"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Mount Control Software 1.0.0 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">User guide to program with celme Python classes</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2021, astromecca.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.0.
</div>
</body>
</html>