Class: Okmain::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/okmain/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chroma_weight: 0.7, mask_weighted_counts_weight: 0.3, mask_weight: 1.0, mask_saturated_threshold: 0.3) ⇒ Config

Returns a new instance of Config.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/okmain/config.rb', line 8

def initialize(
  chroma_weight: 0.7,
  mask_weighted_counts_weight: 0.3,
  mask_weight: 1.0,
  mask_saturated_threshold: 0.3
)
  raise ArgumentError, "chroma_weight must be between 0 and 1" unless (0.0..1.0).cover?(chroma_weight)
  raise ArgumentError, "mask_weighted_counts_weight must be between 0 and 1" unless (0.0..1.0).cover?(mask_weighted_counts_weight)
  raise ArgumentError, "mask_weight must be between 0 and 1" unless (0.0..1.0).cover?(mask_weight)
  raise ArgumentError, "mask_saturated_threshold must be between 0 and 0.5 (exclusive)" unless mask_saturated_threshold >= 0.0 && mask_saturated_threshold < 0.5

  @chroma_weight = chroma_weight.to_f
  @mask_weighted_counts_weight = mask_weighted_counts_weight.to_f
  @mask_weight = mask_weight.to_f
  @mask_saturated_threshold = mask_saturated_threshold.to_f
end

Instance Attribute Details

#chroma_weightObject (readonly)

Returns the value of attribute chroma_weight.



5
6
7
# File 'lib/okmain/config.rb', line 5

def chroma_weight
  @chroma_weight
end

#mask_saturated_thresholdObject (readonly)

Returns the value of attribute mask_saturated_threshold.



5
6
7
# File 'lib/okmain/config.rb', line 5

def mask_saturated_threshold
  @mask_saturated_threshold
end

#mask_weightObject (readonly)

Returns the value of attribute mask_weight.



5
6
7
# File 'lib/okmain/config.rb', line 5

def mask_weight
  @mask_weight
end

#mask_weighted_counts_weightObject (readonly)

Returns the value of attribute mask_weighted_counts_weight.



5
6
7
# File 'lib/okmain/config.rb', line 5

def mask_weighted_counts_weight
  @mask_weighted_counts_weight
end