suntrack 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+ <dt class="r1">Includes:</dt>
79
+ <dd class="r1">Math</dd>
80
+
81
+
82
+
83
+
84
+
85
+ </dl>
86
+ <div class="clear"></div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+
93
+
94
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Suntrack.html" title="Suntrack (class)">Suntrack</a></span>
95
+
96
+
97
+ </p>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ </div>
109
+
110
+ <div id="footer">
111
+ Generated on Thu Sep 13 11:06:18 2012 by
112
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
113
+ 0.8.2.1 (ruby-1.9.2).
114
+ </div>
115
+
116
+ </body>
117
+ </html>
data/lib/suntrack.rb CHANGED
@@ -5,8 +5,12 @@ class Suntrack
5
5
 
6
6
  @@attributes = {}
7
7
 
8
- # Return Sun location, in altitude(y) and azimuth(z), given
9
- # DateTime, latitude and longitude
8
+ # Returns Sun location, in altitude(sun_position.y) and
9
+ # azimuth(sun_position.z), given DateTime, latitude and longitude
10
+ # @param [DateTime] date_time the date and time for Sun position
11
+ # @param [Float] latitude the user's latitude, in degrees
12
+ # @param [Float] longitude the user's longitude, in degrees
13
+ # @return [Suntrack::Point3D] the altitude (y) and azimuth(z) of the Sun
10
14
  def self.sun_location(date_time,latitude,longitude)
11
15
 
12
16
  mjd = Suntrack::RAstro.to_mjd(date_time)
@@ -15,18 +19,22 @@ class Suntrack
15
19
  dec = Suntrack::RAstro.sun_position(tm)
16
20
  tau = 15 * (Suntrack::RAstro.lmst(mjd,longitude) - dec.z)
17
21
  z_in = Suntrack::Point3D.new(dec.y,tau,latitude)
18
- z = z_in.equatorial_to_horizon
19
- z
22
+ sun_position = z_in.equatorial_to_horizon
23
+ sun_position
20
24
  end
21
25
 
22
- # Return Sirius location, in altitude(y) and azimuth(z), given
23
- # DateTime, latitude and longitude
26
+ # Returns Sirius location, in altitude(sirius_position.y) and
27
+ # azimuth(sirius_position.z), given DateTime, latitude and longitude
28
+ # @param [DateTime] date_time the date and time for Sirius
29
+ # @param [Float] latitude the user's latitude, in degrees
30
+ # @param [Float] longitude the user's longitude, in degrees
31
+ # @return [Suntrack::Point3D] the altitude (y) and azimuth(z) of Sirius
24
32
  def self.sirius_location(date_time,latitude,longitude)
25
33
  mjd = Suntrack::RAstro.to_mjd(date_time)
26
34
  tau = 15 * (Suntrack::RAstro.lmst(mjd,longitude) - Suntrack::RAstro::SIRIUS_RA)
27
35
  z_in = Suntrack::Point3D.new(Suntrack::RAstro::SIRIUS_DECLINATION,tau,latitude)
28
- z = z_in.equatorial_to_horizon
29
- z
36
+ sirius_position = z_in.equatorial_to_horizon
37
+ sirius_position
30
38
  end
31
39
 
32
40
  # allow user to create new star location functions
@@ -29,6 +29,8 @@ class Suntrack::Point3D
29
29
 
30
30
  # Precess an ecliptic Cartesian point between two epochs
31
31
  # M&P, page 21
32
+ # @param [Float] t1 Epoch constant for first epoch
33
+ # @param [Float] t2 Epoch constant for second epoch
32
34
  def precess_ecliptic_cartesian!(t1,t2)
33
35
  a = pmat_ecliptic(t1,t2)
34
36
  x = @x
@@ -41,6 +43,8 @@ class Suntrack::Point3D
41
43
 
42
44
  # Precess an equatorial Cartesian point between two epochs
43
45
  # M&P, page 21
46
+ # @param [Float] t1 Epoch constant for first epoch
47
+ # @param [Float] t2 Epoch constant for second epoch
44
48
  def precess_equatorial_cartesian!(t1,t2)
45
49
  a = pmat_equatorial(t1,t2)
46
50
  x = @x
@@ -87,6 +91,7 @@ class Suntrack::Point3D
87
91
  # M&P, page 15
88
92
  # Arises from slow alterations in the Earth's orbit as a result of
89
93
  # perturbations from other planets.
94
+ # @param [Float] t Epoch constant
90
95
  eps = 23.43929111-(46.815+(0.00059-0.001813*t)*t)*t/3600
91
96
  y = @y
92
97
  z = @z
@@ -98,6 +103,7 @@ class Suntrack::Point3D
98
103
 
99
104
  # Convert equatorial coordinates to horizon coordinates
100
105
  # M&P, pp. 34-35
106
+ # @return [Suntrack::Point3D] pt polar coordinates: the altitude (y) and azimuth(z) of the input vector
101
107
  def equatorial_to_horizon
102
108
  cs_phi = cs(@z)
103
109
  sn_phi = sn(@z)
@@ -116,6 +122,8 @@ class Suntrack::Point3D
116
122
 
117
123
  # Precession matrix from one epoch to another, in ecliptic coordinates
118
124
  # M&P, page 20
125
+ # @param [Float] t1 Epoch constant for first epoch
126
+ # @param [Float] t2 Epoch constant for second epoch
119
127
  def pmat_ecliptic(t1,t2)
120
128
  sec = 3600
121
129
  dt = t2-t1
@@ -143,6 +151,8 @@ class Suntrack::Point3D
143
151
 
144
152
  # Precession matrix from one epoch to another, in equatorial coordinates
145
153
  # M&P, page 20
154
+ # @param [Float] t1 Epoch constant for first epoch
155
+ # @param [Float] t2 Epoch constant for second epoch
146
156
  def pmat_equatorial(t1,t2)
147
157
  sec = 3600
148
158
  dt = t2-t1
@@ -14,6 +14,10 @@ class Suntrack::RAstro
14
14
  SIRIUS_RA = 6.75242
15
15
 
16
16
  # Sun position method.
17
+ # Returns Sun location, in declination and right ascension,
18
+ # given time in Julian centuries
19
+ # @param [Float] t time in Julian centuries
20
+ # @return [Suntrack::Point3D] the declination (y) and right ascension (z) of the Sun
17
21
  def self.sun_position(t)
18
22
  # Montebruck & Pfleger, page 36
19
23
  # Low-precision Sun position as a function of t
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: suntrack
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joel M. Gottlieb
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-09-12 00:00:00 Z
13
+ date: 2012-09-13 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Sun position as function of time
@@ -25,6 +25,14 @@ files:
25
25
  - lib/suntrack.rb
26
26
  - lib/suntrack/Point3D.rb
27
27
  - lib/suntrack/RAstro.rb
28
+ - doc/frames.html
29
+ - doc/file_list.html
30
+ - doc/index.html
31
+ - doc/method_list.html
32
+ - doc/top-level-namespace.html
33
+ - doc/Suntrack.html
34
+ - doc/class_list.html
35
+ - doc/_index.html
28
36
  homepage:
29
37
  licenses: []
30
38
 
@@ -54,3 +62,4 @@ specification_version: 3
54
62
  summary: Suntrack
55
63
  test_files: []
56
64
 
65
+ has_rdoc: