lib/writers/stimtimes_writer.rb in optimus-ep-0.5 vs lib/writers/stimtimes_writer.rb in optimus-ep-0.5.5
- old
+ new
@@ -7,15 +7,17 @@
# This class is a bit ugly around the edges -- I'm not quite sure how to
# architect it, yet.
require 'eprime'
-require 'column_calculator'
-require 'row_filter'
+require 'transformers/column_calculator'
+require 'transformers/row_filter'
module Eprime
class StimtimesWriter
+ include Transformers
+
@@computed_columns = []
@@counter_columns = []
@@copydown_columns = []
@@runs = 0
@@run_column = ''
@@ -28,11 +30,11 @@
File.open(filename, 'r') do |f|
reader = Eprime::Reader.new(f)
edata.merge!(reader.eprime_data)
end
- @calc = Eprime::ColumnCalculator.new
+ @calc = ColumnCalculator.new
@calc.data = edata
@@computed_columns.each do |coldata|
@calc.computed_column *coldata
end
@@ -52,10 +54,10 @@
end
end
def output_file(filename, filter, output_column)
File.open(filename, 'w') do |file|
- filtered = Eprime::RowFilter.new(@calc, filter)
+ filtered = RowFilter.new(@calc, filter)
1.upto(@@runs) do |run|
run_rows = filtered.find_all {|row| row[@@run_column].to_s == run.to_s}.to_a
vals = run_rows.map { |r| r[output_column] }
if vals.size == 0
\ No newline at end of file