Class: Radiation::CLI
- Inherits:
-
Thor
- Object
- Thor
- Radiation::CLI
- Defined in:
- lib/radiation/cli.rb
Instance Method Summary collapse
- #calibrate(nuclide, file) ⇒ Object
- #efficiency(nuclide, file) ⇒ Object
- #list ⇒ Object
- #resources ⇒ Object
- #source(nuclide) ⇒ Object
- #version ⇒ Object
Instance Method Details
#calibrate(nuclide, file) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/radiation/cli.rb', line 46 def calibrate(nuclide, file) resource = [:resource] ? [:resource] : "iaea" source = Radiation::Source.new(nuclide: nuclide, resource: resource) spectrum = Radiation::Spectrum.new(source: source ).parse_hdtv(file) spectrum.calibrate.calibration.each{|c| puts c} end |
#efficiency(nuclide, file) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/radiation/cli.rb', line 63 def efficiency(nuclide, file) resource = [:resource] ? [:resource] : "iaea" mini = [:mini] ? [:mini].to_f : 0.003 source = Radiation::Source.new(nuclide: nuclide, resource: resource) spectrum = Radiation::Spectrum.new(source: source ).parse_hdtv(file) puts ["#E_ɣ", "ΔE_ɣ", "I_ɣ", "ΔI_ɣ", "e", "Δe"].join("\t") spectrum.calibrate.efficiencies.peaks.select{|p| p[:intensity] > mini}.sort_by{|k| k[:energy]}.each do |p| puts [ p[:energy].nio_write, p[:energy].delta, p[:intensity].nio_write, p[:intensity].delta, p[:efficiency].nio_write, "%.0E" % p[:efficiency].delta ].join("\t") end end |
#list ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/radiation/cli.rb', line 24 def list resource = [:resource] ? [:resource] : "iaea" puts case resource when "iaea" then Radiation::Resource::IAEA.new.list when "nucleide.org" then Radiation::Resource::Nucleideorg.new.list else raise "Unknown Datasource" end end |
#resources ⇒ Object
34 35 36 |
# File 'lib/radiation/cli.rb', line 34 def resources puts Radiation::Source.new.resources end |
#source(nuclide) ⇒ Object
16 17 18 19 20 |
# File 'lib/radiation/cli.rb', line 16 def source(nuclide) resource = [:resource] ? [:resource] : "iaea" puts ["#E_ɣ", "ΔE_ɣ", "I_ɣ", "ΔI_ɣ"].join("\t") puts Radiation::Source.new(nuclide: nuclide, resource: resource).intensities.collect{|l| [l[:energy].nio_write, l[:energy].delta, l[:intensity].nio_write, "%.0E" % l[:intensity].delta].join("\t") } end |