karolinska 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8bf0a339bdff60628f833850889131b594508a3c
4
+ data.tar.gz: 9d72b0f5b8c0dba6e211241ae34a01ea5f22681f
5
+ SHA512:
6
+ metadata.gz: 8cb3ce2f638567670774d42a2f88564c7decbf756899f0667cb63176a9a7304d31b2df14daefbea8431c4a003ab85939fd788cb0303e9e1b42914373f3d15129
7
+ data.tar.gz: 63a92d03d4a925e80e74bd876b01b0197a16c8c0c240c3975f2750227f729818cbd5566baaee2c772df49ca60185c8a2835f3be5c643f38594ccd2393e0ba9f2
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in karolinska.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Karolinska
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/karolinska`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'karolinska'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install karolinska
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sarcilav/karolinska.
36
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "karolinska"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'karolinska/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "karolinska"
8
+ spec.version = Karolinska::VERSION
9
+ spec.authors = ["Sebastian Arcila Valenzuela"]
10
+ spec.email = ["sebastianarcila@gmail.com"]
11
+
12
+ spec.summary = %q{Write a short summary, because Rubygems requires one.}
13
+ spec.description = %q{ Write a longer description or delete this line.}
14
+ spec.homepage = "http://your.mom"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Karolinska
2
+ VERSION = "0.1.0"
3
+ end
data/lib/karolinska.rb ADDED
@@ -0,0 +1,75 @@
1
+ require "karolinska/version"
2
+ require "karolinska/cluster_request"
3
+ require "karolinska/fake"
4
+ require "karolinska/feature_set"
5
+ require "karolinska/feature_sets"
6
+ require "karolinska/single_request"
7
+ require "karolinska/test_set"
8
+ require "karolinska/error"
9
+
10
+ module Karolinska
11
+
12
+ ENDPOINT = 'http://92.111.221.231:85/Fid.aspx'
13
+ PASSWORD = 'Karolinska'
14
+
15
+ class Scan
16
+
17
+ attr_reader :paths, :feature_sets
18
+
19
+ def initialize(*args)
20
+ paths = {front: nil, left:nil, right:nil, up:nil, down:nil}
21
+ @paths = paths.update(args.extract_options!)
22
+ @feature_sets = FeatureSets.new
23
+ end
24
+
25
+ def connect cluster=false
26
+ if cluster
27
+ fire_cluster
28
+ else
29
+ fire_single
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def fire_single
36
+ # the front view is mandatory for karolinska
37
+ raise Karolinska::Error::Base.new("no front view given") if @paths[:front].nil?
38
+ Rails.logger.info "Starting #{@paths.count} request(s) with one image each\n\n"
39
+ @paths.each do |view, path|
40
+ next if path.nil?
41
+ request = SingleRequest.new(path, view)
42
+ Rails.logger.error "Sending view #{view}...\n"
43
+ raw, status = request.start
44
+ featureset = FeatureSet.new(raw, view, status)
45
+ @feature_sets << featureset
46
+ Rails.logger.error "No face was detected in view #{view}...\n\n#{raw}" unless featureset.detected
47
+ end
48
+ Rails.logger.info "#{@feature_sets.count} request(s) done.\n\n"
49
+ @feature_sets
50
+ end
51
+
52
+ def fire_cluster
53
+ # the front view is mandatory for karolinska
54
+ raise Karolinska::Error::Base.new("no front view given") if @paths[:front].nil?
55
+ Rails.logger.info "Starting gaze request with #{@paths.count} images\n\n"
56
+ request = ClusterRequest.new(@paths)
57
+ request.start
58
+ #
59
+ # @paths.each do |view, path|
60
+ # next if path.nil?
61
+ # request = SingleRequest.new(path, view)
62
+ # Rails.logger.error "Sending view #{view}...\n"
63
+ # raw, status = request.start
64
+ # featureset = FeatureSet.new(raw, view, status)
65
+ # @feature_sets << featureset
66
+ # Rails.logger.error "No face was detected in view #{view}...\n\n#{raw}".red unless featureset.detected
67
+ # end
68
+ # Rails.logger.info "Gaze request done. #{@feature_sets.count} FeatureSets created\n\n".red
69
+ # @feature_sets
70
+ end
71
+
72
+
73
+ end
74
+
75
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: karolinska
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Arcila Valenzuela
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: " Write a longer description or delete this line."
56
+ email:
57
+ - sebastianarcila@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - karolinska.gemspec
71
+ - lib/karolinska.rb
72
+ - lib/karolinska/version.rb
73
+ homepage: http://your.mom
74
+ licenses: []
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.5.2
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Write a short summary, because Rubygems requires one.
96
+ test_files: []