ctioga2 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +11 -0
- data/lib/ctioga2/commands/arguments.rb +1 -1
- data/lib/ctioga2/commands/commands.rb +1 -1
- data/lib/ctioga2/commands/doc/doc.rb +1 -1
- data/lib/ctioga2/commands/doc/documentation-commands.rb +1 -1
- data/lib/ctioga2/commands/doc/help.rb +1 -1
- data/lib/ctioga2/commands/doc/html.rb +1 -1
- data/lib/ctioga2/commands/doc/introspection.rb +1 -1
- data/lib/ctioga2/commands/doc/man.rb +1 -1
- data/lib/ctioga2/commands/doc/markup.rb +1 -1
- data/lib/ctioga2/commands/doc/wordwrap.rb +1 -1
- data/lib/ctioga2/commands/general-commands.rb +1 -1
- data/lib/ctioga2/commands/general-types.rb +1 -1
- data/lib/ctioga2/commands/groups.rb +1 -1
- data/lib/ctioga2/commands/interpreter.rb +8 -2
- data/lib/ctioga2/commands/parsers/command-line.rb +1 -1
- data/lib/ctioga2/commands/parsers/file.rb +4 -1
- data/lib/ctioga2/commands/strings.rb +1 -1
- data/lib/ctioga2/commands/type.rb +1 -1
- data/lib/ctioga2/commands/variables.rb +6 -6
- data/lib/ctioga2/data/backends/backend.rb +1 -1
- data/lib/ctioga2/data/backends/backends.rb +3 -2
- data/lib/ctioga2/data/backends/backends/direct.rb +72 -0
- data/lib/ctioga2/data/backends/backends/gnuplot.rb +1 -1
- data/lib/ctioga2/data/backends/backends/math.rb +1 -1
- data/lib/ctioga2/data/backends/backends/text.rb +8 -14
- data/lib/ctioga2/data/backends/description.rb +9 -5
- data/lib/ctioga2/data/backends/factory.rb +1 -1
- data/lib/ctioga2/data/backends/parameter.rb +1 -1
- data/lib/ctioga2/data/datacolumn.rb +1 -1
- data/lib/ctioga2/data/dataset.rb +50 -4
- data/lib/ctioga2/data/filters.rb +1 -1
- data/lib/ctioga2/data/indexed-dtable.rb +1 -1
- data/lib/ctioga2/data/point.rb +1 -1
- data/lib/ctioga2/data/stack.rb +151 -25
- data/lib/ctioga2/git-fools-svn.rb +7 -0
- data/lib/ctioga2/graphics/coordinates.rb +1 -1
- data/lib/ctioga2/graphics/elements.rb +1 -1
- data/lib/ctioga2/graphics/elements/containers.rb +1 -1
- data/lib/ctioga2/graphics/elements/contour.rb +5 -2
- data/lib/ctioga2/graphics/elements/curve2d.rb +1 -1
- data/lib/ctioga2/graphics/elements/element.rb +1 -1
- data/lib/ctioga2/graphics/elements/gradient-region.rb +1 -1
- data/lib/ctioga2/graphics/elements/parametric2d.rb +1 -2
- data/lib/ctioga2/graphics/elements/primitive.rb +1 -1
- data/lib/ctioga2/graphics/elements/redirecting-container.rb~ +123 -0
- data/lib/ctioga2/graphics/elements/region.rb +1 -1
- data/lib/ctioga2/graphics/elements/subplot.rb +1 -1
- data/lib/ctioga2/graphics/elements/tangent.rb +1 -1
- data/lib/ctioga2/graphics/elements/xyz-map.rb +1 -1
- data/lib/ctioga2/graphics/generator.rb +21 -4
- data/lib/ctioga2/graphics/legends.rb +1 -1
- data/lib/ctioga2/graphics/legends/area.rb +1 -1
- data/lib/ctioga2/graphics/legends/items.rb +1 -1
- data/lib/ctioga2/graphics/legends/provider.rb +1 -1
- data/lib/ctioga2/graphics/legends/storage.rb +1 -1
- data/lib/ctioga2/graphics/root.rb +1 -1
- data/lib/ctioga2/graphics/styles/axes.rb +2 -1
- data/lib/ctioga2/graphics/styles/background.rb +1 -1
- data/lib/ctioga2/graphics/styles/base.rb +1 -1
- data/lib/ctioga2/graphics/styles/carrays.rb +1 -1
- data/lib/ctioga2/graphics/styles/colormap.rb +1 -1
- data/lib/ctioga2/graphics/styles/curve.rb +1 -1
- data/lib/ctioga2/graphics/styles/drawable.rb +1 -1
- data/lib/ctioga2/graphics/styles/errorbar.rb +1 -1
- data/lib/ctioga2/graphics/styles/factory.rb +1 -1
- data/lib/ctioga2/graphics/styles/gradients.rb +1 -1
- data/lib/ctioga2/graphics/styles/legend.rb +1 -1
- data/lib/ctioga2/graphics/styles/location.rb +1 -1
- data/lib/ctioga2/graphics/styles/plot.rb +10 -1
- data/lib/ctioga2/graphics/styles/sets.rb +1 -1
- data/lib/ctioga2/graphics/styles/texts.rb +1 -1
- data/lib/ctioga2/graphics/subplot-commands.rb +1 -1
- data/lib/ctioga2/graphics/types.rb +1 -1
- data/lib/ctioga2/graphics/types/bijection.rb +1 -1
- data/lib/ctioga2/graphics/types/boundaries.rb +1 -1
- data/lib/ctioga2/graphics/types/boxes.rb +1 -1
- data/lib/ctioga2/graphics/types/dimensions.rb +1 -1
- data/lib/ctioga2/graphics/types/grid.rb +1 -1
- data/lib/ctioga2/graphics/types/location.rb +1 -1
- data/lib/ctioga2/graphics/types/point.rb +1 -1
- data/lib/ctioga2/log.rb +4 -1
- data/lib/ctioga2/metabuilder/type.rb +1 -1
- data/lib/ctioga2/metabuilder/types/coordinates.rb +1 -1
- data/lib/ctioga2/metabuilder/types/data.rb +1 -1
- data/lib/ctioga2/metabuilder/types/dates.rb +1 -1
- data/lib/ctioga2/metabuilder/types/generic.rb~ +225 -0
- data/lib/ctioga2/metabuilder/types/lists.rb +1 -1
- data/lib/ctioga2/metabuilder/types/numbers.rb +1 -1
- data/lib/ctioga2/metabuilder/types/strings.rb +1 -1
- data/lib/ctioga2/metabuilder/types/styles.rb +1 -1
- data/lib/ctioga2/plotmaker.rb +12 -7
- data/lib/ctioga2/postprocess.rb +1 -1
- data/lib/ctioga2/utils.rb +27 -3
- metadata +45 -56
data/Changelog
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
ctioga2 (0.3)
|
2
|
+
|
3
|
+
* Implemented a compute-contour command to directly manipulate contours
|
4
|
+
* Scripts now import environment variables (makefile-style)
|
5
|
+
* Added an apply-formula command to modify already loaded datasets
|
6
|
+
* Added a direct backend to input a couple of points directly on
|
7
|
+
command-line
|
8
|
+
* Improved the stack manipulation functions
|
9
|
+
|
10
|
+
-- Vincent Fourmond <vincent.fourmond@9online.fr> Mon Sep 3 21:10:34 CEST 2012
|
11
|
+
|
1
12
|
ctioga2 (0.2)
|
2
13
|
|
3
14
|
* Fix small details in the legend positioning in the 'outside' scheme
|
@@ -20,7 +20,7 @@ require 'ctioga2/commands/doc/doc'
|
|
20
20
|
|
21
21
|
module CTioga2
|
22
22
|
|
23
|
-
Version::register_svn_info('$Revision
|
23
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
24
24
|
|
25
25
|
# This module contains the real core of ctioga2: a set of classes
|
26
26
|
# that implement the concept of commands. Each command translates
|
@@ -180,6 +180,12 @@ module CTioga2
|
|
180
180
|
@doc = Documentation::Doc.new()
|
181
181
|
@variables = Variables.new
|
182
182
|
|
183
|
+
# We import the variables from the environment, just like a in
|
184
|
+
# a Makefile
|
185
|
+
for k, v in ENV
|
186
|
+
@variables.define_variable(k, v)
|
187
|
+
end
|
188
|
+
|
183
189
|
@file_parser = Parsers::FileParser.new
|
184
190
|
end
|
185
191
|
|
@@ -196,10 +202,10 @@ module CTioga2
|
|
196
202
|
# the base name of the given file if no figure name was
|
197
203
|
# specified.
|
198
204
|
def run_command_file(file)
|
199
|
-
@file_parser.run_command_file(file, self)
|
200
205
|
if ! @plotmaker_target.figure_name
|
201
206
|
@plotmaker_target.figure_name = file.gsub(/\.[^.]+$/,'')
|
202
207
|
end
|
208
|
+
@file_parser.run_command_file(file, self)
|
203
209
|
end
|
204
210
|
|
205
211
|
# Parses and runs the given string.
|
@@ -19,7 +19,7 @@ require 'ctioga2/commands/strings'
|
|
19
19
|
|
20
20
|
module CTioga2
|
21
21
|
|
22
|
-
Version::register_svn_info('$Revision
|
22
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
23
23
|
|
24
24
|
module Commands
|
25
25
|
|
@@ -70,6 +70,9 @@ module CTioga2
|
|
70
70
|
def parse_io_object(io, interpreter)
|
71
71
|
# The process is simple: we look for symbols and
|
72
72
|
# corresponding syntax element: parentheses or assignments
|
73
|
+
|
74
|
+
## @todo It would be really great if assignments could be
|
75
|
+
## made conditional (a bit like in makefiles)
|
73
76
|
while(1)
|
74
77
|
symbol = up_to_next_symbol(io)
|
75
78
|
break if not symbol
|
@@ -16,7 +16,7 @@ require 'ctioga2/commands/strings'
|
|
16
16
|
|
17
17
|
module CTioga2
|
18
18
|
|
19
|
-
Version::register_svn_info('$Revision
|
19
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
20
20
|
|
21
21
|
module Commands
|
22
22
|
|
@@ -32,7 +32,6 @@ module CTioga2
|
|
32
32
|
# There are two kind of variables
|
33
33
|
# * immediate, defined by
|
34
34
|
# variable := value
|
35
|
-
# or
|
36
35
|
# These ones are evaluated for once when they are defined.
|
37
36
|
# They are stored in the form of a String
|
38
37
|
# * recursively expanded variables. They are mostly like immediate
|
@@ -57,10 +56,11 @@ module CTioga2
|
|
57
56
|
end
|
58
57
|
|
59
58
|
# Sets a the variable _name_ to _value_ (being an
|
60
|
-
# InterpreterString or a String).
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
59
|
+
# InterpreterString or a String). In the former case
|
60
|
+
# (InterpreterString), if _interpreter_ is given, the value is
|
61
|
+
# expanded at the time of the definition, (immediate variable),
|
62
|
+
# whereas if it stays _nil_, the variable is defined as a
|
63
|
+
# recursively defined variable.
|
64
64
|
def define_variable(name, value, interpreter = nil)
|
65
65
|
if value.respond_to? :expand_to_string
|
66
66
|
if interpreter
|
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
|
19
19
|
require 'ctioga2/data/backends/backend'
|
20
|
+
require 'ctioga2/log'
|
20
21
|
|
21
22
|
# We try to look for all files under a ctioga2/metabuilder/types
|
22
23
|
# directory anywhere on the $: path
|
@@ -33,7 +34,7 @@ for file in files.uniq
|
|
33
34
|
begin
|
34
35
|
require "ctioga2/data/backends/backends/#{file}"
|
35
36
|
rescue Exception => e
|
36
|
-
warn { "There was a problem trying to load 'ctioga2/data/backends/backends/#{file}': " }
|
37
|
-
warn { "#{e.inspect}" }
|
37
|
+
CTioga2::Log::warn { "There was a problem trying to load 'ctioga2/data/backends/backends/#{file}': " }
|
38
|
+
CTioga2::Log::warn { "#{e.inspect}" }
|
38
39
|
end
|
39
40
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# text.rb : A simple backend to deal with basic text files.
|
2
|
+
# Copyright (C) 2006 Vincent Fourmond
|
3
|
+
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
require 'Dobjects/Dvector'
|
21
|
+
require 'Dobjects/Function'
|
22
|
+
|
23
|
+
# For separated sets
|
24
|
+
require 'stringio'
|
25
|
+
|
26
|
+
module CTioga2
|
27
|
+
|
28
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
29
|
+
|
30
|
+
|
31
|
+
module Data
|
32
|
+
|
33
|
+
module Backends
|
34
|
+
|
35
|
+
class DirectBackend < Backend
|
36
|
+
|
37
|
+
include Dobjects
|
38
|
+
|
39
|
+
describe 'direct', 'Direct format', <<EOD
|
40
|
+
A backend where one enters data points directly on the command
|
41
|
+
line or in the command file
|
42
|
+
EOD
|
43
|
+
|
44
|
+
def initialize
|
45
|
+
@separator = /\s+/
|
46
|
+
@line_separator = /[;,]/
|
47
|
+
super()
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
# This is called by the architecture to get the data. It
|
55
|
+
# splits the set name into filename@cols, reads the file if
|
56
|
+
# necessary and calls get_data
|
57
|
+
def query_dataset(set)
|
58
|
+
str = set.gsub(@line_separator, "\n")
|
59
|
+
io = StringIO.new(str)
|
60
|
+
|
61
|
+
cols = Dvector::fancy_read(io, nil)
|
62
|
+
|
63
|
+
return Dataset.new("direct", cols)
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -25,7 +25,7 @@ require 'stringio'
|
|
25
25
|
|
26
26
|
module CTioga2
|
27
27
|
|
28
|
-
Version::register_svn_info('$Revision
|
28
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
29
29
|
|
30
30
|
|
31
31
|
module Data
|
@@ -55,7 +55,7 @@ module CTioga2
|
|
55
55
|
include Dobjects
|
56
56
|
|
57
57
|
describe 'text', 'Text format', <<EOD
|
58
|
-
This backend
|
58
|
+
This backend reads text files in a format close to the one understood
|
59
59
|
by gnuplot and the like.
|
60
60
|
EOD
|
61
61
|
|
@@ -289,6 +289,11 @@ EOD
|
|
289
289
|
# instance in the automatic labels ? (and we could have fun
|
290
290
|
# improving this one ?)
|
291
291
|
#
|
292
|
+
# @todo There should be a way to read pure text columns and
|
293
|
+
# use them somehow, to annotate the output ? This should be
|
294
|
+
# implemented at the Tioga level, though (both for reading, in
|
295
|
+
# fancy_read, and for using hover stuff)
|
296
|
+
#
|
292
297
|
# \warning This needs Tioga r561
|
293
298
|
def read_file(file)
|
294
299
|
if file =~ /(.*)@.*/
|
@@ -361,18 +366,7 @@ EOD
|
|
361
366
|
def get_data_column(column, compute_formulas = false,
|
362
367
|
parameters = nil, header = nil)
|
363
368
|
if compute_formulas
|
364
|
-
formula = column
|
365
|
-
if parameters
|
366
|
-
for k,v in parameters
|
367
|
-
formula.gsub!(/\b#{k}\b/, v.to_s)
|
368
|
-
end
|
369
|
-
end
|
370
|
-
formula.gsub!(/\$(\d+)/, 'column[\1]')
|
371
|
-
if header
|
372
|
-
for k,v in header
|
373
|
-
formula.gsub!("$#{k}$", "column[#{v}]")
|
374
|
-
end
|
375
|
-
end
|
369
|
+
formula = Utils::parse_formula(column, parameters, header)
|
376
370
|
debug { "Using formula #{formula} for column spec: #{column}" }
|
377
371
|
return Dvector.compute_formula(formula,
|
378
372
|
@current_data,
|
@@ -22,7 +22,7 @@ require 'ctioga2/commands/groups'
|
|
22
22
|
|
23
23
|
module CTioga2
|
24
24
|
|
25
|
-
Version::register_svn_info('$Revision
|
25
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
26
26
|
|
27
27
|
|
28
28
|
module Data
|
@@ -179,10 +179,14 @@ module CTioga2
|
|
179
179
|
backend_options, "Selects the '{backend: #{@name}}' backend",
|
180
180
|
nil, group) do |plotmaker, options|
|
181
181
|
plotmaker.data_stack.backend_factory.set_current_backend(@name)
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
182
|
+
if options
|
183
|
+
for k,v in options
|
184
|
+
plotmaker.data_stack.backend_factory.
|
185
|
+
set_backend_parameter_value(@name, k, v)
|
186
|
+
end
|
187
|
+
end # Commands#run_command set options to
|
188
|
+
# nil if the options hash is an empty hash, so we have to
|
189
|
+
# tackle this if it happens
|
186
190
|
end
|
187
191
|
end
|
188
192
|
|