radiation 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/iaea-xgamma.json +144 -0
- data/lib/radiation.rb +0 -1
- data/lib/radiation/cli.rb +3 -3
- data/lib/radiation/source.rb +10 -11
- data/lib/radiation/version.rb +1 -1
- data/spec/radiation_spec.rb +2 -2
- metadata +2 -7
- data/data/Eu-152.bib +0 -9
- data/data/Eu-152.csv +0 -15
- data/data/Ra-226.bib +0 -13
- data/data/Ra-226.csv +0 -34
- data/lib/radiation/resource/internal.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5bfb4c9fc90f1e6af82e9453053767b9483ade2
|
4
|
+
data.tar.gz: afb5250753754a77fe44e655c9026c663f7b0b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e95bb41b2be01ff2539dc2ea16310c3a789cf5b5d55ee790da0e13bccf58ff0fece8f1a8ea5e3d1061f8787708bb0341a4d97e8c7710f29eccf4bfe36b11686b
|
7
|
+
data.tar.gz: 215a30b97034057ae3b2f56a97742cf7718f313d8f0de2ea9fb65111abbd8fbda55db9cf5f14475fcef53315d248283c00897d6203952c88e2aa9d2c1f6777e4
|
data/data/iaea-xgamma.json
CHANGED
@@ -2482,11 +2482,155 @@
|
|
2482
2482
|
"description": null,
|
2483
2483
|
"absolute_intensities": 1,
|
2484
2484
|
"transitions": [
|
2485
|
+
{
|
2486
|
+
"energy": 53.2275,
|
2487
|
+
"energy_uncertainty": 0.0021,
|
2488
|
+
"intensity": 0.01066,
|
2489
|
+
"intensity_uncertainty": 0.00014
|
2490
|
+
},
|
2485
2491
|
{
|
2486
2492
|
"energy": 186.211,
|
2487
2493
|
"energy_uncertainty": 0.013,
|
2488
2494
|
"intensity": 0.03533,
|
2489
2495
|
"intensity_uncertainty": 0.00028
|
2496
|
+
},
|
2497
|
+
{
|
2498
|
+
"energy": 241.997,
|
2499
|
+
"energy_uncertainty": 0.003,
|
2500
|
+
"intensity": 0.0719,
|
2501
|
+
"intensity_uncertainty": 0.0006
|
2502
|
+
},
|
2503
|
+
{
|
2504
|
+
"energy": 295.224,
|
2505
|
+
"energy_uncertainty": 0.002,
|
2506
|
+
"intensity": 0.1828,
|
2507
|
+
"intensity_uncertainty": 0.0014
|
2508
|
+
},
|
2509
|
+
{
|
2510
|
+
"energy": 351.932,
|
2511
|
+
"energy_uncertainty": 0.002,
|
2512
|
+
"intensity": 0.3534,
|
2513
|
+
"intensity_uncertainty": 0.0027
|
2514
|
+
},
|
2515
|
+
{
|
2516
|
+
"energy": 609.316,
|
2517
|
+
"energy_uncertainty": 0.003,
|
2518
|
+
"intensity": 0.4516,
|
2519
|
+
"intensity_uncertainty": 0.0033
|
2520
|
+
},
|
2521
|
+
{
|
2522
|
+
"energy": 665.453,
|
2523
|
+
"energy_uncertainty": 0.022,
|
2524
|
+
"intensity": 0.01521,
|
2525
|
+
"intensity_uncertainty": 0.00011
|
2526
|
+
},
|
2527
|
+
{
|
2528
|
+
"energy": 768.367,
|
2529
|
+
"energy_uncertainty": 0.011,
|
2530
|
+
"intensity": 0.0485,
|
2531
|
+
"intensity_uncertainty": 0.00038
|
2532
|
+
},
|
2533
|
+
{
|
2534
|
+
"energy": 806.185,
|
2535
|
+
"energy_uncertainty": 0.011,
|
2536
|
+
"intensity": 0.01255,
|
2537
|
+
"intensity_uncertainty": 0.00011
|
2538
|
+
},
|
2539
|
+
{
|
2540
|
+
"energy": 934.061,
|
2541
|
+
"energy_uncertainty": 0.012,
|
2542
|
+
"intensity": 0.03074,
|
2543
|
+
"intensity_uncertainty": 0.00025
|
2544
|
+
},
|
2545
|
+
{
|
2546
|
+
"energy": 1120.287,
|
2547
|
+
"energy_uncertainty": 0.01,
|
2548
|
+
"intensity": 0.1478,
|
2549
|
+
"intensity_uncertainty": 0.0011
|
2550
|
+
},
|
2551
|
+
{
|
2552
|
+
"energy": 1155.19,
|
2553
|
+
"energy_uncertainty": 0.02,
|
2554
|
+
"intensity": 0.01624,
|
2555
|
+
"intensity_uncertainty": 0.00014
|
2556
|
+
},
|
2557
|
+
{
|
2558
|
+
"energy": 1238.11,
|
2559
|
+
"energy_uncertainty": 0.012,
|
2560
|
+
"intensity": 0.05785,
|
2561
|
+
"intensity_uncertainty": 0.00045
|
2562
|
+
},
|
2563
|
+
{
|
2564
|
+
"energy": 1280.96,
|
2565
|
+
"energy_uncertainty": 0.02,
|
2566
|
+
"intensity": 0.01425,
|
2567
|
+
"intensity_uncertainty": 0.00012
|
2568
|
+
},
|
2569
|
+
{
|
2570
|
+
"energy": 1377.669,
|
2571
|
+
"energy_uncertainty": 0.012,
|
2572
|
+
"intensity": 0.03954,
|
2573
|
+
"intensity_uncertainty": 0.00033
|
2574
|
+
},
|
2575
|
+
{
|
2576
|
+
"energy": 1401.516,
|
2577
|
+
"energy_uncertainty": 0.014,
|
2578
|
+
"intensity": 0.01324,
|
2579
|
+
"intensity_uncertainty": 0.00011
|
2580
|
+
},
|
2581
|
+
{
|
2582
|
+
"energy": 1407.993,
|
2583
|
+
"energy_uncertainty": 0.007,
|
2584
|
+
"intensity": 0.02369,
|
2585
|
+
"intensity_uncertainty": 0.00019
|
2586
|
+
},
|
2587
|
+
{
|
2588
|
+
"energy": 1509.217,
|
2589
|
+
"energy_uncertainty": 0.008,
|
2590
|
+
"intensity": 0.02108,
|
2591
|
+
"intensity_uncertainty": 0.00021
|
2592
|
+
},
|
2593
|
+
{
|
2594
|
+
"energy": 1661.316,
|
2595
|
+
"energy_uncertainty": 0.013,
|
2596
|
+
"intensity": 0.01037,
|
2597
|
+
"intensity_uncertainty": 0.0001
|
2598
|
+
},
|
2599
|
+
{
|
2600
|
+
"energy": 1729.64,
|
2601
|
+
"energy_uncertainty": 0.012,
|
2602
|
+
"intensity": 0.02817,
|
2603
|
+
"intensity_uncertainty": 0.00023
|
2604
|
+
},
|
2605
|
+
{
|
2606
|
+
"energy": 1764.539,
|
2607
|
+
"energy_uncertainty": 0.015,
|
2608
|
+
"intensity": 0.1517,
|
2609
|
+
"intensity_uncertainty": 0.0012
|
2610
|
+
},
|
2611
|
+
{
|
2612
|
+
"energy": 1847.42,
|
2613
|
+
"energy_uncertainty": 0.025,
|
2614
|
+
"intensity": 0.02,
|
2615
|
+
"intensity_uncertainty": 0.00018
|
2616
|
+
},
|
2617
|
+
{
|
2618
|
+
"energy": 2118.536,
|
2619
|
+
"energy_uncertainty": 0.008,
|
2620
|
+
"intensity": 0.01148,
|
2621
|
+
"intensity_uncertainty": 0.00011
|
2622
|
+
},
|
2623
|
+
{
|
2624
|
+
"energy": 2204.071,
|
2625
|
+
"energy_uncertainty": 0.021,
|
2626
|
+
"intensity": 0.0489,
|
2627
|
+
"intensity_uncertainty": 0.001
|
2628
|
+
},
|
2629
|
+
{
|
2630
|
+
"energy": 2447.673,
|
2631
|
+
"energy_uncertainty": 0.01,
|
2632
|
+
"intensity": 0.01536,
|
2633
|
+
"intensity_uncertainty": 0.00015
|
2490
2634
|
}
|
2491
2635
|
]
|
2492
2636
|
},
|
data/lib/radiation.rb
CHANGED
data/lib/radiation/cli.rb
CHANGED
@@ -14,7 +14,7 @@ class CLI < Thor
|
|
14
14
|
option :resource
|
15
15
|
desc "source NUCLIDE", "decay radiation data"
|
16
16
|
def source(nuclide)
|
17
|
-
resource = options[:resource] ? options[:resource] : "
|
17
|
+
resource = options[:resource] ? options[:resource] : "iaea"
|
18
18
|
puts ["E_ɣ", "ΔE_ɣ", "I_ɣ", "ΔI_ɣ"].join("\t")
|
19
19
|
puts Radiation::Source.new(nuclide: nuclide, resource: resource).intensities.collect{|l| [l[:energy].value, l[:energy].delta, l[:intensity].value, l[:intensity].delta].join("\t") }
|
20
20
|
end
|
@@ -33,7 +33,7 @@ class CLI < Thor
|
|
33
33
|
With --resource=nucleide.org more decay radiation sources are available.
|
34
34
|
LONGDESC
|
35
35
|
def calibrate(nuclide, file)
|
36
|
-
resource = options[:resource] ? options[:resource] : "
|
36
|
+
resource = options[:resource] ? options[:resource] : "iaea"
|
37
37
|
source = Radiation::Source.new(nuclide: nuclide, resource: resource)
|
38
38
|
spectrum = Radiation::Spectrum.new(source: source ).parse_hdtv(file)
|
39
39
|
spectrum.calibrate.calibration.each{|c| puts c}
|
@@ -50,7 +50,7 @@ class CLI < Thor
|
|
50
50
|
With --mini=value transitions with small intensities can be supressed (default 0.3)
|
51
51
|
LONGDESC
|
52
52
|
def efficiency(nuclide, file)
|
53
|
-
resource = options[:resource] ? options[:resource] : "
|
53
|
+
resource = options[:resource] ? options[:resource] : "iaea"
|
54
54
|
mini = options[:mini] ? options[:mini].to_f : 0.003
|
55
55
|
source = Radiation::Source.new(nuclide: nuclide, resource: resource)
|
56
56
|
spectrum = Radiation::Spectrum.new(source: source ).parse_hdtv(file)
|
data/lib/radiation/source.rb
CHANGED
@@ -2,19 +2,18 @@
|
|
2
2
|
module Radiation
|
3
3
|
class Source
|
4
4
|
attr_reader :resource, :nuclide, :halflife, :reference, :description, :transitions
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(options={})
|
7
|
-
@resource = options.key?(:resource) ? options[:resource].to_s : "
|
7
|
+
@resource = options.key?(:resource) ? options[:resource].to_s : "iaea"
|
8
8
|
@nuclide = options[:nuclide].to_s if options.key?(:nuclide)
|
9
9
|
fetch if @resource and @nuclide
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def fetch(options={})
|
13
13
|
@resource = options[:resource].to_s if options.key?(:resource)
|
14
14
|
@nuclide = options[:nuclide].to_s if options.key?(:nuclide)
|
15
15
|
raise "Nuclide: #{@nuclide} is not valid." unless is_nuclide?(@nuclide)
|
16
16
|
data = case @resource
|
17
|
-
when "internal" then Radiation::Resource::Internal.new.fetch(@nuclide).data
|
18
17
|
when "iaea" then Radiation::Resource::IAEA.new.fetch(@nuclide).data
|
19
18
|
when "nucleide.org" then Radiation::Resource::Nucleideorg.new.fetch(@nuclide).data
|
20
19
|
else raise "Unknown Datasource"
|
@@ -24,33 +23,33 @@ module Radiation
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def resources
|
27
|
-
["
|
26
|
+
["iaea", "nucleide.org"]
|
28
27
|
end
|
29
|
-
|
28
|
+
|
30
29
|
def read(options={})
|
31
30
|
@resource = "external"
|
32
31
|
build(options)
|
33
32
|
return self
|
34
33
|
end
|
35
|
-
|
34
|
+
|
36
35
|
def energies
|
37
36
|
self.transitions.collect{|line| line[:energy]}
|
38
37
|
end
|
39
|
-
|
38
|
+
|
40
39
|
def intensities
|
41
40
|
self.transitions.select{|line| line[:intensity] > 0}.collect{|line| {:energy => line[:energy], :intensity => line[:intensity]} }
|
42
41
|
end
|
43
|
-
|
42
|
+
|
44
43
|
def is_nuclide?(nuclide)
|
45
44
|
!!(nuclide =~ /\A[a-zA-Z]{1,2}-\d{1,3}\z/)
|
46
45
|
end
|
47
|
-
|
46
|
+
|
48
47
|
private
|
49
48
|
def build(data)
|
50
49
|
[:nuclide, :halflife, :reference, :description, :transitions].each do |key|
|
51
50
|
instance_variable_set("@#{key}", data[key]) if data.key?(key)
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
53
|
+
|
55
54
|
end
|
56
55
|
end
|
data/lib/radiation/version.rb
CHANGED
data/spec/radiation_spec.rb
CHANGED
@@ -57,11 +57,11 @@ describe Radiation do
|
|
57
57
|
source = Radiation::Source.new(nuclide: "Ra-226")
|
58
58
|
|
59
59
|
it "can guess a inital energy calibration based on adc values" do
|
60
|
-
Radiation::Spectrum.new(peaks: peaks, source: source).guess_calibration.calibration.should be == [0, 0.
|
60
|
+
Radiation::Spectrum.new(peaks: peaks, source: source).guess_calibration.calibration.should be == [0, 0.3595]
|
61
61
|
end
|
62
62
|
|
63
63
|
it "can match channels to given energies by using a calibration" do
|
64
|
-
Radiation::Spectrum.new(peaks: peaks, source: source ).guess_calibration.match_channels.peaks[0][:energy].should
|
64
|
+
Radiation::Spectrum.new(peaks: peaks, source: source ).guess_calibration.match_channels.peaks[0][:energy].should be_within(0.1).of(186.2)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "can calibrate a spectrum" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plusminus
|
@@ -153,16 +153,11 @@ files:
|
|
153
153
|
- README.md
|
154
154
|
- Rakefile
|
155
155
|
- bin/radiation
|
156
|
-
- data/Eu-152.bib
|
157
|
-
- data/Eu-152.csv
|
158
|
-
- data/Ra-226.bib
|
159
|
-
- data/Ra-226.csv
|
160
156
|
- data/iaea-xgamma.json
|
161
157
|
- lib/radiation.rb
|
162
158
|
- lib/radiation/cli.rb
|
163
159
|
- lib/radiation/resource.rb
|
164
160
|
- lib/radiation/resource/iaea.rb
|
165
|
-
- lib/radiation/resource/internal.rb
|
166
161
|
- lib/radiation/resource/nucleideorg.rb
|
167
162
|
- lib/radiation/source.rb
|
168
163
|
- lib/radiation/spectrum.rb
|
data/data/Eu-152.bib
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
@book{IAEATECDOC619,
|
2
|
-
title = "X-ray and gamma-ray standards for detector calibration",
|
3
|
-
journal = "IAEA TECDOC",
|
4
|
-
volume = "619",
|
5
|
-
year = "1991",
|
6
|
-
issn = "1011-4289"
|
7
|
-
url = "http://www-pub.iaea.org/books/iaeabooks/875/X-ray-and-Gamma-ray-Standards-for-Detector-Calibration",
|
8
|
-
author = "A. Lorenz and H.D. Leram"
|
9
|
-
}
|
data/data/Eu-152.csv
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
121.8;0.2837;0.0013
|
2
|
-
123.1;0.412;0.005
|
3
|
-
244.7;0.0753;0.0004
|
4
|
-
344.3;0.2657;0.0011
|
5
|
-
411.1;0.02238;0.0001
|
6
|
-
444.0;0.03125;0.00014
|
7
|
-
778.9;0.1297;0.0006
|
8
|
-
867.4;0.04214;0.00025
|
9
|
-
964.0;0.1463;0.0006
|
10
|
-
1085.9;0.1013;0.0005
|
11
|
-
1089.7;0.01731;0.00009
|
12
|
-
1112.1;0.1354;0.0006
|
13
|
-
1212.9;0.01412;0.00008
|
14
|
-
1299.1;0.01626;0.00011
|
15
|
-
1408.0;0.2085;0.0009
|
data/data/Ra-226.bib
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
@article{Delgado2002137,
|
2
|
-
title = "Measurements of photon emission probabilities from the decay of 226Ra and daughters ",
|
3
|
-
journal = "Applied Radiation and Isotopes ",
|
4
|
-
volume = "56",
|
5
|
-
number = "1–2",
|
6
|
-
pages = "137 - 143",
|
7
|
-
year = "2002",
|
8
|
-
note = "<ce:title>Proceedings of the Conference on Radionuclide Metrology and its A pplications, ICRM'01</ce:title> ",
|
9
|
-
issn = "0969-8043",
|
10
|
-
doi = "10.1016/S0969-8043(01)00179-8",
|
11
|
-
url = "http://www.sciencedirect.com/science/article/pii/S0969804301001798",
|
12
|
-
author = "José U Delgado and Jean Morel and Michel Etcheverry"
|
13
|
-
}
|
data/data/Ra-226.csv
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
186.2;3.502;0.8
|
2
|
-
242.0;7.13;0.7
|
3
|
-
258.8;0.525;1.0
|
4
|
-
274.2;0.472;1.2
|
5
|
-
295.2;18.09;0.7
|
6
|
-
351.9;35.04;0.7
|
7
|
-
388.0;0.690;1.5
|
8
|
-
455.0;0.287;2.0
|
9
|
-
480.5;0.336;1.4
|
10
|
-
487.1;0.431;1.4
|
11
|
-
580.3;0.369;1.5
|
12
|
-
609.3;44.83;0.7
|
13
|
-
665.4;1.506;0.8
|
14
|
-
768.4;4.78;0.8
|
15
|
-
785.8;1.097;1.1
|
16
|
-
806.2;1.250;1.0
|
17
|
-
934.1;3.041;0.8
|
18
|
-
1120.3;14.66;0.7
|
19
|
-
1155.2;1.611;1.2
|
20
|
-
1238.1;5.75;0.8
|
21
|
-
1281.0;1.411;1.1
|
22
|
-
1377.7;3.895;0.8
|
23
|
-
1385.3;0.782;1.2
|
24
|
-
1401.5;1.311;0.9
|
25
|
-
1408.0;2.346;0.8
|
26
|
-
1509.2;2.065;1.5
|
27
|
-
1661.3;1.063;1.6
|
28
|
-
1729.6;2.791;0.8
|
29
|
-
1764.5;15.03;0.7
|
30
|
-
1847.4;1.994;1.0
|
31
|
-
2118.5;1.137;1.0
|
32
|
-
2204.1;4.82;0.8
|
33
|
-
2293.36;0.298;2.6
|
34
|
-
2447.7;1.525;0.9
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'csv'
|
3
|
-
|
4
|
-
module Radiation::Resource
|
5
|
-
class Internal < Base
|
6
|
-
# FIXME: Better path creation
|
7
|
-
PATH = File.join(File.dirname(__FILE__), "../../../data")
|
8
|
-
|
9
|
-
def fetch(nuclide)
|
10
|
-
@nuclide = nuclide
|
11
|
-
begin
|
12
|
-
@data[:nuclide] = @nuclide.to_s
|
13
|
-
@data[:transitions] = load_data(@nuclide).collect{|row| {:energy => row[0].pm(0), :intensity => row[1].pm(row[2])} }
|
14
|
-
rescue
|
15
|
-
raise "No Data for #{nuclide}"
|
16
|
-
end
|
17
|
-
self
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def load_data(nuclide)
|
22
|
-
CSV.read("#{PATH}/#{nuclide}.csv", {col_sep: ';', converters: :numeric})
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|