mspire 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mspire/bin.rb +19 -17
- data/lib/mspire/peaklist.rb +15 -4
- data/lib/mspire/spectrum_like.rb +2 -2
- data/lib/mspire/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92ec4a23bf1ecef8abc24269b4e680c8a7ed8bd
|
4
|
+
data.tar.gz: 1016a66f7c99acf348ae1a439c77fd54e91431f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a09382c44d33e3cb5d6f3d307c8306a06af85851645f3d4ee80799b85ecbd41e87b53b8b29ee758909050776356d88eda131b77f169493b299a42af0954486b5
|
7
|
+
data.tar.gz: b3161fcf60c22a25b2c736612b7d9798c95185a45b9de97d181c791b6311d58fc73a927540385c908b26a394ca0f5dbe550b646e331da8f0d1f924054a216cb4
|
data/lib/mspire/bin.rb
CHANGED
@@ -38,25 +38,27 @@ module Mspire
|
|
38
38
|
#
|
39
39
|
#
|
40
40
|
def self.bin(bins, objects, *data_capture_obj, &block)
|
41
|
-
obj_e = objects.each ; obj = obj_e.next
|
42
|
-
|
43
41
|
data_capture = data_capture_obj.first || bins
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
obj=obj_e.next rescue done=true
|
59
|
-
|
43
|
+
if objects.size > 0
|
44
|
+
obj_e = objects.each ; obj = obj_e.next
|
45
|
+
|
46
|
+
bin_i = 0 # the bin index
|
47
|
+
cbin = bins[bin_i] # the current bin
|
48
|
+
done = false
|
49
|
+
until done
|
50
|
+
value = (block.nil? ? obj : block.call(obj))
|
51
|
+
if cbin.begin <= value
|
52
|
+
until cbin === value && data_capture[bin_i] << obj
|
53
|
+
bin_i += 1
|
54
|
+
cbin=bins[bin_i] || (done=true && break)
|
55
|
+
end
|
56
|
+
obj=obj_e.next rescue done=true
|
57
|
+
else
|
58
|
+
while cbin.begin > value && !done
|
59
|
+
obj=obj_e.next rescue done=true && break
|
60
|
+
value = (block.nil? ? obj : block.call(obj))
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
data/lib/mspire/peaklist.rb
CHANGED
@@ -7,11 +7,11 @@ module Mspire
|
|
7
7
|
class Peaklist < Array
|
8
8
|
|
9
9
|
def lo_x
|
10
|
-
self.first[0]
|
10
|
+
self.first[0] if size > 0
|
11
11
|
end
|
12
12
|
|
13
13
|
def hi_x
|
14
|
-
self.last[0]
|
14
|
+
self.last[0] if size > 0
|
15
15
|
end
|
16
16
|
|
17
17
|
DEFAULT_MERGE = {
|
@@ -77,8 +77,10 @@ module Mspire
|
|
77
77
|
first_peaklist = peaklists.first
|
78
78
|
min = first_peaklist.first.x; max = first_peaklist.last.x
|
79
79
|
peaklists.each do |peaklist|
|
80
|
-
|
81
|
-
|
80
|
+
if peaklist.size > 0
|
81
|
+
min = peaklist.lo_x if peaklist.lo_x < min
|
82
|
+
max = peaklist.hi_x if peaklist.hi_x > max
|
83
|
+
end
|
82
84
|
end
|
83
85
|
[min, max]
|
84
86
|
end
|
@@ -355,6 +357,15 @@ module Mspire
|
|
355
357
|
no_lm_pklsts
|
356
358
|
end
|
357
359
|
end # def split
|
360
|
+
|
361
|
+
# returns an Mspire::Spectrum object
|
362
|
+
def to_spectrum
|
363
|
+
xs = [] ; ys = []
|
364
|
+
each do |peak|
|
365
|
+
xs << peak.x ; ys << peak.y
|
366
|
+
end
|
367
|
+
Mspire::Spectrum.new([xs, ys])
|
368
|
+
end
|
358
369
|
end
|
359
370
|
end
|
360
371
|
|
data/lib/mspire/spectrum_like.rb
CHANGED
@@ -83,11 +83,11 @@ module Mspire
|
|
83
83
|
pl = Peaklist.new
|
84
84
|
if peak_id
|
85
85
|
peaks.each_with_index do |peak,i|
|
86
|
-
pl[i] = Mspire::
|
86
|
+
pl[i] = Mspire::TaggedPeak.new( peak, peak_id )
|
87
87
|
end
|
88
88
|
else
|
89
89
|
peaks.each_with_index do |peak,i|
|
90
|
-
pl[i] = Mspire::
|
90
|
+
pl[i] = Mspire::Peak.new( peak )
|
91
91
|
end
|
92
92
|
end
|
93
93
|
pl
|
data/lib/mspire/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John T. Prince
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -547,4 +547,3 @@ test_files:
|
|
547
547
|
- spec/testfiles/mspire/quant/unlog_transform.rb
|
548
548
|
- spec/testfiles/plms1/output.key
|
549
549
|
- spec/testfiles/processed_binary.tmp.ibd
|
550
|
-
has_rdoc:
|