panomosity 0.1.38 → 0.1.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37bc8e2ba5e484863ff4212456fe563e2d35d7a9d50b0d5cb7409944b6e8fa6f
4
- data.tar.gz: d82c77524660f0f96374d75e4f20ba0b8f0728893f7af9012d150018117e4817
3
+ metadata.gz: d0babb2f2886451531b10cafb8fb2b8ccce33edd260247d1a100001120c3af57
4
+ data.tar.gz: 93c56a79260969f6a77c87d019bbd5efb11c6bcd908fd6ea05f5ad13334c2b3a
5
5
  SHA512:
6
- metadata.gz: ea16e7037cf97463690f8d55f9e8de303ef10694a1953aa076e1de387c34d81c7d2e3cdf42ff70f5ec8dae9260cf0e6e5435087710476e476042b6e9722d256d
7
- data.tar.gz: 6d5dbc29a3cc8523f1cd81ea3003528a8d279e5ca394b659c63c62c6206e65539e70317d1a8a7a55f2964fe11d6de37888662ffce3226da12f2176ce12ae1b0f
6
+ metadata.gz: 2f373113dd8fbb7e70045e94cd20d97342f1d955f64b221208288246f8fbcc486e05785e518769d51b73096029b8570861929a9eb10fd1ed0081c448d9111895
7
+ data.tar.gz: e82ff01175bbf2010e102fceae0acc512517ac51037b2e70a1b893ecd6325c0afc251e4a3525fe003528a557b5849590c56229b3c51edab896eb4a79b71bc4d0
@@ -11,6 +11,7 @@ require 'panomosity/panorama'
11
11
  require 'panomosity/panorama_variable'
12
12
  require 'panomosity/runner'
13
13
  require 'panomosity/utils'
14
+ require 'panomosity/errors'
14
15
  require 'panomosity/version'
15
16
  require 'pathname'
16
17
  require 'fileutils'
@@ -0,0 +1,3 @@
1
+ module Panomosity
2
+ class NoSimilarNeighborhoodsError < StandardError; end
3
+ end
@@ -88,6 +88,17 @@ module Panomosity
88
88
  type == :horizontal ? @horizontal_similar_neighborhoods : @vertical_similar_neighborhoods
89
89
  end
90
90
 
91
+ def similar_neighborhoods!(type: :horizontal)
92
+ neighborhoods = similar_neighborhoods(type: type)
93
+
94
+ if neighborhoods.nil? || neighborhoods.empty?
95
+ error = "No similar #{type} neighborhoods found"
96
+ raise NoSimilarNeighborhoodsError, error
97
+ else
98
+ neighborhoods
99
+ end
100
+ end
101
+
91
102
  def neighborhoods_by_similar_neighborhood(type: :horizontal)
92
103
  type == :horizontal ? @horizontal_neighborhoods_by_similar_neighborhood : @vertical_neighborhoods_by_similar_neighborhood
93
104
  end
@@ -101,9 +112,14 @@ module Panomosity
101
112
 
102
113
  def std_outlier_reduction(type: :horizontal, max_reduction_attempts: 2, reduction_attempts: 0)
103
114
  return if reduction_attempts >= max_reduction_attempts
115
+
104
116
  logger.debug "twice reducing #{type} neighborhood std outliers"
105
- avg, std = *calculate_average_and_std(values: similar_neighborhoods(type: type).map(&:dist_std))
106
- similar_neighborhoods(type: type).select! { |n| (avg - n.dist_std).abs <= std }
117
+
118
+ neighborhoods = similar_neighborhoods!(type: type)
119
+ std_dist_of_neighborhoods = neighborhoods.map(&:dist_std)
120
+ avg, std = *calculate_average_and_std(values: std_dist_of_neighborhoods)
121
+
122
+ similar_neighborhoods!(type: type).select! { |n| (avg - n.dist_std).abs <= std }
107
123
  std_outlier_reduction(type: type, max_reduction_attempts: max_reduction_attempts, reduction_attempts: reduction_attempts + 1)
108
124
  end
109
125
 
@@ -31,4 +31,4 @@ module Panomosity
31
31
  values
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Panomosity
2
- VERSION = '0.1.38'
2
+ VERSION = '0.1.39'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panomosity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-15 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,7 @@ files:
77
77
  - exe/panomosity
78
78
  - lib/panomosity.rb
79
79
  - lib/panomosity/control_point.rb
80
+ - lib/panomosity/errors.rb
80
81
  - lib/panomosity/generalized_neighborhood.rb
81
82
  - lib/panomosity/image.rb
82
83
  - lib/panomosity/measure.rb
@@ -95,7 +96,7 @@ homepage: https://github.com/elevatesystems/panomosity
95
96
  licenses:
96
97
  - MIT
97
98
  metadata: {}
98
- post_install_message:
99
+ post_install_message:
99
100
  rdoc_options: []
100
101
  require_paths:
101
102
  - lib
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  requirements: []
113
114
  rubygems_version: 3.0.8
114
- signing_key:
115
+ signing_key:
115
116
  specification_version: 4
116
117
  summary: Wrapper for the PTO file parsing needed for PanoTools.
117
118
  test_files: []