Class: Jeti::Log::Data::CompositeDatasetBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/jeti/log/data/composite_dataset_builder.rb

Class Method Summary collapse

Class Method Details

.build(file, clazz, device, primary, *others) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jeti/log/data/composite_dataset_builder.rb', line 5

def self.build(file, clazz, device, primary, *others)
  primaries = file.value_dataset(device, primary)

  other_data = others.map do |other|
    file.value_dataset(device, other)
  end

  primaries.map do |raw|
    time, f0 = raw
    fn = other_data.map { |d| d.min_by { |dp| (dp[0] - time).abs }[1] }
    clazz.new(time, fn.unshift(f0))
  end
end