Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Scale the pulse width to 1 from 1.04
#!/usr/bin/env ruby -w
require 'csv'
file = ARGV[0]
out = file.split('.').join('-normalized.')
unless file
puts "Usage: normalize [filename]"
end, 'w') do |csv|
CSV.foreach(file) do |line|
ts = line[0].to_f
rounded = (ts - (ts % 1.04)).round(2)
csv << [ rounded, line[1] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment