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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c167737b9b62bc8f3203a15d71b8e19b833c9f60
4
- data.tar.gz: cde82c76ecaa1ca50479e72befce896a4d7b929f
3
+ metadata.gz: e7328c3ca0000e0400eb3f755153170bcc02d017
4
+ data.tar.gz: 4df8b91ec124fddbca08099ab7ac7302bde3a682
5
5
  SHA512:
6
- metadata.gz: 4949e55d331fc8a6f371868b4a6f75784bdcc4be0fb25c96936a29539a7dd6bc7a8f9ee1bd4b7707e2f0f7a92a825156e5145f70ce843394ff67ca3a8206c0b7
7
- data.tar.gz: 69e866208d218793fc3b3770a7a6191794cdaf54cfef85eabc8c01acc837a318be5737c084f988138f8efd6970f9dba78d4ea3edaeea14fc61178961b44c75e8
6
+ metadata.gz: db2f21ceb25dcc0558923e385f07147b1a16aa824ef3119fc3097a2e26bfdb9f6b30c6d7677577c0ab88d53fb22a14f4848a7ccf7162c48ec78242c467b10cc3
7
+ data.tar.gz: a6ceb91a51ba4da871e9f00635fd1277e3046e9ac24d0a95e12cb39ad8fc4f7119c9076ac30d96efbde679f44fa6fbee2f6e1a98c7c8d23ad18ebb61473a9878
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Histogram
2
- VERSION = "0.2.1.2"
2
+ VERSION = "0.2.1.3"
3
3
  end
@@ -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.2
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-09-02 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler