digiproc 0.2.0 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -2
- data/config/environment.rb +52 -52
- data/digiproc.gemspec +1 -0
- data/lib/digiproc/version.rb +1 -1
- data/lib/probability/binomial_distribution.rb +8 -7
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31ca4f5ba15b2f7dbefe946d24bc9f69f57308dca39f04b836de296e6e068d43
|
4
|
+
data.tar.gz: 995fd90cbf150fa30db77f7091357041cffbc07d327f5673e84dba9634e7a65a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11096509ee34d9f8c78201f45280a557d9297fef94697735bf5a36d31eb3d92c0f6f3d7abe83769e0d70b8e6f0bfaa87a0396d73ebcee888cd11a52291dc6449
|
7
|
+
data.tar.gz: e4ae86838bcb1c40479eaed012c27cacde242f034aaba7e1b94c4c60423f813e460fe1c05f027670ff3deb34b63b121bba62618a5a779b11b62a5e22e284bea0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
digiproc (0.2.
|
4
|
+
digiproc (0.2.5)
|
5
|
+
bigdecimal
|
5
6
|
bundler
|
6
7
|
gruff (~> 0.7.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
12
|
+
bigdecimal (2.0.0)
|
11
13
|
coderay (1.1.2)
|
12
14
|
diff-lcs (1.3)
|
13
15
|
gruff (0.7.0)
|
@@ -37,6 +39,7 @@ PLATFORMS
|
|
37
39
|
ruby
|
38
40
|
|
39
41
|
DEPENDENCIES
|
42
|
+
bigdecimal
|
40
43
|
bundler
|
41
44
|
digiproc!
|
42
45
|
gruff
|
@@ -46,4 +49,4 @@ DEPENDENCIES
|
|
46
49
|
rspec (~> 3.0)
|
47
50
|
|
48
51
|
BUNDLED WITH
|
49
|
-
2.
|
52
|
+
2.1.2
|
data/config/environment.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require "bundler/setup"
|
3
|
-
|
4
|
-
|
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
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
-
|
117
|
-
|
118
|
-
|
116
|
+
require_relative '../lib/factories/factories'
|
117
|
+
require_relative '../lib/factories/window_factory'
|
118
|
+
require_relative '../lib/factories/filter_factory'
|
data/digiproc.gemspec
CHANGED
@@ -38,6 +38,7 @@ 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'
|
data/lib/digiproc/version.rb
CHANGED
@@ -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
|
17
|
-
@k = k
|
18
|
-
@p = p
|
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
|
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.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- micahshute
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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
|
@@ -328,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
342
|
- !ruby/object:Gem::Version
|
329
343
|
version: '0'
|
330
344
|
requirements: []
|
331
|
-
rubygems_version: 3.
|
345
|
+
rubygems_version: 3.1.2
|
332
346
|
signing_key:
|
333
347
|
specification_version: 4
|
334
348
|
summary: Perform basic Digital Signal Processing tasks, including convolution, fft,
|