astronoby 0.0.1 → 0.2.0
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.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +74 -4
- data/CONTRIBUTING.md +86 -0
- data/Gemfile.lock +52 -35
- data/README.md +81 -9
- data/UPGRADING.md +109 -0
- data/lib/astronoby/aberration.rb +42 -0
- data/lib/astronoby/angle.rb +157 -21
- data/lib/astronoby/angles/dms.rb +18 -0
- data/lib/astronoby/angles/hms.rb +17 -0
- data/lib/astronoby/bodies/sun.rb +226 -0
- data/lib/astronoby/body.rb +155 -0
- data/lib/astronoby/coordinates/ecliptic.rb +42 -0
- data/lib/astronoby/coordinates/equatorial.rb +88 -0
- data/lib/astronoby/coordinates/horizontal.rb +53 -0
- data/lib/astronoby/epoch.rb +24 -0
- data/lib/astronoby/equinox_solstice.rb +153 -0
- data/lib/astronoby/errors.rb +7 -0
- data/lib/astronoby/geocentric_parallax.rb +130 -0
- data/lib/astronoby/mean_obliquity.rb +32 -0
- data/lib/astronoby/nutation.rb +71 -0
- data/lib/astronoby/observer.rb +57 -0
- data/lib/astronoby/precession.rb +86 -0
- data/lib/astronoby/refraction.rb +73 -0
- data/lib/astronoby/time/greenwich_sidereal_time.rb +86 -0
- data/lib/astronoby/time/local_sidereal_time.rb +41 -0
- data/lib/astronoby/true_obliquity.rb +12 -0
- data/lib/astronoby/util/astrodynamics.rb +60 -0
- data/lib/astronoby/util/trigonometry.rb +26 -0
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +23 -8
- metadata +45 -25
- data/.prettierrc +0 -11
- data/.standard.yml +0 -3
- data/astronoby.gemspec +0 -40
- data/lib/astronoby/angles/degree.rb +0 -17
- data/lib/astronoby/angles/radian.rb +0 -17
- data/sig/astronoby.rbs +0 -4
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class Refraction
|
5
|
+
LOW_ALTITUDE_BODY_ANGLE = Angle.as_degrees(15)
|
6
|
+
ZENITH = Angle.as_degrees(90)
|
7
|
+
|
8
|
+
def self.angle(coordinates:, observer:)
|
9
|
+
new(coordinates, observer).refraction_angle
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.correct_horizontal_coordinates(coordinates:, observer:)
|
13
|
+
new(coordinates, observer).refract
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(coordinates, observer)
|
17
|
+
@coordinates = coordinates
|
18
|
+
@observer = observer
|
19
|
+
end
|
20
|
+
|
21
|
+
# Source:
|
22
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
23
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
24
|
+
# Edition: Cambridge University Press
|
25
|
+
# Chapter: 37 - Refraction
|
26
|
+
def refract
|
27
|
+
Coordinates::Horizontal.new(
|
28
|
+
azimuth: @coordinates.azimuth,
|
29
|
+
altitude: @coordinates.altitude + refraction_angle,
|
30
|
+
latitude: @coordinates.latitude,
|
31
|
+
longitude: @coordinates.longitude
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def refraction_angle
|
36
|
+
if @coordinates.altitude > LOW_ALTITUDE_BODY_ANGLE
|
37
|
+
high_altitude_angle
|
38
|
+
else
|
39
|
+
low_altitude_angle
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def pressure
|
46
|
+
@_pressure ||= @observer.pressure
|
47
|
+
end
|
48
|
+
|
49
|
+
def temperature
|
50
|
+
@_temperature ||= @observer.temperature
|
51
|
+
end
|
52
|
+
|
53
|
+
def altitude_in_degrees
|
54
|
+
@_altitude_in_degrees ||= @coordinates.altitude.degrees
|
55
|
+
end
|
56
|
+
|
57
|
+
def high_altitude_angle
|
58
|
+
zenith_angle = ZENITH - @coordinates.altitude
|
59
|
+
Angle.as_degrees(0.00452 * pressure * zenith_angle.tan / temperature)
|
60
|
+
end
|
61
|
+
|
62
|
+
def low_altitude_angle
|
63
|
+
term1 = pressure * (
|
64
|
+
0.1594 + 0.0196 * altitude_in_degrees + 0.00002 * altitude_in_degrees**2
|
65
|
+
)
|
66
|
+
term2 = temperature * (
|
67
|
+
1 + 0.505 * altitude_in_degrees + 0.0845 * altitude_in_degrees**2
|
68
|
+
)
|
69
|
+
|
70
|
+
Angle.as_degrees(term1 / term2)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class GreenwichSiderealTime
|
5
|
+
JULIAN_CENTURIES_EXPONENTS = [
|
6
|
+
BigDecimal("6.697374558"),
|
7
|
+
BigDecimal("2400.051336"),
|
8
|
+
BigDecimal("0.000025862")
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
attr_reader :date, :time
|
12
|
+
|
13
|
+
# Source:
|
14
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
15
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
16
|
+
# Edition: Cambridge University Press
|
17
|
+
# Chapter: 12 - Conversion of UT to Greenwich sidereal time (GST)
|
18
|
+
def self.from_utc(utc)
|
19
|
+
date = utc.to_date
|
20
|
+
julian_day = utc.to_date.ajd
|
21
|
+
t = (julian_day - Epoch::J2000) / Epoch::DAYS_PER_JULIAN_CENTURY
|
22
|
+
t0 = (
|
23
|
+
(JULIAN_CENTURIES_EXPONENTS[0] +
|
24
|
+
(JULIAN_CENTURIES_EXPONENTS[1] * t) +
|
25
|
+
(JULIAN_CENTURIES_EXPONENTS[2] * t * t)) % 24
|
26
|
+
).abs
|
27
|
+
|
28
|
+
ut_in_hours = utc.hour +
|
29
|
+
utc.min / 60.0 +
|
30
|
+
(utc.sec + utc.subsec) / 3600.0
|
31
|
+
|
32
|
+
gmst = BigDecimal("1.002737909") * ut_in_hours + t0
|
33
|
+
gmst += 24 if gmst.negative?
|
34
|
+
gmst -= 24 if gmst > 24
|
35
|
+
|
36
|
+
new(date: date, time: gmst)
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(date:, time:)
|
40
|
+
@date = date
|
41
|
+
@time = time
|
42
|
+
end
|
43
|
+
|
44
|
+
# Source:
|
45
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
46
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
47
|
+
# Edition: Cambridge University Press
|
48
|
+
# Chapter: 13 - Conversion of GST to UT
|
49
|
+
def to_utc
|
50
|
+
date = @date
|
51
|
+
julian_day = @date.ajd
|
52
|
+
t = (julian_day - Epoch::J2000) / Epoch::DAYS_PER_JULIAN_CENTURY
|
53
|
+
|
54
|
+
t0 = (
|
55
|
+
(JULIAN_CENTURIES_EXPONENTS[0] +
|
56
|
+
(JULIAN_CENTURIES_EXPONENTS[1] * t) +
|
57
|
+
(JULIAN_CENTURIES_EXPONENTS[2] * t * t)) % 24
|
58
|
+
).abs
|
59
|
+
|
60
|
+
a = @time - t0
|
61
|
+
a += 24 if a.negative?
|
62
|
+
a -= 24 if a > 24
|
63
|
+
|
64
|
+
utc = BigDecimal("0.9972695663") * a
|
65
|
+
|
66
|
+
decimal_hour_to_time(date, utc)
|
67
|
+
end
|
68
|
+
|
69
|
+
def to_lst(longitude:)
|
70
|
+
LocalSiderealTime.from_gst(gst: self, longitude: longitude)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def decimal_hour_to_time(date, decimal)
|
76
|
+
absolute_hour = decimal.abs
|
77
|
+
hour = absolute_hour.floor
|
78
|
+
decimal_minute = 60 * (absolute_hour - hour)
|
79
|
+
absolute_decimal_minute = (60 * (absolute_hour - hour)).abs
|
80
|
+
minute = decimal_minute.floor
|
81
|
+
second = 60 * (absolute_decimal_minute - absolute_decimal_minute.floor)
|
82
|
+
|
83
|
+
::Time.utc(date.year, date.month, date.day, hour, minute, second).round
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class LocalSiderealTime
|
5
|
+
attr_reader :date, :time, :longitude
|
6
|
+
|
7
|
+
# Source:
|
8
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
9
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
10
|
+
# Edition: Cambridge University Press
|
11
|
+
# Chapter: 14 - Local sidereal time (LST)
|
12
|
+
def self.from_gst(gst:, longitude:)
|
13
|
+
date = gst.date
|
14
|
+
time = gst.time + longitude.hours
|
15
|
+
time += 24 if time.negative?
|
16
|
+
time -= 24 if time > 24
|
17
|
+
|
18
|
+
new(date: date, time: time, longitude: longitude)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(date:, time:, longitude:)
|
22
|
+
@date = date
|
23
|
+
@time = time
|
24
|
+
@longitude = longitude
|
25
|
+
end
|
26
|
+
|
27
|
+
# Source:
|
28
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
29
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
30
|
+
# Edition: Cambridge University Press
|
31
|
+
# Chapter: 15 - Converting LST to GST
|
32
|
+
def to_gst
|
33
|
+
date = @date
|
34
|
+
time = @time - @longitude.hours
|
35
|
+
time += 24 if time.negative?
|
36
|
+
time -= 24 if time > 24
|
37
|
+
|
38
|
+
GreenwichSiderealTime.new(date: date, time: time)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class TrueObliquity
|
5
|
+
def self.for_epoch(epoch)
|
6
|
+
mean_obliquity = MeanObliquity.for_epoch(epoch)
|
7
|
+
nutation = Nutation.for_obliquity_of_the_ecliptic(epoch: epoch)
|
8
|
+
|
9
|
+
mean_obliquity + nutation
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
module Util
|
5
|
+
module Astrodynamics
|
6
|
+
class << self
|
7
|
+
# Source:
|
8
|
+
# Title: Celestial Calculations
|
9
|
+
# Author: J. L. Lawrence
|
10
|
+
# Edition: MIT Press
|
11
|
+
# Chapter: 4 - Orbits and Coordinate Systems
|
12
|
+
def eccentric_anomaly_newton_raphson(
|
13
|
+
mean_anomaly,
|
14
|
+
orbital_eccentricity,
|
15
|
+
precision,
|
16
|
+
maximum_iteration_count,
|
17
|
+
current_iteration = 0,
|
18
|
+
solution_on_previous_interation = nil
|
19
|
+
)
|
20
|
+
previous_solution = solution_on_previous_interation&.radians
|
21
|
+
|
22
|
+
solution = if previous_solution.nil?
|
23
|
+
if orbital_eccentricity <= 0.75
|
24
|
+
mean_anomaly.radians
|
25
|
+
else
|
26
|
+
Math::PI
|
27
|
+
end
|
28
|
+
else
|
29
|
+
previous_solution - (
|
30
|
+
(
|
31
|
+
previous_solution -
|
32
|
+
orbital_eccentricity * Math.sin(previous_solution) -
|
33
|
+
mean_anomaly.radians
|
34
|
+
) / (
|
35
|
+
1 - orbital_eccentricity * Math.cos(previous_solution)
|
36
|
+
)
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
if current_iteration >= maximum_iteration_count ||
|
41
|
+
(
|
42
|
+
previous_solution &&
|
43
|
+
(solution - previous_solution).abs <= precision
|
44
|
+
)
|
45
|
+
return Angle.as_radians(solution)
|
46
|
+
end
|
47
|
+
|
48
|
+
eccentric_anomaly_newton_raphson(
|
49
|
+
mean_anomaly,
|
50
|
+
orbital_eccentricity,
|
51
|
+
precision,
|
52
|
+
maximum_iteration_count,
|
53
|
+
current_iteration + 1,
|
54
|
+
Angle.as_radians(solution)
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bigdecimal/math"
|
4
|
+
|
5
|
+
module Astronoby
|
6
|
+
module Util
|
7
|
+
module Trigonometry
|
8
|
+
class << self
|
9
|
+
# Source:
|
10
|
+
# Title: Celestial Calculations
|
11
|
+
# Author: J. L. Lawrence
|
12
|
+
# Edition: MIT Press
|
13
|
+
# Chapter: 4 - Orbits and Coordinate Systems
|
14
|
+
def adjustement_for_arctangent(y, x, angle)
|
15
|
+
return angle if y.positive? && x.positive?
|
16
|
+
|
17
|
+
if y.negative? && x.positive?
|
18
|
+
return Angle.as_degrees(angle.degrees + 360)
|
19
|
+
end
|
20
|
+
|
21
|
+
Angle.as_degrees(angle.degrees + 180)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/astronoby/version.rb
CHANGED
data/lib/astronoby.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "astronoby/version"
|
4
3
|
require "astronoby/angle"
|
5
|
-
require "astronoby/angles/
|
6
|
-
require "astronoby/angles/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
require "astronoby/angles/dms"
|
5
|
+
require "astronoby/angles/hms"
|
6
|
+
require "astronoby/epoch"
|
7
|
+
require "astronoby/body"
|
8
|
+
require "astronoby/bodies/sun"
|
9
|
+
require "astronoby/coordinates/ecliptic"
|
10
|
+
require "astronoby/coordinates/equatorial"
|
11
|
+
require "astronoby/coordinates/horizontal"
|
12
|
+
require "astronoby/aberration"
|
13
|
+
require "astronoby/equinox_solstice"
|
14
|
+
require "astronoby/errors"
|
15
|
+
require "astronoby/geocentric_parallax"
|
16
|
+
require "astronoby/mean_obliquity"
|
17
|
+
require "astronoby/nutation"
|
18
|
+
require "astronoby/observer"
|
19
|
+
require "astronoby/precession"
|
20
|
+
require "astronoby/refraction"
|
21
|
+
require "astronoby/time/greenwich_sidereal_time"
|
22
|
+
require "astronoby/time/local_sidereal_time"
|
23
|
+
require "astronoby/util/astrodynamics"
|
24
|
+
require "astronoby/util/trigonometry"
|
25
|
+
require "astronoby/true_obliquity"
|
26
|
+
require "astronoby/version"
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: astronoby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémy Hannequin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: matrix
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.4.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.4.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
47
|
+
version: '3.0'
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: standard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,31 +66,51 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
|
-
description: Ruby version of the calculations from
|
70
|
-
|
69
|
+
description: Ruby version of the calculations from various books like Celestial Calculations
|
70
|
+
by J. L. Lawrence, Practical Astronomy with your Calculator or Spreadsheet by Peter
|
71
|
+
Duffett-Smith and Jonathan Zwart, or Astronomical Algorithms by Jean Meeus
|
71
72
|
email:
|
72
73
|
- hello@rhannequ.in
|
73
74
|
executables: []
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
76
77
|
files:
|
77
|
-
- ".prettierrc"
|
78
78
|
- ".rspec"
|
79
|
-
- ".
|
79
|
+
- ".tool-versions"
|
80
80
|
- CHANGELOG.md
|
81
81
|
- CODE_OF_CONDUCT.md
|
82
|
+
- CONTRIBUTING.md
|
82
83
|
- Gemfile
|
83
84
|
- Gemfile.lock
|
84
85
|
- LICENSE.txt
|
85
86
|
- README.md
|
86
87
|
- Rakefile
|
87
|
-
-
|
88
|
+
- UPGRADING.md
|
88
89
|
- lib/astronoby.rb
|
90
|
+
- lib/astronoby/aberration.rb
|
89
91
|
- lib/astronoby/angle.rb
|
90
|
-
- lib/astronoby/angles/
|
91
|
-
- lib/astronoby/angles/
|
92
|
+
- lib/astronoby/angles/dms.rb
|
93
|
+
- lib/astronoby/angles/hms.rb
|
94
|
+
- lib/astronoby/bodies/sun.rb
|
95
|
+
- lib/astronoby/body.rb
|
96
|
+
- lib/astronoby/coordinates/ecliptic.rb
|
97
|
+
- lib/astronoby/coordinates/equatorial.rb
|
98
|
+
- lib/astronoby/coordinates/horizontal.rb
|
99
|
+
- lib/astronoby/epoch.rb
|
100
|
+
- lib/astronoby/equinox_solstice.rb
|
101
|
+
- lib/astronoby/errors.rb
|
102
|
+
- lib/astronoby/geocentric_parallax.rb
|
103
|
+
- lib/astronoby/mean_obliquity.rb
|
104
|
+
- lib/astronoby/nutation.rb
|
105
|
+
- lib/astronoby/observer.rb
|
106
|
+
- lib/astronoby/precession.rb
|
107
|
+
- lib/astronoby/refraction.rb
|
108
|
+
- lib/astronoby/time/greenwich_sidereal_time.rb
|
109
|
+
- lib/astronoby/time/local_sidereal_time.rb
|
110
|
+
- lib/astronoby/true_obliquity.rb
|
111
|
+
- lib/astronoby/util/astrodynamics.rb
|
112
|
+
- lib/astronoby/util/trigonometry.rb
|
92
113
|
- lib/astronoby/version.rb
|
93
|
-
- sig/astronoby.rbs
|
94
114
|
homepage: https://github.com/rhannequin/astronoby
|
95
115
|
licenses:
|
96
116
|
- MIT
|
@@ -98,7 +118,7 @@ metadata:
|
|
98
118
|
homepage_uri: https://github.com/rhannequin/astronoby
|
99
119
|
source_code_uri: https://github.com/rhannequin/astronoby
|
100
120
|
changelog_uri: https://github.com/rhannequin/astronoby/blob/main/CHANGELOG.md
|
101
|
-
post_install_message:
|
121
|
+
post_install_message:
|
102
122
|
rdoc_options: []
|
103
123
|
require_paths:
|
104
124
|
- lib
|
@@ -106,15 +126,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
126
|
requirements:
|
107
127
|
- - ">="
|
108
128
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
129
|
+
version: 3.2.0
|
110
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
131
|
requirements:
|
112
132
|
- - ">="
|
113
133
|
- !ruby/object:Gem::Version
|
114
134
|
version: '0'
|
115
135
|
requirements: []
|
116
|
-
rubygems_version: 3.3
|
117
|
-
signing_key:
|
136
|
+
rubygems_version: 3.5.3
|
137
|
+
signing_key:
|
118
138
|
specification_version: 4
|
119
139
|
summary: Astronomical calculations
|
120
140
|
test_files: []
|
data/.prettierrc
DELETED
data/.standard.yml
DELETED
data/astronoby.gemspec
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/astronoby/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "astronoby"
|
7
|
-
spec.version = Astronoby::VERSION
|
8
|
-
spec.authors = ["Rémy Hannequin"]
|
9
|
-
spec.email = ["hello@rhannequ.in"]
|
10
|
-
|
11
|
-
spec.summary = "Astronomical calculations"
|
12
|
-
spec.description = "Ruby version of the calculations from Astronomical Algorithms by Jean Meeus"
|
13
|
-
spec.homepage = "https://github.com/rhannequin/astronoby"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.7.6"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(__dir__) do
|
24
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
-
end
|
27
|
-
end
|
28
|
-
spec.bindir = "exe"
|
29
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = ["lib"]
|
31
|
-
|
32
|
-
spec.add_dependency "rake", "~> 13.0"
|
33
|
-
spec.add_dependency "rspec", "~> 3.0"
|
34
|
-
|
35
|
-
spec.add_development_dependency "prettier", "~> 2.0"
|
36
|
-
spec.add_development_dependency "standard", "~> 1.3"
|
37
|
-
|
38
|
-
# For more information and examples about making a new gem, check out our
|
39
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Astronoby
|
4
|
-
class Degree < Angle
|
5
|
-
def initialize(angle)
|
6
|
-
super(angle, unit: DEGREES)
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_degrees
|
10
|
-
self
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_radians
|
14
|
-
self.class.as_radians(@angle / 180 * PI)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Astronoby
|
4
|
-
class Radian < Angle
|
5
|
-
def initialize(angle)
|
6
|
-
super(angle, unit: RADIANS)
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_degrees
|
10
|
-
self.class.as_degrees(@angle * 180 / PI)
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_radians
|
14
|
-
self
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/sig/astronoby.rbs
DELETED