imzml 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5591dbd65b301f6c008d56453b7cf9f3668b394b
4
- data.tar.gz: d1cd802b1ff67f067d60007687fbaab164745b52
3
+ metadata.gz: c52da2783768c7aa8c665b2cee9fe78abc5d5b3a
4
+ data.tar.gz: 5cc44fda48e8f4098197b170fe48c4a1b369283d
5
5
  SHA512:
6
- metadata.gz: bd611f99d401acc47fdab97c0ce6e1a40a61cb6a95f684374656fdc635f9b745adff17e29116ae691b64044df8d174aa1f5453e9038c2fb87fed0c1ac36e8a8e
7
- data.tar.gz: 1470bd7d36bfe4e5233d27d799f0702423a58991bf31175aa7c4cc11bd3965f1ada94fa5d17bb19f6e8a0c0f2628960efb3560036b22e340f42e6252d48ad186
6
+ metadata.gz: 216c0b0d091f68511c0184130a89f01c9bd29228875c39f39927ac9ad5dc1dbd05fa577c3e63fb170c04b74e5f6d1760b138d14b7afc64a6928776e7146beef9
7
+ data.tar.gz: eb0f16e382adb599f20fdc949c16851d2778bf236103c5fc1fd701a867ec9910304504c6da55be3908ffc8a759771f8cd66b355f5080d3bdcdcfd28eb8680cea
@@ -36,8 +36,8 @@ module ImzML
36
36
  # Binary values type [:int8, :int16, :int32, :int64, :float32, :float64]
37
37
  attr_accessor :type
38
38
 
39
- # grabs the actual binary data from disk
40
- def data(cached = true)
39
+ # Grabs the actual binary data from disk
40
+ def data(cached = false)
41
41
 
42
42
  # Return the data from the cache
43
43
  return @cached_data if cached && !@cached_data.nil?
@@ -65,7 +65,11 @@ module ImzML
65
65
  data = IO.binread(@filepath, @encoded_length.to_i, @offset.to_i).unpack("#{pattern}*")
66
66
 
67
67
  # Save data only if user want's to cache it, saving take some CPU
68
- @cached_data = data if cached
68
+ if cached
69
+ @cached_data = data
70
+ else
71
+ data
72
+ end
69
73
  end
70
74
 
71
75
  private
@@ -91,38 +95,6 @@ module ImzML
91
95
  # Represented by class BinaryData
92
96
  attr_accessor :intensity_binary
93
97
 
94
- def intensity(at, interval)
95
-
96
- # read whole the binary data
97
- mz_array = mz_binary.data
98
- intensity_array = intensity_binary.data
99
-
100
- default_from, default_to = mz_array.first, mz_array.first
101
-
102
- from = default_from
103
- to = default_to
104
-
105
- # find designated intensity
106
- if at
107
- from = at - interval
108
- from = default_from if from < 0
109
- to = at + interval
110
- to = default_to if to > mz_array.last
111
- end
112
-
113
- # find values in mz array
114
- low_value = mz_array.bsearch { |x| x >= from }
115
- low_index = mz_array.index(low_value)
116
- high_value = mz_array.bsearch { |x| x >= to }
117
- high_index = mz_array.index(high_value)
118
-
119
- # sum all values in subarray
120
- sum = intensity_array[low_index..high_index].inject{|sum, x| sum + x}
121
-
122
- sum
123
- end
124
-
125
-
126
98
  end
127
99
 
128
100
  end
data/lib/imzml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module ImzML
2
2
 
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.4"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imzml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondra Beneš
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-03 00:00:00.000000000 Z
11
+ date: 2014-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest