korba 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9653687d464e692461e7f9d1a02bf22c969b9cbd410be77270f2774f04efde50
4
+ data.tar.gz: d5d043ecefc767e6ba7c158158065cfc42fc3bcda73b47e6f79315c478733b4a
5
+ SHA512:
6
+ metadata.gz: 64c57ea852bd747be82d9c0d42a963c1990167d92316447b6ccf338be2fc8e4c9775fb2155f1372939a1aa5d5a2c554a9e4abb213367e13afd51df5bd51b22a2
7
+ data.tar.gz: 90e986f11ccfa6f197df247339d39e1c928c788e36c0796027a571e09718c83ac75c4f210104ba5b209bc28c3eb183a021cb00e7c2caf08439082a1468dca97b
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-11-30
4
+
5
+ - Initial release
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Korba
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/korba`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/korba.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Korba
4
+ class Constant
5
+ # 3.986004418(8)×10^14 m3/s2
6
+ GME = 3.9860044188e14
7
+ end
8
+ end
data/lib/korba/kep.rb ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Korba
4
+ class Kep
5
+ attr_reader :object_name, :epoch, :semi_major_axis, :eccentricity, :inclination, :ra_of_asc_node, :arg_of_pericenter, :mean_anomaly
6
+
7
+ def initialize(object_name:, epoch:, semi_major_axis:, eccentricity:, inclination:, ra_of_asc_node:, arg_of_pericenter:, mean_anomaly:)
8
+ @object_name = object_name
9
+ @epoch = epoch
10
+ @semi_major_axis = semi_major_axis
11
+ @eccentricity = eccentricity
12
+ @inclination = inclination
13
+ @ra_of_asc_node = ra_of_asc_node
14
+ @arg_of_pericenter = arg_of_pericenter
15
+ @mean_anomaly = mean_anomaly
16
+ end
17
+ end
18
+ end
data/lib/korba/tle.rb ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ module Korba
3
+ class Tle
4
+ attr_reader :tle_json, :object_name, :object_id, :epoch, :mean_motion, :eccentricity, :inclination, :ra_of_asc_node, :arg_of_pericenter, :mean_anomaly
5
+
6
+ def initialize(tle_json)
7
+ @tle_json = tle_json
8
+ @object_name = tle_json[:OBJECT_NAME]
9
+ @object_id = tle_json[:OBJECT_ID]
10
+ @epoch = tle_json[:EPOCH]
11
+ @mean_motion = tle_json[:MEAN_MOTION]
12
+ @eccentricity = tle_json[:ECCENTRICITY]
13
+ @inclination = tle_json[:INCLINATION]
14
+ @ra_of_asc_node = tle_json[:RA_OF_ASC_NODE]
15
+ @arg_of_pericenter = tle_json[:ARG_OF_PERICENTER]
16
+ @mean_anomaly = tle_json[:MEAN_ANOMALY]
17
+ end
18
+
19
+ def semi_major_axis
20
+ # a = (μ / n^2)^(1/3) m
21
+ (Korba::Constant::GME / (mean_motion * 2 * Math::PI / 86400.0) ** 2.0) ** (1.0 / 3.0)
22
+ end
23
+
24
+ def to_kep
25
+ Korba::Kep.new(object_name:,
26
+ epoch:,
27
+ semi_major_axis:,
28
+ eccentricity:,
29
+ inclination:,
30
+ ra_of_asc_node:,
31
+ arg_of_pericenter:,
32
+ mean_anomaly:)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Korba
4
+ VERSION = "0.1.0"
5
+ end
data/lib/korba.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "korba/version"
4
+ require_relative "korba/constant"
5
+ require_relative "korba/tle"
6
+ require_relative "korba/kep"
7
+
8
+ module Korba
9
+ end
data/sig/korba.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Korba
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: korba
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - kk0000-kk
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-12-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Orbital elements calculation library
14
+ email:
15
+ - kazuyoshi.kobayashi.1@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - CHANGELOG.md
22
+ - README.md
23
+ - Rakefile
24
+ - lib/korba.rb
25
+ - lib/korba/constant.rb
26
+ - lib/korba/kep.rb
27
+ - lib/korba/tle.rb
28
+ - lib/korba/version.rb
29
+ - sig/korba.rbs
30
+ homepage: https://github.com/kk0000-kk/korba
31
+ licenses: []
32
+ metadata:
33
+ allowed_push_host: https://rubygems.org
34
+ homepage_uri: https://github.com/kk0000-kk/korba
35
+ source_code_uri: https://github.com/kk0000-kk/korba
36
+ changelog_uri: https://github.com/kk0000-kk/korba/blob/main/CHANGELOG.md
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.5.9
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: Orbital elements calculation library
56
+ test_files: []