digiproc 0.1.0 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9beaf357290bb8d1ddfb103b8d39614ce93539ead7353e2053faf8a3d3c36c3
4
- data.tar.gz: cf4a4a6c03e78ef312109654871c294c372f22bd9437813f61de092ae9453f89
3
+ metadata.gz: 6a559c48d3dcf0a499de8e2c2702b1f0d675a593ed69bfd790dace1a9ad7d504
4
+ data.tar.gz: f4b155f60d703f09a666b5f9196939d6876d7c3814b3b91e3e028c8f39ce5eeb
5
5
  SHA512:
6
- metadata.gz: 6891122f07044a1f0c20b424d5c16753f67ef4dbc71458ada887835bf39747d616bb6f1914a0c5d8fae155c1c74188daf601e88081c9922111ff11ec8b74f387
7
- data.tar.gz: 5a39c3fdba680ce91dec8122f8d9fd48959bc9df550bdce413d2b8efabe67f6d0feab00919f360a1fb2247ad9e15c4399b0af86bf771da7d1c7c514d97e2a851
6
+ metadata.gz: d6a7042e33b8c1d900570fd64aa88c6211d34aa86a0e571e05c098d4159540971c4313f7a722ad443aea29e91024d0d334bd0ca973ac45d4713d97f9ebcc8d45
7
+ data.tar.gz: 42d41807d3284135cf2c0379ac29d7d830300b8b8b0d1336485bf296a1fd09570fbecee343eed6867b26d0bfffcf1a1e2b2fe08a3f221c822562602369c9f03c
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in digiproc.gemspec
6
6
  gemspec
7
7
  gem 'gruff'
8
+ gem 'bigdecimal'
8
9
 
@@ -1,12 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- digiproc (0.1.0)
4
+ digiproc (0.2.4)
5
+ bigdecimal
6
+ bundler
5
7
  gruff (~> 0.7.0)
6
8
 
7
9
  GEM
8
10
  remote: https://rubygems.org/
9
11
  specs:
12
+ bigdecimal (2.0.0)
10
13
  coderay (1.1.2)
11
14
  diff-lcs (1.3)
12
15
  gruff (0.7.0)
@@ -36,6 +39,7 @@ PLATFORMS
36
39
  ruby
37
40
 
38
41
  DEPENDENCIES
42
+ bigdecimal
39
43
  bundler
40
44
  digiproc!
41
45
  gruff
@@ -45,4 +49,4 @@ DEPENDENCIES
45
49
  rspec (~> 3.0)
46
50
 
47
51
  BUNDLED WITH
48
- 2.0.1
52
+ 2.1.2
@@ -1,7 +1,7 @@
1
1
 
2
2
  require "bundler/setup"
3
-
4
- Bundler.require(:default)
3
+ require 'BigDecimal'
4
+ require 'gruff'
5
5
 
6
6
  require 'matrix'
7
7
  require 'ostruct'
@@ -10,7 +10,7 @@ require 'digiproc'
10
10
 
11
11
 
12
12
  #Extensions
13
- require './lib/extensions/core_extensions'
13
+ require_relative '../lib/extensions/core_extensions'
14
14
 
15
15
  Array.include Digiproc::CoreExtensions::ArrayExtension::DotProduct
16
16
  Array.include Digiproc::CoreExtensions::ArrayExtension::Sum
@@ -59,60 +59,60 @@ class Gruff::Base
59
59
  end
60
60
 
61
61
  #Strategies
62
- require './lib/strategies/strategies'
63
- require './lib/strategies/fft/inverse_fft_conjugate_strategy'
64
- require './lib/strategies/fft/brute_force_dft_strategy'
65
- require './lib/strategies/fft/radix2_strategy'
66
- require './lib/strategies/convolution/bf_conv'
67
- require './lib/strategies/window/window'
68
- require './lib/strategies/window/blackman_window'
69
- require './lib/strategies/window/hamming_window'
70
- require './lib/strategies/window/hanning_window'
71
- require './lib/strategies/window/rectangular_window'
72
- require './lib/strategies/companding/custom_companding_strategy'
73
- require './lib/strategies/gaussian/gaussian_generator'
74
- require './lib/strategies/orthogonalize/gram_schmidt'
75
- require './lib/strategies/code/gray_code'
76
- require './lib/strategies/code/differential_encoding_strategy'
77
- require './lib/strategies/code/xor_differential_encoding_strategy'
78
- require './lib/strategies/code/xor_differential_encoding_zero_angle_strategy'
79
- require './lib/strategies/modulation/phase_shift_keying_strategy'
80
- require './lib/strategies/linear_algebra/jacobi_strategy'
81
- require './lib/strategies/linear_algebra/gauss_seidel_strategy'
82
- require './lib/strategies/linear_algebra/sor_strategy'
83
- require './lib/strategies/linear_algebra/sor2_strategy'
62
+ require_relative '../lib/strategies/strategies'
63
+ require_relative '../lib/strategies/fft/inverse_fft_conjugate_strategy'
64
+ require_relative '../lib/strategies/fft/brute_force_dft_strategy'
65
+ require_relative '../lib/strategies/fft/radix2_strategy'
66
+ require_relative '../lib/strategies/convolution/bf_conv'
67
+ require_relative '../lib/strategies/window/window'
68
+ require_relative '../lib/strategies/window/blackman_window'
69
+ require_relative '../lib/strategies/window/hamming_window'
70
+ require_relative '../lib/strategies/window/hanning_window'
71
+ require_relative '../lib/strategies/window/rectangular_window'
72
+ require_relative '../lib/strategies/companding/custom_companding_strategy'
73
+ require_relative '../lib/strategies/gaussian/gaussian_generator'
74
+ require_relative '../lib/strategies/orthogonalize/gram_schmidt'
75
+ require_relative '../lib/strategies/code/gray_code'
76
+ require_relative '../lib/strategies/code/differential_encoding_strategy'
77
+ require_relative '../lib/strategies/code/xor_differential_encoding_strategy'
78
+ require_relative '../lib/strategies/code/xor_differential_encoding_zero_angle_strategy'
79
+ require_relative '../lib/strategies/modulation/phase_shift_keying_strategy'
80
+ require_relative '../lib/strategies/linear_algebra/jacobi_strategy'
81
+ require_relative '../lib/strategies/linear_algebra/gauss_seidel_strategy'
82
+ require_relative '../lib/strategies/linear_algebra/sor_strategy'
83
+ require_relative '../lib/strategies/linear_algebra/sor2_strategy'
84
84
 
85
85
  #Modules
86
- require './lib/concerns/plottable'
87
- require './lib/concerns/requires_data'
88
- require './lib/concerns/initializable'
89
- require './lib/concerns/convolvable'
90
- require './lib/concerns/fourier_transformable'
91
- require './lib/concerns/multipliable'
92
- require './lib/concerns/data_properties'
93
- require './lib/functions'
94
- require './lib/probability/probability'
95
- require './lib/concerns/os'
86
+ require_relative '../lib/concerns/plottable'
87
+ require_relative '../lib/concerns/requires_data'
88
+ require_relative '../lib/concerns/initializable'
89
+ require_relative '../lib/concerns/convolvable'
90
+ require_relative '../lib/concerns/fourier_transformable'
91
+ require_relative '../lib/concerns/multipliable'
92
+ require_relative '../lib/concerns/data_properties'
93
+ require_relative '../lib/functions'
94
+ require_relative '../lib/probability/probability'
95
+ require_relative '../lib/concerns/os'
96
96
 
97
97
 
98
98
 
99
99
  #Classes
100
- require './lib/fft'
101
- require './lib/signals/digital_signal'
102
- require './lib/filters/digital_filter.rb'
103
- require './lib/filters/lowpass_filter.rb'
104
- require './lib/filters/highpass_filter.rb'
105
- require './lib/filters/bandpass_filter.rb'
106
- require './lib/filters/bandstop_filter.rb'
107
- require './lib/signals/analog_signal'
108
- require './lib/probability/gaussian_distribution'
109
- require './lib/probability/theoretical_gaussian_distribution'
110
- require './lib/probability/bit_generator'
111
- require './lib/probability/binomial_distribution'
112
- require './lib/quick_plot'
113
- require './lib/rbplot'
100
+ require_relative '../lib/fft'
101
+ require_relative '../lib/signals/digital_signal'
102
+ require_relative '../lib/filters/digital_filter.rb'
103
+ require_relative '../lib/filters/lowpass_filter.rb'
104
+ require_relative '../lib/filters/highpass_filter.rb'
105
+ require_relative '../lib/filters/bandpass_filter.rb'
106
+ require_relative '../lib/filters/bandstop_filter.rb'
107
+ require_relative '../lib/signals/analog_signal'
108
+ require_relative '../lib/probability/gaussian_distribution'
109
+ require_relative '../lib/probability/theoretical_gaussian_distribution'
110
+ require_relative '../lib/probability/bit_generator'
111
+ require_relative '../lib/probability/binomial_distribution'
112
+ require_relative '../lib/quick_plot'
113
+ require_relative '../lib/rbplot'
114
114
 
115
115
  #Factories
116
- require './lib/factories/factories'
117
- require './lib/factories/window_factory'
118
- require './lib/factories/filter_factory'
116
+ require_relative '../lib/factories/factories'
117
+ require_relative '../lib/factories/window_factory'
118
+ require_relative '../lib/factories/filter_factory'
@@ -38,12 +38,14 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ["lib"]
39
39
 
40
40
  spec.add_development_dependency "bundler"
41
+ spec.add_runtime_dependency "bigdecimal"
41
42
  spec.add_development_dependency "rake", "~> 10.0"
42
43
  spec.add_development_dependency "rspec", "~> 3.0"
43
44
  spec.add_development_dependency 'rdoc'
44
45
  spec.add_development_dependency 'pry'
45
46
  spec.add_development_dependency 'gruff', "~> 0.7.0"
46
47
  spec.add_runtime_dependency "gruff", "~> 0.7.0"
48
+ spec.add_runtime_dependency "bundler"
47
49
  # spec.add_dependency "gruff"
48
50
  end
49
51
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Digiproc
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
 
6
6
 
@@ -13,9 +13,9 @@ class Digiproc::Probability::TheoreticalBinomialDistribution
13
13
  # k:: [Integer] (optional at initialization) Number of successes
14
14
  # p:: [Numeric] Probability of success
15
15
  def initialize(n: ,k: nil , p: )
16
- @n = n.to_f
17
- @k = k.to_f
18
- @p = p.to_f
16
+ @n = n
17
+ @k = k
18
+ @p = p
19
19
  end
20
20
 
21
21
  ##
@@ -66,17 +66,18 @@ class Digiproc::Probability::TheoreticalBinomialDistribution
66
66
  karr.each do |k_val|
67
67
  sum += self.coefficient(k_val) * ((self.p) ** (k_val)) * (1 - self.p) ** (n - k_val)
68
68
  end
69
- sum
69
+ sum.to_f
70
70
  end
71
71
 
72
72
  ##
73
73
  # Returns the binomial equation coefficient for a given number of wins, ie returns n! / (k! * (n - k)!)
74
74
  # Can take an argument of `k`, which defaults to `self.k`
75
+ # Returns a BigDecimal
75
76
  ## bd.coefficient(4) # => 210.0
76
77
  def coefficient(k = self.k)
77
- n_fact = Digiproc::Functions.fact(self.n)
78
- k_fact = Digiproc::Functions.fact(k)
79
- n_fact / (k_fact.to_f * (Digiproc::Functions.fact(self.n - k)))
78
+ n_fact = BigDecimal(Digiproc::Functions.fact(self.n))
79
+ k_fact = BigDecimal(Digiproc::Functions.fact(k))
80
+ n_fact / (k_fact * BigDecimal((Digiproc::Functions.fact(self.n - k))))
80
81
  end
81
82
 
82
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digiproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - micahshute
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-10 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bigdecimal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: 0.7.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: bundler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  description: Allows design of digital signals using the FFT, design of Digital Filters
112
140
  using the Windowing Method, creation of Digital Signals or Analog Signals sampled
113
141
  at a certain interval, convolution, cross-correlation, and visualization of the
@@ -314,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
342
  - !ruby/object:Gem::Version
315
343
  version: '0'
316
344
  requirements: []
317
- rubygems_version: 3.0.3
345
+ rubygems_version: 3.1.2
318
346
  signing_key:
319
347
  specification_version: 4
320
348
  summary: Perform basic Digital Signal Processing tasks, including convolution, fft,