Class: Wrnap::Package::FftPopulation

Inherits:
FftEqBase show all
Defined in:
lib/wrnap/package/fft_population.rb

Defined Under Namespace

Classes: PopulationProportion

Constant Summary collapse

THREE_COLUMN_REGEX =
/^([+-]\d+\.\d+\t){2}[+-]\d+\.\d+$/

Instance Attribute Summary collapse

Attributes inherited from Base

#data, #flags, #response, #runtime

Instance Method Summary collapse

Methods inherited from FftEqBase

#run_command

Methods inherited from Base

bootstrap, #debugger, #initialize, #inspect

Methods included from Global::Yaml

#deserialize, #serialize

Methods included from Global::Chainer

included

Methods included from Global::Runner

included

Constructor Details

This class inherits a constructor from Wrnap::Package::Base

Instance Attribute Details

#starting_populationObject (readonly)

Returns the value of attribute starting_population.



6
7
8
# File 'lib/wrnap/package/fft_population.rb', line 6

def starting_population
  @starting_population
end

#target_populationObject (readonly)

Returns the value of attribute target_population.



6
7
8
# File 'lib/wrnap/package/fft_population.rb', line 6

def target_population
  @target_population
end

Instance Method Details

#post_processObject



38
39
40
41
42
43
44
# File 'lib/wrnap/package/fft_population.rb', line 38

def post_process
  unless response.empty?
    time_points, target_population, starting_population = response.split(/\n/).select { |line| line =~ THREE_COLUMN_REGEX }.map { |line| line.split(/\t/).map(&:to_f) }.transpose
    @starting_population = PopulationProportion.new(time_points, starting_population)
    @target_population   = PopulationProportion.new(time_points, target_population)
  end
end