histogram 0.2.1.2 → 0.2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/histogram.rb +2 -1
- data/lib/histogram/version.rb +1 -1
- data/spec/histogram_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7328c3ca0000e0400eb3f755153170bcc02d017
|
4
|
+
data.tar.gz: 4df8b91ec124fddbca08099ab7ac7302bde3a682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db2f21ceb25dcc0558923e385f07147b1a16aa824ef3119fc3097a2e26bfdb9f6b30c6d7677577c0ab88d53fb22a14f4848a7ccf7162c48ec78242c467b10cc3
|
7
|
+
data.tar.gz: a6ceb91a51ba4da871e9f00635fd1277e3046e9ac24d0a95e12cb39ad8fc4f7119c9076ac30d96efbde679f44fa6fbee2f6e1a98c7c8d23ad18ebb61473a9878
|
data/lib/histogram.rb
CHANGED
@@ -94,6 +94,7 @@ module Histogram
|
|
94
94
|
2 * Histogram.iqrange(self, method: quartile_method) * (self.size**(-1.0/3))
|
95
95
|
end
|
96
96
|
nbins = 1 if nbins <= 0
|
97
|
+
nbins = 1 if nbins.nan?
|
97
98
|
nbins.ceil.to_i
|
98
99
|
end
|
99
100
|
end
|
@@ -294,7 +295,7 @@ module Histogram
|
|
294
295
|
# Create the scaling factor
|
295
296
|
|
296
297
|
dmin = _min.to_f
|
297
|
-
conv = bins.to_f/(_max - _min)
|
298
|
+
conv = _max == _min ? 0 : bins.to_f/(_max - _min)
|
298
299
|
|
299
300
|
_bins =
|
300
301
|
if self.is_a?(Array)
|
data/lib/histogram/version.rb
CHANGED
data/spec/histogram_spec.rb
CHANGED
@@ -84,6 +84,10 @@ shared_examples 'something that can histogram' do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
it 'can handle 0 stddev' do
|
88
|
+
bins, freq = obj6.histogram
|
89
|
+
end
|
90
|
+
|
87
91
|
end
|
88
92
|
|
89
93
|
describe Histogram do
|
@@ -94,6 +98,7 @@ describe Histogram do
|
|
94
98
|
obj3: [1, 1, 2, 2, 3, 3, 4, 4, 4],
|
95
99
|
obj4: [2, 2, 2, 2, 2, 4],
|
96
100
|
obj5: [1,2,3,3,3,4,5,6,7,8],
|
101
|
+
obj6: [0,0,0,0,0]
|
97
102
|
}
|
98
103
|
data = tmp.each {|k,v| [k, v.map(&:to_f).extend(Histogram)] }
|
99
104
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: histogram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.1.
|
4
|
+
version: 0.2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John T. Prince
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|