savgol 0.3.0 → 0.4.0

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: bc7a6227404449143b6b264e85308bda89e5e2fa
4
- data.tar.gz: 5e4089173d7d618e2bfe372a5758e78c6be22f36
3
+ metadata.gz: 69777ebb389b04a34f25578d0665655b6ec85cc0
4
+ data.tar.gz: 951c926859327d255f17d46656efb4112cce90dc
5
5
  SHA512:
6
- metadata.gz: 6552c4e22998e3f8fb8b594f89684c42fe296496e1481b7f03aef6d43d68032ba23a8341a8288e2695b73b7e5527fc382f92dba9a02ff84764395949735c1836
7
- data.tar.gz: dab124a5685cd5c3215d9b3ab628d626ec44590e883c1d340d4bbcad278d7a74f426520abdd19a8cbc16ee2dddd652014ecc1001a6ff7dcf9279c65ce91ce763
6
+ metadata.gz: da716e299d33b41b350660ed15002efae2b9b6b01ff3495b53bc156d672077c31c64369efb85498a155a9ac2a569ea551c6af85e8e2d7f329238078722cbb9a6
7
+ data.tar.gz: 7bb86d464d652cf6205fc06e75ff0287bac523b0f047ba08d8ff85c29a121543462cdb200f2a5b8169f6aab852dc930b04e6cdb8a51772fd6597058e1c51d769
@@ -5,7 +5,7 @@ class NilEnumerator < Enumerator
5
5
  def initialize(enum)
6
6
  @enum = enum
7
7
  end
8
-
8
+
9
9
  def next
10
10
  begin
11
11
  @enum.next
@@ -14,7 +14,7 @@ class NilEnumerator < Enumerator
14
14
  end
15
15
  end
16
16
  end
17
-
17
+
18
18
  module Savgol
19
19
  class << self
20
20
  # Does simple least squares to fit a polynomial based on the given x
@@ -33,7 +33,7 @@ module Savgol
33
33
  nearest_xval_indices = sg_nearest_index(xvals, new_xvals)
34
34
  new_xvals.zip(nearest_xval_indices).map do |new_xval, index|
35
35
  sg_regress_and_find(
36
- xvals_padded[index,window_points],
36
+ xvals_padded[index,window_points],
37
37
  yvals_padded[index,window_points],
38
38
  order,
39
39
  new_xval
@@ -68,7 +68,7 @@ module Savgol
68
68
  break unless newval
69
69
 
70
70
  if index.nil?
71
- indices << last_index
71
+ indices << last_index
72
72
  else
73
73
  until newval <= original_vals[index]
74
74
  index = index_iter.next
@@ -112,7 +112,7 @@ module Savgol
112
112
 
113
113
  def sg_check_arguments(window_points, order)
114
114
  if !window_points.is_a?(Integer) || window_points.abs != window_points || window_points % 2 != 1 || window_points < 1
115
- raise ArgumentError, "window_points size must be a positive odd integer"
115
+ raise ArgumentError, "window_points size must be a positive odd integer"
116
116
  end
117
117
  if !order.is_a?(Integer) || order < 0
118
118
  raise ArgumentError, "order must be an integer >= 0"
@@ -144,7 +144,7 @@ module Savgol
144
144
  def sg_pad_xvals(array, half_window)
145
145
  deltas = array[0..half_window].each_cons(2).map {|a,b| b-a }
146
146
  start = array[0]
147
- prevals = deltas.map do |delta|
147
+ prevals = deltas.map do |delta|
148
148
  newval = start - delta
149
149
  start = newval
150
150
  newval
@@ -153,7 +153,7 @@ module Savgol
153
153
 
154
154
  deltas = array[(-half_window-1)..-1].each_cons(2).map {|a,b| b-a }
155
155
  start = array[-1]
156
- postvals = deltas.reverse.map do |delta|
156
+ postvals = deltas.reverse.map do |delta|
157
157
  newval = start + delta
158
158
  start = newval
159
159
  newval
@@ -1,3 +1,3 @@
1
1
  module Savgol
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -25,12 +25,12 @@ Gem::Specification.new do |spec|
25
25
  end
26
26
 
27
27
  [
28
- ["bundler", "~> 1.5.1"],
28
+ ["bundler", "~> 1.8.3"],
29
29
  ["rake"],
30
- ["rspec", "~> 2.14.1"],
31
- ["rdoc", "~> 4.1.0"],
32
- ["simplecov", "~> 0.8.2"],
33
- ["gnuplot"],
30
+ ["rspec", "~> 3.2.0"],
31
+ ["rdoc", "~> 4.2.0"],
32
+ ["simplecov", "~> 0.9.2"],
33
+ ["gnuplot", "~> 2.6.2"],
34
34
  ].each do |args|
35
35
  spec.add_development_dependency(*args)
36
36
  end
@@ -13,7 +13,7 @@ shared_examples "a savgol smoother" do
13
13
  it "works for the simple case" do
14
14
  numpy_savgol_output = [1.0, 2.0, 3.12857143, 3.57142857, 4.27142857, 4.12571429, 3.36857143, 2.69714286, 2.04, 0.32571429, -0.05714286, 0.8, 0.51428571, -2.17142857, -5.25714286, -7.65714286, -6.4, -2.77142857, 0.17142857, 0.91428571, 1.0]
15
15
  sg = smoother.savgol(5,3)
16
- sg.size.should == numpy_savgol_output.size
16
+ expect(sg.size).to eq(numpy_savgol_output.size)
17
17
 
18
18
  numpy_savgol_output.each_with_index do |exp, i|
19
19
  expect(sg[i]).to be_within(0.000001).of(exp)
@@ -4,6 +4,5 @@ SimpleCov.start
4
4
  require 'rspec'
5
5
 
6
6
  RSpec.configure do |config|
7
- config.treat_symbols_as_metadata_keys_with_true_values = true
8
7
  config.color = true
9
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savgol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John T. Prince
@@ -9,92 +9,92 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-24 00:00:00.000000000 Z
12
+ date: 2015-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.5.1
20
+ version: 1.8.3
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.5.1
27
+ version: 1.8.3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.14.1
48
+ version: 3.2.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.14.1
55
+ version: 3.2.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rdoc
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 4.1.0
62
+ version: 4.2.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 4.1.0
69
+ version: 4.2.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simplecov
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 0.8.2
76
+ version: 0.9.2
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 0.8.2
83
+ version: 0.9.2
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: gnuplot
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: 2.6.2
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: 2.6.2
98
98
  description: Extends Array class with method which calculates applies Savitzky-Golay
99
99
  filter used for smoothing the data
100
100
  email:
@@ -103,9 +103,9 @@ executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
- - .document
107
- - .gitignore
108
- - .rspec
106
+ - ".document"
107
+ - ".gitignore"
108
+ - ".rspec"
109
109
  - Gemfile
110
110
  - LICENSE.txt
111
111
  - README.md
@@ -128,17 +128,17 @@ require_paths:
128
128
  - lib
129
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.0.14
141
+ rubygems_version: 2.4.5
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: performs Savitzky-Golay smoothing