trinitycrmod 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/trinitycrmod/graphs.rb +48 -0
- data/lib/trinitycrmod/output_files.rb +3 -0
- data/lib/trinitycrmod/trinity.rb +1 -0
- data/test/test_trinitycrmod.rb +8 -2
- data/trinitycrmod.gemspec +73 -0
- metadata +6 -4
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
gem "coderunner", ">= 0.11.0"
|
5
|
-
gem "text-data-tools", ">= 1.1.
|
5
|
+
gem "text-data-tools", ">= 1.1.3"
|
6
6
|
|
7
7
|
# Add dependencies to develop your gem here.
|
8
8
|
# Include everything needed to run rake, tests, features, etc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class CodeRunner::Trinity
|
2
|
+
module TrinityGraphKits
|
3
|
+
def nt_prof_graphkit(options)
|
4
|
+
raise "Please specify t_index" unless options[:t_index]
|
5
|
+
it = options[:t_index] - 1
|
6
|
+
array = nt_outfile.get_2d_array_float(options[:header], /1.*time/)
|
7
|
+
rho_array = nt_outfile.get_2d_array_float(/2.*radius/, /1.*time/)
|
8
|
+
#p rho_array, array
|
9
|
+
GraphKit.autocreate(x: {data: rho_array[it].to_gslv, title: 'rho', units: ''},
|
10
|
+
y: {data: array[it].to_gslv, title: options[:title]||"", units: options[:units]||""}
|
11
|
+
)
|
12
|
+
end
|
13
|
+
def ion_temp_prof_graphkit(options)
|
14
|
+
return nt_prof_graphkit(options.dup.absorb({header: /i\+ temp/}))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
include TrinityGraphKits
|
19
|
+
|
20
|
+
def graphkit(name, options)
|
21
|
+
[:t].each do |var|
|
22
|
+
#ep 'index', var
|
23
|
+
if options[var].class == Symbol and options[var] == :all
|
24
|
+
options[var] = list(var).values
|
25
|
+
elsif options[var+:_index].class == Symbol and options[var+:_index] == :all
|
26
|
+
#ep 'Symbol'
|
27
|
+
options[var+:_index] = list(var).keys
|
28
|
+
end
|
29
|
+
if options[var].class == Array
|
30
|
+
return options[var].map{|value| graphkit(name, options.dup.absorb({var => value}))}.sum
|
31
|
+
elsif options[var+:_index].class == Array
|
32
|
+
#ep 'Array'
|
33
|
+
return options[var+:_index].map{|value| graphkit(name, options.dup.absorb({var+:_index => value}))}.sum
|
34
|
+
end
|
35
|
+
if options[var].class == Symbol and options[var] == :max
|
36
|
+
options[var] = list(var).values.max
|
37
|
+
elsif options[var+:_index].class == Symbol and options[var+:_index] == :max
|
38
|
+
ep 'Symbol'
|
39
|
+
options[var+:_index] = list(var).keys.max
|
40
|
+
end
|
41
|
+
end
|
42
|
+
if meth = TrinityGraphKits.instance_methods.find{|m| m.to_s == name + '_graphkit'}
|
43
|
+
return send(meth, options)
|
44
|
+
else
|
45
|
+
raise "GraphKit not found: #{name}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -9,6 +9,9 @@ class CodeRunner
|
|
9
9
|
def info_outfile
|
10
10
|
TextDataTools::Named::DataFile.new(@directory + '/' + @run_name + '.info', ':')
|
11
11
|
end
|
12
|
+
def nt_outfile
|
13
|
+
TextDataTools::Column::DataFile.new(@directory + '/' + @run_name + '.nt', true, /\S+/, /(?:\#\s+)?\d:.*?(?=\d:)/)
|
14
|
+
end
|
12
15
|
def time_outfile
|
13
16
|
TextDataTools::Column::DataFile.new(@directory + '/' + @run_name + '.time', true, /\S+/, /\w+/)
|
14
17
|
end
|
data/lib/trinitycrmod/trinity.rb
CHANGED
@@ -16,6 +16,7 @@ class CodeRunner
|
|
16
16
|
# Use the Run::FortranNamelist tools to process the variable database
|
17
17
|
setup_namelists(@code_module_folder)
|
18
18
|
require 'trinitycrmod/output_files'
|
19
|
+
require 'trinitycrmod/graphs'
|
19
20
|
|
20
21
|
################################################
|
21
22
|
# Quantities that are read or determined by CodeRunner
|
data/test/test_trinitycrmod.rb
CHANGED
@@ -27,7 +27,7 @@ end
|
|
27
27
|
class TestTrinitycrmodIFSPPPLAnalysis < Test::Unit::TestCase
|
28
28
|
def setup
|
29
29
|
#@runner = CodeRunner.fetch_runner(Y: 'test/ifspppl_results', C: 'trinity', X: '/dev/null')
|
30
|
-
Dir.chdir('test/ifspppl_results/v'){
|
30
|
+
Dir.chdir('test/ifspppl_results/v'){str = "tar -xzf id_1.tgz";system str}
|
31
31
|
@runner = CodeRunner.fetch_runner(Y: 'test/ifspppl_results', C: 'trinity', X: ENV['HOME'] + '/Code/trinity/trunk/trinity', A: true)
|
32
32
|
#@runner.run_class.make_new_defaults_file("rake_test", "test/ifspppl/test.trin")
|
33
33
|
#FileUtils.mv('rake_test_defaults.rb', @runner.run_class.rcp.user_defaults_location)
|
@@ -37,10 +37,16 @@ class TestTrinitycrmodIFSPPPLAnalysis < Test::Unit::TestCase
|
|
37
37
|
CodeRunner.status(Y: 'test/ifspppl_results')
|
38
38
|
assert_equal(@runner.run_list.size, 1)
|
39
39
|
assert_equal(@runner.run_list[1].fusionQ, 0.075658439797815016)
|
40
|
+
FileUtils.rm('test/ifspppl_results/.CODE_RUNNER_TEMP_RUN_LIST_CACHE')
|
40
41
|
end
|
42
|
+
def test_graphs
|
43
|
+
kit = @runner.run_list[1].graphkit('ion_temp_prof', {t_index: 2})
|
44
|
+
#kit.gnuplot
|
45
|
+
assert_equal(kit.data[0].class, GraphKit::DataKit)
|
46
|
+
assert_equal(kit.data[0].x.data[0], 0.05)
|
47
|
+
end
|
41
48
|
def teardown
|
42
49
|
FileUtils.rm('test/ifspppl_results/.code_runner_script_defaults.rb')
|
43
|
-
FileUtils.rm('test/ifspppl_results/.CODE_RUNNER_TEMP_RUN_LIST_CACHE')
|
44
50
|
FileUtils.rm_r('test/ifspppl_results/v/id_1/')
|
45
51
|
end
|
46
52
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "trinitycrmod"
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Edmund Highcock"]
|
12
|
+
s.date = "2013-06-17"
|
13
|
+
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."
|
14
|
+
s.email = "edmundhighcock@sourceforge.net"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/trinitycrmod.rb",
|
27
|
+
"lib/trinitycrmod/deleted_variables.rb",
|
28
|
+
"lib/trinitycrmod/graphs.rb",
|
29
|
+
"lib/trinitycrmod/namelists.rb",
|
30
|
+
"lib/trinitycrmod/output_files.rb",
|
31
|
+
"lib/trinitycrmod/trinity.rb",
|
32
|
+
"sync_variables/helper.rb",
|
33
|
+
"sync_variables/sync_variables.rb",
|
34
|
+
"test/helper.rb",
|
35
|
+
"test/ifspppl/test.trin",
|
36
|
+
"test/ifspppl_results/v/id_1.tgz",
|
37
|
+
"test/test_trinitycrmod.rb",
|
38
|
+
"trinitycrmod.gemspec"
|
39
|
+
]
|
40
|
+
s.homepage = "http://github.com/edmundhighcock/trinitycrmod"
|
41
|
+
s.licenses = ["GPLv3"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = "1.8.23"
|
44
|
+
s.summary = "CodeRunner module for the Trinity simulation software."
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_runtime_dependency(%q<coderunner>, [">= 0.11.0"])
|
51
|
+
s.add_runtime_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
52
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
+
s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<coderunner>, [">= 0.11.0"])
|
58
|
+
s.add_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
59
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
+
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
62
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<coderunner>, [">= 0.11.0"])
|
66
|
+
s.add_dependency(%q<text-data-tools>, [">= 1.1.3"])
|
67
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
+
s.add_dependency(%q<bundler>, ["> 1.0.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinitycrmod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.1.
|
37
|
+
version: 1.1.3
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.1.
|
45
|
+
version: 1.1.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: shoulda
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- VERSION
|
126
126
|
- lib/trinitycrmod.rb
|
127
127
|
- lib/trinitycrmod/deleted_variables.rb
|
128
|
+
- lib/trinitycrmod/graphs.rb
|
128
129
|
- lib/trinitycrmod/namelists.rb
|
129
130
|
- lib/trinitycrmod/output_files.rb
|
130
131
|
- lib/trinitycrmod/trinity.rb
|
@@ -134,6 +135,7 @@ files:
|
|
134
135
|
- test/ifspppl/test.trin
|
135
136
|
- test/ifspppl_results/v/id_1.tgz
|
136
137
|
- test/test_trinitycrmod.rb
|
138
|
+
- trinitycrmod.gemspec
|
137
139
|
homepage: http://github.com/edmundhighcock/trinitycrmod
|
138
140
|
licenses:
|
139
141
|
- GPLv3
|
@@ -149,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
151
|
version: '0'
|
150
152
|
segments:
|
151
153
|
- 0
|
152
|
-
hash: -
|
154
|
+
hash: -1760812951921536995
|
153
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
156
|
none: false
|
155
157
|
requirements:
|