Created
January 16, 2017 21:28
-
-
Save madpilot/25e70bdea0252f7a72931a06bfd4a1fc to your computer and use it in GitHub Desktop.
Scale the pulse width to 1 from 1.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
require 'csv' | |
file = ARGV[0] | |
out = file.split('.').join('-normalized.') | |
unless file | |
puts "Usage: normalize [filename]" | |
exit(1) | |
end | |
CSV.open(out, 'w') do |csv| | |
CSV.foreach(file) do |line| | |
ts = line[0].to_f | |
rounded = (ts - (ts % 1.04)).round(2) | |
csv << [ rounded, line[1] ] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment