#!/usr/bin/ruby

if ARGV.length != 2
	puts "Usage: ./scale_event.rb file.csv out.csv"
	exit
end

ih = File.open(ARGV.first, 'r')
cols = ih.readline.strip.split(',')
evt_col_ids = [*1..8].map { |i| cols.index "event#{i}" }

oh = File.open(ARGV.last, 'w')
oh.write "#{cols.join(',')}\n"

while not ih.eof?
	cols = ih.readline.strip.split(',').map { |i| i.to_f }
	evt_col_ids.each { |ei|
		cols[ei] = (cols[ei] == 1.0)?100.0:-100.0
	}
	oh.write "#{cols.join(',')}\n"
end
