Class: RubyLens::MorphologyClassifier
- Inherits:
-
Object
- Object
- RubyLens::MorphologyClassifier
- Defined in:
- lib/rubylens/morphology_classifier.rb
Constant Summary collapse
- ELLIPTICAL =
0- LENTICULAR =
1- SPIRAL =
2- BARRED_SPIRAL =
3- IRREGULAR =
4- IRREGULAR_SIZE_LIMIT =
30- ELLIPTICAL_MAX =
0.18- LENTICULAR_MAX =
0.30- BAR_CONCENTRATION =
0.50- SPIRAL_STAGE_WIDTH =
0.10- SPIRAL_KNOB_RANGE =
0.35- DEFAULT_KNOBS =
[0, 240, 3, 105, 380, 0, 0, 0, 0].freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(snapshot = nil, package: nil, phase_seed: nil) ⇒ MorphologyClassifier
constructor
A new instance of MorphologyClassifier.
Constructor Details
#initialize(snapshot = nil, package: nil, phase_seed: nil) ⇒ MorphologyClassifier
Returns a new instance of MorphologyClassifier.
22 23 24 25 26 27 28 |
# File 'lib/rubylens/morphology_classifier.rb', line 22 def initialize(snapshot = nil, package: nil, phase_seed: nil) raise ArgumentError, "provide a snapshot or package, not both" if snapshot && package @snapshot = snapshot @package = package @phase_seed = phase_seed end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/rubylens/morphology_classifier.rb', line 30 def call fallback_phase_seed = package_classification? && valid_phase_seed?(@phase_seed) ? @phase_seed : 0 inputs = package_classification? ? package_classification_inputs : project_classification_inputs return fallback(phase_seed: fallback_phase_seed) unless inputs classify(**inputs) rescue KeyError, TypeError, ArgumentError fallback(phase_seed: fallback_phase_seed) end |