Class: Wrnap::Package::Population

Inherits:
Base
  • Object
show all
Defined in:
lib/wrnap/package/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 Base

bootstrap, #debugger, #initialize, #inspect, #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

#equilibriumObject (readonly)

Returns the value of attribute equilibrium.



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

def equilibrium
  @equilibrium
end

#str_1_to_str_1Object (readonly)

Returns the value of attribute str_1_to_str_1.



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

def str_1_to_str_1
  @str_1_to_str_1
end

#str_1_to_str_2Object (readonly)

Returns the value of attribute str_1_to_str_2.



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

def str_1_to_str_2
  @str_1_to_str_2
end

Instance Method Details

#post_processObject



84
85
86
87
88
89
90
91
92
# File 'lib/wrnap/package/population.rb', line 84

def post_process
  if flags.include?("-spectral-e")
    @equilibrium = 10 ** response.strip.to_f
  else
    time_points, str_1_to_str_2, str_1_to_str_1 = response.split(/\n/).select { |line| line =~ THREE_COLUMN_REGEX }.map { |line| line.split(/\t/).map(&:to_f) }.transpose
    @str_1_to_str_2 = PopulationProportion.new(time_points, str_1_to_str_2)
    @str_1_to_str_1 = PopulationProportion.new(time_points, str_1_to_str_1)
  end
end

#run_command(flags) ⇒ Object



78
79
80
81
82
# File 'lib/wrnap/package/population.rb', line 78

def run_command(flags)
  Wrnap.debugger { "Running #{exec_name} on #{data.inspect}" }

  "%s %s" % [exec_name, stringify_flags(flags)]
end