optimus-ep 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +9 -0
- data/bin/eprime2tabfile +165 -0
- data/bin/stim.times +5 -0
- data/bin/stim1.times +5 -0
- data/bin/stim1_b.times +5 -0
- data/bin/stim1_c.times +5 -0
- data/bin/stim1_d.times +5 -0
- data/bin/test_data.txt +278 -0
- data/bin/test_data2.txt +277 -0
- data/bin/test_eprime_stimfile.rb +20 -0
- data/lib/calculator.rb +49 -0
- data/lib/column_calculator.rb +308 -0
- data/lib/eprime.rb +23 -0
- data/lib/eprime_data.rb +154 -0
- data/lib/eprime_reader.rb +105 -0
- data/lib/eprimetab_parser.rb +21 -0
- data/lib/excel_parser.rb +21 -0
- data/lib/log_file_parser.rb +208 -0
- data/lib/row_filter.rb +40 -0
- data/lib/tabfile_parser.rb +55 -0
- data/lib/tabfile_writer.rb +44 -0
- data/lib/writers/stimtimes_writer.rb +97 -0
- data/spec/calculator_spec.rb +56 -0
- data/spec/column_calculator_spec.rb +368 -0
- data/spec/eprime_data_spec.rb +202 -0
- data/spec/eprime_reader_spec.rb +115 -0
- data/spec/eprimetab_parser_spec.rb +23 -0
- data/spec/excel_parser_spec.rb +26 -0
- data/spec/log_file_parser_spec.rb +156 -0
- data/spec/row_filter_spec.rb +32 -0
- data/spec/samples/bad_excel_tsv.txt +4 -0
- data/spec/samples/corrupt_log_file.txt +116 -0
- data/spec/samples/eprime_tsv.txt +7 -0
- data/spec/samples/excel_tsv.txt +5 -0
- data/spec/samples/optimus_log.txt +110 -0
- data/spec/samples/short_columns.txt +1 -0
- data/spec/samples/sorted_columns.txt +1 -0
- data/spec/samples/std_columns.txt +1 -0
- data/spec/samples/unknown_type.txt +2 -0
- data/spec/samples/unreadable_file +1 -0
- data/spec/spec_helper.rb +98 -0
- data/spec/tabfile_parser_spec.rb +62 -0
- data/spec/tabfile_writer_spec.rb +91 -0
- data/spec/writers/stimtimes_writer_spec.rb +16 -0
- metadata +106 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
# Part of the Optimus package for managing E-Prime data
|
2
|
+
#
|
3
|
+
# Copyright (C) 2008 Board of Regents of the University of Wisconsin System
|
4
|
+
#
|
5
|
+
# Written by Nathan Vack <njvack@wisc.edu>, at the Waisman Laborotory for Brain
|
6
|
+
# Imaging and Behavior, University of Wisconsin - Madison
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__),'spec_helper')
|
9
|
+
require File.join(File.dirname(__FILE__), '../lib/eprime')
|
10
|
+
require 'stringio'
|
11
|
+
|
12
|
+
include EprimeTestHelper
|
13
|
+
|
14
|
+
E_ROWS = 3
|
15
|
+
E_COLS = 4
|
16
|
+
|
17
|
+
describe "Eprime::TabfileWriter" do
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
@eprime_data = mock_eprime(E_COLS, E_ROWS)
|
21
|
+
@out_s = StringIO.new
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should succeed at writing" do
|
25
|
+
writer = Eprime::TabfileWriter.new(@eprime_data, @out_s)
|
26
|
+
writer.write
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "without filename line" do
|
30
|
+
before :each do
|
31
|
+
@writer = Eprime::TabfileWriter.new(@eprime_data, @out_s)
|
32
|
+
@writer.write
|
33
|
+
@out_s.rewind
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should write out #{E_ROWS+1} lines" do
|
37
|
+
@out_s.readlines.size.should == E_ROWS+1
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should write a first line containing #{E_COLS} tab-separated elements" do
|
41
|
+
@out_s.gets.split("\t").size.should == E_COLS
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have blank spaces for nil value in last line" do
|
45
|
+
@out_s.readlines.last.split("\t").should include('')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "with filename line" do
|
50
|
+
before :each do
|
51
|
+
def @out_s.path # Redefine this so we can test the first line trick
|
52
|
+
'spec_test'
|
53
|
+
end
|
54
|
+
@writer = Eprime::TabfileWriter.new(@eprime_data, @out_s, :write_top_line => true)
|
55
|
+
@writer.write
|
56
|
+
@out_s.rewind
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should write out #{E_ROWS+2} lines" do
|
60
|
+
@out_s.readlines.size.should == E_ROWS+2
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should have the file path with spec_test as the first line" do
|
64
|
+
@out_s.gets.strip.should == File.expand_path('spec_test')
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "with good output columns specified" do
|
70
|
+
before :each do
|
71
|
+
@writer = Eprime::TabfileWriter.new(@eprime_data, @out_s, :columns => ['col_2'])
|
72
|
+
@writer.write
|
73
|
+
@out_s.rewind
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should include only one column" do
|
77
|
+
lines = @out_s.readlines
|
78
|
+
lines[0].split("\t").size.should == 1
|
79
|
+
lines[1].split("\t").size.should == 1
|
80
|
+
lines[1].split("\t")[0].strip.should == "c_2_r_1"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "with nonexistent output column specified" do
|
85
|
+
|
86
|
+
it "should raise an error when specifying a nonexistent column" do
|
87
|
+
@writer = Eprime::TabfileWriter.new(@eprime_data, @out_s, :columns => ['KITTEH'])
|
88
|
+
lambda { @writer.write }.should raise_error(IndexError)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Part of the Optimus package for managing E-Prime data
|
2
|
+
#
|
3
|
+
# Copyright (C) 2008 Board of Regents of the University of Wisconsin System
|
4
|
+
#
|
5
|
+
# Written by Nathan Vack <njvack@wisc.edu>, at the Waisman Laborotory for Brain
|
6
|
+
# Imaging and Behavior, University of Wisconsin - Madison
|
7
|
+
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__),'../spec_helper')
|
10
|
+
require File.join(File.dirname(__FILE__), '../../lib/eprime')
|
11
|
+
require File.join(File.dirname(__FILE__), '../../lib/writers/stimtimes_writer')
|
12
|
+
|
13
|
+
describe Eprime::StimtimesWriter do
|
14
|
+
# I don't actually know how to spec this out. I'm a bit worried.
|
15
|
+
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: optimus-ep
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.5"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Vack
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-06-26 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rparsec
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "1.0"
|
23
|
+
version:
|
24
|
+
description:
|
25
|
+
email: njvack@wisc.edu
|
26
|
+
executables:
|
27
|
+
- eprime2tabfile
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- Rakefile
|
34
|
+
- bin/eprime2tabfile
|
35
|
+
- bin/stim.times
|
36
|
+
- bin/stim1.times
|
37
|
+
- bin/stim1_b.times
|
38
|
+
- bin/stim1_c.times
|
39
|
+
- bin/stim1_d.times
|
40
|
+
- bin/test_data.txt
|
41
|
+
- bin/test_data2.txt
|
42
|
+
- bin/test_eprime_stimfile.rb
|
43
|
+
- spec/calculator_spec.rb
|
44
|
+
- spec/column_calculator_spec.rb
|
45
|
+
- spec/eprime_data_spec.rb
|
46
|
+
- spec/eprime_reader_spec.rb
|
47
|
+
- spec/eprimetab_parser_spec.rb
|
48
|
+
- spec/excel_parser_spec.rb
|
49
|
+
- spec/log_file_parser_spec.rb
|
50
|
+
- spec/row_filter_spec.rb
|
51
|
+
- spec/samples
|
52
|
+
- spec/samples/bad_excel_tsv.txt
|
53
|
+
- spec/samples/corrupt_log_file.txt
|
54
|
+
- spec/samples/eprime_tsv.txt
|
55
|
+
- spec/samples/excel_tsv.txt
|
56
|
+
- spec/samples/optimus_log.txt
|
57
|
+
- spec/samples/short_columns.txt
|
58
|
+
- spec/samples/sorted_columns.txt
|
59
|
+
- spec/samples/std_columns.txt
|
60
|
+
- spec/samples/unknown_type.txt
|
61
|
+
- spec/samples/unreadable_file
|
62
|
+
- spec/spec_helper.rb
|
63
|
+
- spec/tabfile_parser_spec.rb
|
64
|
+
- spec/tabfile_writer_spec.rb
|
65
|
+
- spec/writers
|
66
|
+
- spec/writers/stimtimes_writer_spec.rb
|
67
|
+
- lib/calculator.rb
|
68
|
+
- lib/column_calculator.rb
|
69
|
+
- lib/eprime.rb
|
70
|
+
- lib/eprime_data.rb
|
71
|
+
- lib/eprime_reader.rb
|
72
|
+
- lib/eprimetab_parser.rb
|
73
|
+
- lib/excel_parser.rb
|
74
|
+
- lib/log_file_parser.rb
|
75
|
+
- lib/row_filter.rb
|
76
|
+
- lib/tabfile_parser.rb
|
77
|
+
- lib/tabfile_writer.rb
|
78
|
+
- lib/writers/stimtimes_writer.rb
|
79
|
+
has_rdoc: false
|
80
|
+
homepage: http://code.google.com/p/optimus-ep/
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
version:
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: "0"
|
97
|
+
version:
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
rubyforge_project: optimus-ep
|
101
|
+
rubygems_version: 1.0.1
|
102
|
+
signing_key:
|
103
|
+
specification_version: 2
|
104
|
+
summary: A collection of utilities to manage EPrime files
|
105
|
+
test_files: []
|
106
|
+
|