class CodeRunner::Dosivox

This is a class for running the luminescence code DosiVox. The idea is you pprepare a pilot file with most of the information in it, but with a few tokens to be replaced on job submission. It also automates the generation of the dosimetry geometry.

Public Instance Methods

driver_script() click to toggle source
# File lib/dosivoxcrmod.rb, line 81
def driver_script
  return <<EOF

  #@ncopies.times.each do |n|
    Dir.chdir('copies/' + n.to_s) do
      IO.popen("#@dosivox_location/build/DosiVox", "r+") do |pipe|
        pipe.puts "#@run_name\nno"
        pipe.close_write
        while line = pipe.gets
          puts line
        end
      end
    end
  end

EOF
end
generate_input_file() click to toggle source
# File lib/dosivoxcrmod.rb, line 54
def generate_input_file
  @ncopies ||= 1
  if @pilot_file and FileTest.exist? @pilot_file
    basetext = File.read(@pilot_file)
    FileUtils.mkdir("copies")
    File.open("driver_script.rb", 'w'){|f| f.puts driver_script}
    @ncopies.times.each do |n|
      text = basetext.dup
      FileUtils.mkdir("copies/#{n}")
      Dir.chdir("copies/#{n}") do
        (rcp.substitutions + [:run_name]).each do |sub|
          eputs Regexp.new(sub.to_s.upcase), sub, send(sub)
          text.gsub!(Regexp.new(sub.to_s.upcase), send(sub).to_s)
        end
        FileUtils.mkdir('data')
        File.open("data/#@run_name", 'w'){|f| f.puts text}
        FileUtils.mkdir('results')
        FileUtils.ln_s("#@dosivox_location/1run.mac", ".")
        FileUtils.ln_s("#@dosivox_location/data/Basic_Materials_List.txt", "data/.")
        FileUtils.ln_s("#@dosivox_location/data/spectra", "data/.")
      end
    end
  else
    raise "Please supply pilot_file, the name of the template pilot file. Please give the path of the file as abolute or relative to the run directory"
  end
end
generate_phantom_runs() click to toggle source
# File lib/dosivoxcrmod.rb, line 102
def generate_phantom_runs
end
get_averages() click to toggle source
# File lib/dosivoxcrmod.rb, line 39
def get_averages
end
graphkit(name, options) click to toggle source
# File lib/dosivoxcrmod.rb, line 105
def graphkit(name, options)
  case name
  when 'empty'
  else
    raise 'Unknown graph'
  end
end
parameter_string() click to toggle source
# File lib/dosivoxcrmod.rb, line 50
def parameter_string
  "driver_script.rb"
end
parameter_transition(run) click to toggle source
# File lib/dosivoxcrmod.rb, line 99
def parameter_transition(run)
end
print_out_line() click to toggle source
process_directory_code_specific() click to toggle source
# File lib/dosivoxcrmod.rb, line 30
def process_directory_code_specific
  if @running
    @status ||= :Incomplete
  else
    @status = :Complete
  end
  get_averages if ctd
end