ctioga2 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -17,7 +17,7 @@ require 'ctioga2/log'
|
|
|
17
17
|
# This module contains all the classes used by ctioga
|
|
18
18
|
module CTioga2
|
|
19
19
|
|
|
20
|
-
Version::register_svn_info('$Revision
|
|
20
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
21
21
|
|
|
22
22
|
module Graphics
|
|
23
23
|
|
|
@@ -19,7 +19,7 @@ require 'ctioga2/graphics/coordinates'
|
|
|
19
19
|
# This module contains all the classes used by ctioga
|
|
20
20
|
module CTioga2
|
|
21
21
|
|
|
22
|
-
Version::register_svn_info('$Revision
|
|
22
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
23
23
|
|
|
24
24
|
module Graphics
|
|
25
25
|
|
|
@@ -55,6 +55,8 @@ module CTioga2
|
|
|
55
55
|
attr_accessor :plot_margin
|
|
56
56
|
|
|
57
57
|
# Coordinate tranforms
|
|
58
|
+
#
|
|
59
|
+
# @todo they should be axis-specific.
|
|
58
60
|
attr_accessor :transforms
|
|
59
61
|
|
|
60
62
|
# Style of the background of the plot
|
|
@@ -101,6 +103,13 @@ module CTioga2
|
|
|
101
103
|
@padding = Types::Dimension.new(:bp, 4)
|
|
102
104
|
end
|
|
103
105
|
|
|
106
|
+
# Apply (destructively) the current transformations to the
|
|
107
|
+
# given dataset
|
|
108
|
+
def apply_transforms!(dataset)
|
|
109
|
+
@transforms.transform_2d!(dataset)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
104
113
|
# Whether to use log scale for the given axis.
|
|
105
114
|
#
|
|
106
115
|
# Now the question is: how should that affect user-defined
|
|
@@ -17,7 +17,7 @@ require 'ctioga2/log'
|
|
|
17
17
|
# This module contains all the classes used by ctioga
|
|
18
18
|
module CTioga2
|
|
19
19
|
|
|
20
|
-
Version::register_svn_info('$Revision
|
|
20
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
21
21
|
|
|
22
22
|
module Graphics
|
|
23
23
|
|
|
@@ -17,7 +17,7 @@ require 'ctioga2/log'
|
|
|
17
17
|
# This module contains all the classes used by ctioga
|
|
18
18
|
module CTioga2
|
|
19
19
|
|
|
20
|
-
Version::register_svn_info('$Revision
|
|
20
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
21
21
|
|
|
22
22
|
module Graphics
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ require 'ctioga2/graphics/types/grid'
|
|
|
25
25
|
# This module contains all the classes used by ctioga
|
|
26
26
|
module CTioga2
|
|
27
27
|
|
|
28
|
-
Version::register_svn_info('$Revision
|
|
28
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
29
29
|
|
|
30
30
|
module Graphics
|
|
31
31
|
|
|
@@ -16,7 +16,7 @@ require 'ctioga2/log'
|
|
|
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
|
# This module contains all graphical elements of CTioga2
|
|
22
22
|
module Graphics
|
|
@@ -16,7 +16,7 @@ require 'ctioga2/log'
|
|
|
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
|
# This module contains all graphical elements of CTioga2
|
|
22
22
|
module Graphics
|
data/lib/ctioga2/log.rb
CHANGED
|
@@ -16,10 +16,13 @@ require 'logger'
|
|
|
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
|
# This module should be included (or extended) by every class that
|
|
22
22
|
# need logging/debugging facilities.
|
|
23
|
+
#
|
|
24
|
+
# @todo The debug information should contain the command being
|
|
25
|
+
# currently executed.
|
|
23
26
|
module Log
|
|
24
27
|
|
|
25
28
|
# Prints a debug message, on channel _channel_. Channel handling
|
|
@@ -20,7 +20,7 @@ require 'ctioga2/utils'
|
|
|
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
|
|
|
26
26
|
# The MetaBuilder module contains a framework to perform
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# lists.rb : Different Types to deal with types where
|
|
2
|
+
# you can choose among several possibilities
|
|
3
|
+
# Copyright (C) 2006, 2009 Vincent Fourmond
|
|
4
|
+
#
|
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
|
+
# along with this program; if not, write to the Free Software
|
|
17
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18
|
+
|
|
19
|
+
require 'ctioga2/utils'
|
|
20
|
+
|
|
21
|
+
module CTioga2
|
|
22
|
+
|
|
23
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
module MetaBuilder
|
|
27
|
+
|
|
28
|
+
# The module Types should be used for all subclasses of
|
|
29
|
+
# Type, to keep the place clean and tidy.
|
|
30
|
+
module Types
|
|
31
|
+
|
|
32
|
+
# A regular expression matching true
|
|
33
|
+
TRUE_RE = /^\s*(true|yes|on)\s*$/i
|
|
34
|
+
|
|
35
|
+
# A regular expression matching false
|
|
36
|
+
FALSE_RE = /^\s*(false|no(ne)?|off)\s*$/i
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# A boolean parameter
|
|
40
|
+
class BooleanParameter < Type
|
|
41
|
+
|
|
42
|
+
type_name :boolean
|
|
43
|
+
|
|
44
|
+
def type_name
|
|
45
|
+
return 'bool'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Yes, this *really* is a boolean !
|
|
49
|
+
def boolean?
|
|
50
|
+
return true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def string_to_type_internal(str)
|
|
54
|
+
if str == true or str =~ TRUE_RE
|
|
55
|
+
return true
|
|
56
|
+
else
|
|
57
|
+
return false
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def type_to_string_internal(val)
|
|
62
|
+
if val
|
|
63
|
+
return "true"
|
|
64
|
+
else
|
|
65
|
+
return "false"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Booleans are a special case for option parser, as they
|
|
70
|
+
# are handled completely differently
|
|
71
|
+
def option_parser_long_option(name, biniou = nil)
|
|
72
|
+
return "--[no-]#{name}"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# A list of symbols. A hash :list must be provided that states
|
|
77
|
+
# the correspondance between the legal symbols that can be
|
|
78
|
+
# accepted by this parameter and their "english" name.
|
|
79
|
+
# This parameter can typically be used to prompt the user
|
|
80
|
+
# for different choices.
|
|
81
|
+
class ListParameter < Type
|
|
82
|
+
|
|
83
|
+
type_name :list
|
|
84
|
+
|
|
85
|
+
def initialize(type)
|
|
86
|
+
super
|
|
87
|
+
raise "type must have a :list key" unless type.has_key?(:list)
|
|
88
|
+
# We make a copy for our own purposes.
|
|
89
|
+
@hash = type[:list].dup
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def type_name
|
|
93
|
+
return 'list'
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def string_to_type_internal(str)
|
|
97
|
+
if @hash.has_key?(str.to_sym)
|
|
98
|
+
return str.to_sym
|
|
99
|
+
else
|
|
100
|
+
raise IncorrectInput, "Invalid input: #{str} should be one of " +
|
|
101
|
+
@hash.keys.map {|s| s.to_s}.join(',')
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def type_to_string_internal(val)
|
|
106
|
+
return val.to_s
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# A choice between different symbols based on regular expressions.
|
|
112
|
+
class REListParameter < Type
|
|
113
|
+
|
|
114
|
+
type_name :re_list
|
|
115
|
+
|
|
116
|
+
def initialize(type)
|
|
117
|
+
super
|
|
118
|
+
raise "type must have a :list key" unless type.has_key?(:list)
|
|
119
|
+
# We make a copy for our own purposes.
|
|
120
|
+
@re_hash = type[:list].dup
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def type_name
|
|
124
|
+
return 'relist'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def string_to_type_internal(str)
|
|
128
|
+
for k,v in @re_hash
|
|
129
|
+
if str =~ /^\s*#{k}\s*$/
|
|
130
|
+
return v
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
raise IncorrectInput, "Invalid input: #{str} should match " +
|
|
134
|
+
@re_hash.keys.map {|s| s.to_s}.join(',')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def type_to_string_internal(val)
|
|
138
|
+
return val.to_s
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# An array of identical elements of type specified by :subtype. Defaults
|
|
143
|
+
# to String
|
|
144
|
+
class ArrayParameter < Type
|
|
145
|
+
type_name :array
|
|
146
|
+
|
|
147
|
+
def initialize(type)
|
|
148
|
+
super
|
|
149
|
+
# We make a copy for our own purposes.
|
|
150
|
+
subtype = type[:subtype] || {:type => :string}
|
|
151
|
+
@subtype = Type.get_type(subtype)
|
|
152
|
+
@separator = /\s*,\s*/
|
|
153
|
+
@separator_out = ','
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def type_name
|
|
157
|
+
return 'array'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def string_to_type_internal(str)
|
|
161
|
+
ary = str.split(@separator)
|
|
162
|
+
return ary.map do |a|
|
|
163
|
+
@subtype.string_to_type(a)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def type_to_string_internal(val)
|
|
168
|
+
return val.map do |a|
|
|
169
|
+
@subtype.type_to_string(a)
|
|
170
|
+
end.join(@separator_out)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# A Type used for sets for Graphics::Styles::CircularArray
|
|
175
|
+
# objects.
|
|
176
|
+
#
|
|
177
|
+
# \todo write a gradient stuff !!!
|
|
178
|
+
class SetParameter < ArrayParameter
|
|
179
|
+
type_name :set
|
|
180
|
+
|
|
181
|
+
def initialize(type)
|
|
182
|
+
super
|
|
183
|
+
@separator = /\s*\|\s*/
|
|
184
|
+
@separator_out = '|'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def type_name
|
|
188
|
+
return 'set'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def string_to_type_internal(str)
|
|
192
|
+
multiply = nil
|
|
193
|
+
if str =~ /(.*)\*\s*(\d+)\s*$/
|
|
194
|
+
multiply = $2.to_i
|
|
195
|
+
str = $1
|
|
196
|
+
end
|
|
197
|
+
if str =~ /^\s*gradient:(.+)--(.+),(\d+)\s*$/
|
|
198
|
+
s,e,nb = $1, $2, $3.to_i
|
|
199
|
+
s,e = @subtype.string_to_type(s),@subtype.string_to_type(e)
|
|
200
|
+
fact = if nb > 1
|
|
201
|
+
1.0/(nb - 1) # The famous off-by one...
|
|
202
|
+
else
|
|
203
|
+
warn { "Incorrect gradient number: #{nb}" }
|
|
204
|
+
1.0
|
|
205
|
+
end
|
|
206
|
+
array = []
|
|
207
|
+
nb.times do |i|
|
|
208
|
+
array << Utils::mix_objects(e,s, i * fact)
|
|
209
|
+
end
|
|
210
|
+
else
|
|
211
|
+
array = super
|
|
212
|
+
end
|
|
213
|
+
if multiply
|
|
214
|
+
# Seems that I've finally managed to understand what zip
|
|
215
|
+
# is useful for !
|
|
216
|
+
array = array.zip(*([array]*(multiply-1))).flatten(1)
|
|
217
|
+
end
|
|
218
|
+
return array
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|