mork 0.0.11 → 0.0.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f6fdf479e1ce97ef698e1dfb43d571a86b580c7
4
- data.tar.gz: 3e8f988b67a5f11bb3cb62541bfff93865c1e236
3
+ metadata.gz: f6930d8ee718dadb56c51c8f4ab776a489b017ac
4
+ data.tar.gz: 8cbaef664dc24c91748e4f4cfb61724a7c38e2ef
5
5
  SHA512:
6
- metadata.gz: 571d163c91f8ed00ce47d2423c02f22603ce1287c9e61cc62c25670156e6a08ffd931287655673a120df91e6dbc01b35d47995da592316bdb41c42b625c9461d
7
- data.tar.gz: c604bffbb932a0657b327471f82a56b95ddfc4ce85aa0d0f18241b50b789287043906f09da73be9d70aa2d9049edb95074fb464e4c33a098472d71c0d1bea7b7
6
+ metadata.gz: 3ae5c320ba47ce34331bcf0d5bbff6e8dc7a2fdc359de092843f54bff6bbf545430ccf8f294ac4e79ec9c13217980f8319079a5ba11d7b8670ddae49f62e9109
7
+ data.tar.gz: 76c6f22dced2dc12e41534d51066a1c9e8c07b1cd3c0fbb5fcc7f63d12b04dcb7d034bb01549732e643879531615e0bdfb3d7853002d9245a3e8d892f2505be1
@@ -176,7 +176,7 @@ module Mork
176
176
  end
177
177
 
178
178
  def choice_threshold
179
- @choice_threshold ||= ccmeans.mean - ccmeans.stdev * 7
179
+ @choice_threshold ||= (ccmeans.mean - ink_black) * 0.9 + ink_black
180
180
  end
181
181
 
182
182
  def ccmeans
data/lib/mork/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mork
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -22,6 +22,36 @@ module Mork
22
22
  sheet.outline [[1],[1],[2],[2],[3,4],[],[0,1,2,3,4]]
23
23
  sheet.write 'spec/out/marked_highlights.jpg'
24
24
  end
25
+
26
+ it 'highlights marked cells of a problematic one' do
27
+ s = SheetOMR.new 'spec/samples/qzc013.jpg'
28
+ s.highlight_marked
29
+ s.write 'spec/out/problem.jpg'
30
+ end
31
+
32
+ it 'writes out average whiteness of choice cells' do
33
+ s = SheetOMR.new 'spec/samples/qzc013.jpg'
34
+ puts "Choice threshold: #{s.send :choice_threshold}"
35
+ File.open('spec/out/choices.txt', 'w') do |f|
36
+ 120.times do |q|
37
+ t = (0..4).collect do |c|
38
+ s.send(:shade_of, q, c).round
39
+ end
40
+ f.puts "#{q+1}: #{t.join(' ')}"
41
+ end
42
+ end
43
+
44
+ mf = File.open('spec/out/marked.txt', 'w')
45
+ uf = File.open('spec/out/unmarked.txt', 'w')
46
+ 120.times do |q|
47
+ 5.times do |c|
48
+ shade = s.send(:shade_of, q, c)
49
+ s.marked?(q,c) ? mf.puts(shade) : uf.puts(shade)
50
+ end
51
+ end
52
+ mf.close
53
+ uf.close
54
+ end
25
55
  end
26
56
 
27
57
  context 'marking a nicely printed and scanned sheet' do
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giuseppe Bertini
@@ -183,6 +183,7 @@ files:
183
183
  - spec/samples/grid160.yml
184
184
  - spec/samples/grid_omr_01.yml
185
185
  - spec/samples/info.yml
186
+ - spec/samples/qzc013.jpg
186
187
  - spec/samples/reg_mark.jpg
187
188
  - spec/samples/sample01.jpg
188
189
  - spec/samples/sample02.jpg
@@ -237,6 +238,7 @@ test_files:
237
238
  - spec/samples/grid160.yml
238
239
  - spec/samples/grid_omr_01.yml
239
240
  - spec/samples/info.yml
241
+ - spec/samples/qzc013.jpg
240
242
  - spec/samples/reg_mark.jpg
241
243
  - spec/samples/sample01.jpg
242
244
  - spec/samples/sample02.jpg