trinitycrmod 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/trinitycrmod/calib.rb +48 -0
- data/lib/trinitycrmod/graphs.rb +35 -0
- data/lib/trinitycrmod/trinity.rb +1 -0
- data/trinitycrmod.gemspec +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2deca7cf4f421e80bcc0192a8a0aa5a0ba3bf61d
|
4
|
+
data.tar.gz: 9124cb09beb00f542f77a8556331a766412c7e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0802307c2613319d71789cc590eb4012852551a9b73520a24bc34c0ebbc13f8336984d1d4f17bbcf6f84b8ae48e727dc044b9f8fc6e92d40567aeed77667afc
|
7
|
+
data.tar.gz: 8328d59ea46c6011cc99100b705e597d09e22a146336858d4400cad6aa4ca49fa7f32afecd69d56ac24013200545439a97fbdf1a4602c698959497189061075e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.8
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
class Calib
|
3
|
+
def self.analyse_file(filename)
|
4
|
+
str = File.read(filename)
|
5
|
+
str.sub!(/calibra.*\s+/, '')
|
6
|
+
cal = $~[0]
|
7
|
+
strs = str.split(/(?=reduced_qflux)/); strs.shift
|
8
|
+
return strs.map{|s| new_from_string(cal,s)}
|
9
|
+
end
|
10
|
+
def self.new_from_string(cal,str)
|
11
|
+
pp str
|
12
|
+
cal = cal.sub(/cal\w+/,'').split(/\s+/).delete_if{|s| s=~/\A\s*\Z/}.map{|s| s.to_i}
|
13
|
+
hash = str.scan(
|
14
|
+
/((?:(?:reduced|full)_[pq]flux)|[pq]flux factor)([\deE\s.+-]+)/
|
15
|
+
).inject({}){|h,(k,v)|
|
16
|
+
arr = v.split(/\s+/).delete_if{|s| s=~/\A\s*\Z/}.map{|s| s.to_f}
|
17
|
+
h[k.gsub(/ /, '_')]=arr.pieces(arr.size>cal.size*3?2:3); h}
|
18
|
+
pp hash
|
19
|
+
hash[:calibration_jobs] = cal
|
20
|
+
new(hash)
|
21
|
+
end
|
22
|
+
attr_accessor :calibration_jobs
|
23
|
+
def initialize(hash)
|
24
|
+
hash.each{|k,v| instance_variable_set("@".to_sym + k, v)}
|
25
|
+
end
|
26
|
+
def pflux_graphkit(i)
|
27
|
+
#k = (0..0).to_a.map{|i|
|
28
|
+
k = GraphKit.quick_create([@calibration_jobs, raw_pflux_factor(i)], [(0...(@pflux_factor[i].size)).to_a, @pflux_factor[i]])
|
29
|
+
#}.sum
|
30
|
+
k.data.each{|dk| dk.gp.with = 'lp'}
|
31
|
+
k.data[1].title = 'factor'
|
32
|
+
k
|
33
|
+
end
|
34
|
+
def qflux_graphkit(i)
|
35
|
+
#k = (0..0).to_a.map{|i|
|
36
|
+
k = GraphKit.quick_create([@calibration_jobs, raw_qflux_factor(i)], [(0...(@qflux_factor[i].size)).to_a, @qflux_factor[i]])
|
37
|
+
#}.sum
|
38
|
+
k.data.each{|dk| dk.gp.with = 'lp'}
|
39
|
+
k.data[1].title = 'factor'
|
40
|
+
k
|
41
|
+
end
|
42
|
+
def raw_qflux_factor(i)
|
43
|
+
(@full_qflux[i].to_gslv/@reduced_qflux[i].to_gslv).to_a
|
44
|
+
end
|
45
|
+
def raw_pflux_factor(i)
|
46
|
+
(@full_pflux[i].to_gslv/@reduced_pflux[i].to_gslv).to_a
|
47
|
+
end
|
48
|
+
end
|
data/lib/trinitycrmod/graphs.rb
CHANGED
@@ -124,6 +124,28 @@ class CodeRunner::Trinity
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
# Graph of the ion heat calibration factor
|
128
|
+
def ion_hflux_calibration_graphkit(options)
|
129
|
+
calibs = Calib.analyse_file("#@directory/#@run_name.calib")
|
130
|
+
k = calibs.map{|c| c.qflux_graphkit(0)}.sum
|
131
|
+
k.ylabel = 'Qi'
|
132
|
+
k
|
133
|
+
end
|
134
|
+
# Graph of the electron heat calibration factor
|
135
|
+
def eln_hflux_calibration_graphkit(options)
|
136
|
+
calibs = Calib.analyse_file("#@directory/#@run_name.calib")
|
137
|
+
k = calibs.map{|c| c.qflux_graphkit(1)}.sum
|
138
|
+
k.ylabel = 'Qe'
|
139
|
+
k
|
140
|
+
end
|
141
|
+
# Graph of the particle flux calibration factor
|
142
|
+
def pflux_calibration_graphkit(options)
|
143
|
+
calibs = Calib.analyse_file("#@directory/#@run_name.calib")
|
144
|
+
k = calibs.map{|c| c.pflux_graphkit(1)}.sum
|
145
|
+
k.ylabel = 'Gamma'
|
146
|
+
k
|
147
|
+
end
|
148
|
+
|
127
149
|
include TrinityGraphKits
|
128
150
|
|
129
151
|
module TrinityMultiKits
|
@@ -148,6 +170,19 @@ class CodeRunner::Trinity
|
|
148
170
|
kit
|
149
171
|
|
150
172
|
end
|
173
|
+
def calibration_graphkit(options)
|
174
|
+
kit = GraphKit::MultiKit.new(
|
175
|
+
[
|
176
|
+
ion_hflux_calibration_graphkit(options),
|
177
|
+
eln_hflux_calibration_graphkit(options),
|
178
|
+
pflux_calibration_graphkit(options)
|
179
|
+
]
|
180
|
+
)
|
181
|
+
kit.gp.multiplot = "layout 2,2"
|
182
|
+
kit.gp.key = "tmargin"
|
183
|
+
kit
|
184
|
+
end
|
185
|
+
|
151
186
|
end
|
152
187
|
|
153
188
|
include TrinityMultiKits
|
data/lib/trinitycrmod/trinity.rb
CHANGED
data/trinitycrmod.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: trinitycrmod 0.6.
|
5
|
+
# stub: trinitycrmod 0.6.8 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "trinitycrmod"
|
9
|
-
s.version = "0.6.
|
9
|
+
s.version = "0.6.8"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Edmund Highcock"]
|
14
|
-
s.date = "2015-02-
|
14
|
+
s.date = "2015-02-22"
|
15
15
|
s.description = "This module allows Trinity, the Multiscale Gyrokinetic Turbulent Transport solver for Fusion Reactors, to harness the power of CodeRunner, a framework for the automated running and analysis of simulations."
|
16
16
|
s.email = "edmundhighcock@sourceforge.net"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"lib/trinitycrmod.rb",
|
29
29
|
"lib/trinitycrmod/actual_parameter_values.rb",
|
30
|
+
"lib/trinitycrmod/calib.rb",
|
30
31
|
"lib/trinitycrmod/chease.rb",
|
31
32
|
"lib/trinitycrmod/check_parameters.rb",
|
32
33
|
"lib/trinitycrmod/deleted_variables.rb",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinitycrmod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Highcock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderunner
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- VERSION
|
141
141
|
- lib/trinitycrmod.rb
|
142
142
|
- lib/trinitycrmod/actual_parameter_values.rb
|
143
|
+
- lib/trinitycrmod/calib.rb
|
143
144
|
- lib/trinitycrmod/chease.rb
|
144
145
|
- lib/trinitycrmod/check_parameters.rb
|
145
146
|
- lib/trinitycrmod/deleted_variables.rb
|