class Radiation::Resource::IAEA

Constants

FILENAME
PATH

FIXME: Better path creation

Public Instance Methods

fetch(nuclide) click to toggle source
# File lib/radiation/resource/iaea.rb, line 10
def fetch(nuclide)
        @nuclide = nuclide
        begin
                @data = load_data.select{|n| n[:nuclide] == nuclide}.first
                # FIXME: Better conversion from x, x_uncertainty to pm
                @data[:transitions].collect!{|t| { :energy => t[:energy].to_f.pm(t[:energy_uncertainty].to_f), :intensity => t[:intensity].to_f.pm(t[:intensity_uncertainty].to_f)} }
        rescue
                raise "No Data for #{@nuclide}"
        end
        self
end
list() click to toggle source
# File lib/radiation/resource/iaea.rb, line 22
def list
        load_data.collect{|n| n[:nuclide]}
end

Private Instance Methods

load_data() click to toggle source
# File lib/radiation/resource/iaea.rb, line 27
def load_data
        JSON.parse( IO.read("#{PATH}/#{FILENAME}"), {:symbolize_names => true} )
end