ctioga2 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +8 -0
- data/lib/ctioga2/commands/arguments.rb +0 -2
- data/lib/ctioga2/commands/commands.rb +0 -2
- data/lib/ctioga2/commands/context.rb +0 -2
- data/lib/ctioga2/commands/doc/doc.rb +0 -2
- data/lib/ctioga2/commands/doc/documentation-commands.rb +0 -2
- data/lib/ctioga2/commands/doc/help.rb +0 -2
- data/lib/ctioga2/commands/doc/html.rb +0 -2
- data/lib/ctioga2/commands/doc/introspection.rb +0 -2
- data/lib/ctioga2/commands/doc/man.rb +0 -2
- data/lib/ctioga2/commands/doc/markup.rb +0 -2
- data/lib/ctioga2/commands/doc/wordwrap.rb +0 -2
- data/lib/ctioga2/commands/general-commands.rb +0 -2
- data/lib/ctioga2/commands/general-types.rb +0 -2
- data/lib/ctioga2/commands/groups.rb +0 -2
- data/lib/ctioga2/commands/interpreter.rb +0 -2
- data/lib/ctioga2/commands/parsers/command-line.rb +0 -2
- data/lib/ctioga2/commands/parsers/file.rb +0 -2
- data/lib/ctioga2/commands/parsers/old-file.rb +0 -2
- data/lib/ctioga2/commands/strings.rb +0 -2
- data/lib/ctioga2/commands/type.rb +0 -2
- data/lib/ctioga2/commands/variables.rb +0 -2
- data/lib/ctioga2/data/backends/backend.rb +0 -3
- data/lib/ctioga2/data/backends/backends/direct.rb +0 -3
- data/lib/ctioga2/data/backends/backends/gnuplot.rb +0 -3
- data/lib/ctioga2/data/backends/backends/math.rb +0 -2
- data/lib/ctioga2/data/backends/backends/text.rb +0 -3
- data/lib/ctioga2/data/backends/description.rb +0 -3
- data/lib/ctioga2/data/backends/factory.rb +18 -2
- data/lib/ctioga2/data/backends/parameter.rb +0 -2
- data/lib/ctioga2/data/datacolumn.rb +0 -2
- data/lib/ctioga2/data/dataset.rb +5 -3
- data/lib/ctioga2/data/filters.rb +0 -3
- data/lib/ctioga2/data/indexed-dtable.rb +0 -3
- data/lib/ctioga2/data/point.rb +0 -3
- data/lib/ctioga2/data/stack.rb +2 -4
- data/lib/ctioga2/graphics/coordinates.rb +0 -2
- data/lib/ctioga2/graphics/elements.rb +1 -2
- data/lib/ctioga2/graphics/elements/containers.rb +32 -2
- data/lib/ctioga2/graphics/elements/contour.rb +0 -2
- data/lib/ctioga2/graphics/elements/curve2d.rb +0 -2
- data/lib/ctioga2/graphics/elements/element.rb +4 -2
- data/lib/ctioga2/graphics/elements/gradient-region.rb +0 -2
- data/lib/ctioga2/graphics/elements/histogram.rb +298 -0
- data/lib/ctioga2/graphics/elements/parametric2d.rb +7 -3
- data/lib/ctioga2/graphics/elements/primitive.rb +0 -2
- data/lib/ctioga2/graphics/elements/redirecting-container.rb +21 -2
- data/lib/ctioga2/graphics/elements/region.rb +0 -2
- data/lib/ctioga2/graphics/elements/subplot.rb +0 -2
- data/lib/ctioga2/graphics/elements/tangent.rb +0 -2
- data/lib/ctioga2/graphics/elements/xyz-contour.rb +0 -2
- data/lib/ctioga2/graphics/elements/xyz-map.rb +0 -2
- data/lib/ctioga2/graphics/generator.rb +47 -42
- data/lib/ctioga2/graphics/legends.rb +0 -2
- data/lib/ctioga2/graphics/legends/area.rb +0 -2
- data/lib/ctioga2/graphics/legends/items.rb +0 -2
- data/lib/ctioga2/graphics/legends/multicols.rb +0 -2
- data/lib/ctioga2/graphics/legends/provider.rb +0 -2
- data/lib/ctioga2/graphics/legends/storage.rb +0 -2
- data/lib/ctioga2/graphics/root.rb +0 -2
- data/lib/ctioga2/graphics/styles/arrows.rb +0 -2
- data/lib/ctioga2/graphics/styles/axes.rb +0 -2
- data/lib/ctioga2/graphics/styles/background.rb +0 -2
- data/lib/ctioga2/graphics/styles/base.rb +4 -2
- data/lib/ctioga2/graphics/styles/box.rb +0 -2
- data/lib/ctioga2/graphics/styles/carrays.rb +0 -2
- data/lib/ctioga2/graphics/styles/colormap.rb +0 -2
- data/lib/ctioga2/graphics/styles/contour.rb +0 -2
- data/lib/ctioga2/graphics/styles/curve.rb +0 -2
- data/lib/ctioga2/graphics/styles/drawable.rb +0 -2
- data/lib/ctioga2/graphics/styles/errorbar.rb +0 -2
- data/lib/ctioga2/graphics/styles/factory.rb +0 -2
- data/lib/ctioga2/graphics/styles/gradients.rb +0 -2
- data/lib/ctioga2/graphics/styles/legend.rb +0 -2
- data/lib/ctioga2/graphics/styles/location.rb +0 -2
- data/lib/ctioga2/graphics/styles/map-axes.rb +0 -2
- data/lib/ctioga2/graphics/styles/plot-types.rb +51 -3
- data/lib/ctioga2/graphics/styles/plot.rb +0 -2
- data/lib/ctioga2/graphics/styles/sets.rb +0 -2
- data/lib/ctioga2/graphics/styles/sheet.rb +0 -2
- data/lib/ctioga2/graphics/styles/texts.rb +0 -2
- data/lib/ctioga2/graphics/styles/ticks.rb +0 -2
- data/lib/ctioga2/graphics/subplot-commands.rb +0 -2
- data/lib/ctioga2/graphics/types.rb +11 -4
- data/lib/ctioga2/graphics/types/bijection.rb +0 -2
- data/lib/ctioga2/graphics/types/boundaries.rb +0 -2
- data/lib/ctioga2/graphics/types/boxes.rb +0 -2
- data/lib/ctioga2/graphics/types/dimensions.rb +0 -2
- data/lib/ctioga2/graphics/types/fill.rb +27 -15
- data/lib/ctioga2/graphics/types/grid.rb +0 -2
- data/lib/ctioga2/graphics/types/location.rb +0 -2
- data/lib/ctioga2/graphics/types/point.rb +0 -2
- data/lib/ctioga2/log.rb +0 -2
- data/lib/ctioga2/metabuilder/type.rb +0 -2
- data/lib/ctioga2/metabuilder/types/coordinates.rb +0 -2
- data/lib/ctioga2/metabuilder/types/data.rb +0 -2
- data/lib/ctioga2/metabuilder/types/dates.rb +0 -1
- data/lib/ctioga2/metabuilder/types/generic.rb +0 -3
- data/lib/ctioga2/metabuilder/types/lists.rb +25 -3
- data/lib/ctioga2/metabuilder/types/numbers.rb +0 -2
- data/lib/ctioga2/metabuilder/types/strings.rb +0 -3
- data/lib/ctioga2/metabuilder/types/styles.rb +0 -2
- data/lib/ctioga2/plotmaker.rb +2 -4
- data/lib/ctioga2/postprocess.rb +0 -2
- data/lib/ctioga2/utils.rb +6 -64
- data/lib/ctioga2/version.rb +8 -0
- metadata +6 -4
@@ -18,8 +18,6 @@ require 'ctioga2/log'
|
|
18
18
|
# This module contains all the classes used by ctioga
|
19
19
|
module CTioga2
|
20
20
|
|
21
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
22
|
-
|
23
21
|
module Graphics
|
24
22
|
|
25
23
|
module Styles
|
@@ -56,15 +54,21 @@ EOD
|
|
56
54
|
|
57
55
|
def prepare
|
58
56
|
@reversed = {}
|
59
|
-
|
57
|
+
|
60
58
|
2.times do |i|
|
61
59
|
val = self.send("z#{i+1}")
|
62
60
|
if val
|
63
61
|
@reversed[val] = i
|
62
|
+
@needed = i+1
|
64
63
|
end
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
67
|
+
# The number of Z columns needed for the style.
|
68
|
+
def z_columns_needed
|
69
|
+
return @needed || 0
|
70
|
+
end
|
71
|
+
|
68
72
|
# Returns the marker style for the given Z values.
|
69
73
|
#
|
70
74
|
# This will only work if #prepare has been called first !
|
@@ -116,6 +120,50 @@ EOD
|
|
116
120
|
end
|
117
121
|
|
118
122
|
end
|
123
|
+
|
124
|
+
CumulativeHistogramsType =
|
125
|
+
CmdType.new('cumulative-histograms',
|
126
|
+
{
|
127
|
+
:type => :integer,
|
128
|
+
:shortcuts => {
|
129
|
+
/next/i => :next,
|
130
|
+
/no|false/i => false
|
131
|
+
}
|
132
|
+
}, <<EOD)
|
133
|
+
How to specify that histograms should be stacked. Can be:
|
134
|
+
* a positive number, in which case the following histograms
|
135
|
+
will be added to the numbered one (0 is the first)
|
136
|
+
* no/false, in which case the following histograms are not stacked
|
137
|
+
* next, in which case the following histograms get stacked on a new slot
|
138
|
+
EOD
|
139
|
+
|
140
|
+
|
141
|
+
# This class defines various informations about the look of
|
142
|
+
# histograms.
|
143
|
+
class HistogramStyle < BasicStyle
|
144
|
+
|
145
|
+
# Separation between the histograms inside a group of histogram
|
146
|
+
typed_attribute :intra_sep, 'dimension'
|
147
|
+
|
148
|
+
# Separation between the histograms of different groups
|
149
|
+
typed_attribute :gap, 'dimension'
|
150
|
+
|
151
|
+
# Specs for cumulative
|
152
|
+
typed_attribute :cumulative, 'cumulative-histograms'
|
153
|
+
|
154
|
+
def set_from_hash(hash, name = "%s")
|
155
|
+
super
|
156
|
+
|
157
|
+
if @cumulative == :next
|
158
|
+
@last_neg ||= 0
|
159
|
+
@last_neg -= 1
|
160
|
+
@cumulative = @last_neg
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
end
|
119
167
|
end
|
120
168
|
|
121
169
|
end
|
@@ -19,8 +19,6 @@ 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: 521 $', '$Date: 2013-09-21 18:55:05 +0200 (Sat, 21 Sep 2013) $')
|
23
|
-
|
24
22
|
module Graphics
|
25
23
|
|
26
24
|
module Styles
|
@@ -26,8 +26,6 @@ require 'ctioga2/graphics/types/grid'
|
|
26
26
|
# This module contains all the classes used by ctioga
|
27
27
|
module CTioga2
|
28
28
|
|
29
|
-
Version::register_svn_info('$Revision: 523 $', '$Date: 2013-09-22 15:31:16 +0200 (Sun, 22 Sep 2013) $')
|
30
|
-
|
31
29
|
module Graphics
|
32
30
|
|
33
31
|
# A small convenience module for line styles
|
@@ -96,7 +94,9 @@ EOD
|
|
96
94
|
/no(ne)?|off/i => false,
|
97
95
|
}
|
98
96
|
}, <<EOD)
|
99
|
-
A line style,
|
97
|
+
A line style, which is one of @solid@, @dots@, @dashes@, @small_dots@,
|
98
|
+
a series of comma-separated numbers which are the length of the
|
99
|
+
strokes and gaps, or @no@, @none@ or @off@ to mean no line.
|
100
100
|
EOD
|
101
101
|
|
102
102
|
MarkerType =
|
@@ -109,7 +109,14 @@ EOD
|
|
109
109
|
'none' => 'None',
|
110
110
|
'off' => 'None',
|
111
111
|
},}, <<EOD)
|
112
|
-
A Tioga Marker
|
112
|
+
A Tioga Marker, ie either a name from the list at {url:
|
113
|
+
http://tioga.rubyforge.org/doc/Tioga/MarkerConstants.html}, such as
|
114
|
+
@Box@, @Star@, @Spade@ or two or three comma-separated numbers,
|
115
|
+
_font_, _number_ and _width_. _font_ defines the font (standard PDF
|
116
|
+
fonts, from 1 to 14), _number_ the number of the character within the
|
117
|
+
font (between 0 and 255), and if _width_ is specified, the marker is
|
118
|
+
stroked and not filled, and the number is the line width for the
|
119
|
+
stroke.
|
113
120
|
EOD
|
114
121
|
|
115
122
|
PointType =
|
@@ -16,8 +16,6 @@ require 'ctioga2/log'
|
|
16
16
|
|
17
17
|
module CTioga2
|
18
18
|
|
19
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
20
|
-
|
21
19
|
module Graphics
|
22
20
|
|
23
21
|
module Types
|
@@ -66,33 +64,47 @@ module CTioga2
|
|
66
64
|
return @type != :none
|
67
65
|
end
|
68
66
|
|
67
|
+
# Wether we are closing by a vertical line
|
68
|
+
def vertical?
|
69
|
+
return (@type == :x || @type == :left || @type = :right)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Wether we are closing with a horizontal line
|
73
|
+
def horizontal?
|
74
|
+
return (@type == :y || @type == :bottom || @type = :top)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns the effective value of the
|
78
|
+
def effective_value(bounds)
|
79
|
+
case @type
|
80
|
+
when :bottom, :top
|
81
|
+
return bounds.send(@type)
|
82
|
+
when :left, :right
|
83
|
+
return bounds.send(@type)
|
84
|
+
else
|
85
|
+
return @value
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
69
89
|
# Closes the current path according to the current style, based on:
|
70
90
|
# * _bounds_, the boundaries of the plot
|
71
91
|
# * _first_, the first point ([x, y])
|
72
92
|
# * _last_, the last point
|
73
93
|
def close_path(t, bounds, first, last)
|
74
94
|
tp = @type
|
75
|
-
target =
|
95
|
+
target = effective_value(bounds)
|
96
|
+
|
76
97
|
case tp
|
77
98
|
when :none
|
78
99
|
raise "Close the path !"
|
79
|
-
when :
|
80
|
-
target = bounds.send(tp)
|
81
|
-
tp = :y
|
82
|
-
when :left, :right
|
83
|
-
target = bounds.send(tp)
|
84
|
-
tp = :x
|
85
|
-
end
|
86
|
-
|
87
|
-
case tp
|
88
|
-
when :x
|
100
|
+
when :x, :left, :right
|
89
101
|
t.append_point_to_path(target, last[1])
|
90
102
|
t.append_point_to_path(target, first[1])
|
91
|
-
when :y
|
103
|
+
when :y, :bottom, :top
|
92
104
|
t.append_point_to_path(last[0], target)
|
93
105
|
t.append_point_to_path(first[0], target)
|
94
106
|
when :xy
|
95
|
-
t.append_point_to_path(*
|
107
|
+
t.append_point_to_path(* target.to_figure_xy(t))
|
96
108
|
when :close
|
97
109
|
else
|
98
110
|
raise "Should not be here"
|
data/lib/ctioga2/log.rb
CHANGED
@@ -16,8 +16,6 @@ require 'logger'
|
|
16
16
|
|
17
17
|
module CTioga2
|
18
18
|
|
19
|
-
Version::register_svn_info('$Revision: 522 $', '$Date: 2013-09-22 12:02:48 +0200 (Sun, 22 Sep 2013) $')
|
20
|
-
|
21
19
|
# This module should be included (or extended) by every class that
|
22
20
|
# need logging/debugging facilities.
|
23
21
|
#
|
@@ -20,9 +20,6 @@ require 'ctioga2/utils'
|
|
20
20
|
|
21
21
|
module CTioga2
|
22
22
|
|
23
|
-
Version::register_svn_info('$Revision: 484 $', '$Date: 2013-09-02 22:44:42 +0200 (Mon, 02 Sep 2013) $')
|
24
|
-
|
25
|
-
|
26
23
|
module MetaBuilder
|
27
24
|
|
28
25
|
# The module Types should be used for all subclasses of
|
@@ -213,6 +210,31 @@ module CTioga2
|
|
213
210
|
nb.times do |i|
|
214
211
|
array << Utils::mix_objects(e,s, i * fact)
|
215
212
|
end
|
213
|
+
elsif str =~ /(.*)!(\d+)(?:!(.*))?\s*$/
|
214
|
+
# We have a mixing
|
215
|
+
nb = $2.to_i
|
216
|
+
fact = nb*0.01
|
217
|
+
if fact > 1.0 || fact < 0.0
|
218
|
+
error { "Invalid number for mixing: #{nb}, using 50"}
|
219
|
+
fact = 0.5
|
220
|
+
end
|
221
|
+
st1 = $1
|
222
|
+
st2 = $3 || 'White' # default to colors !
|
223
|
+
|
224
|
+
ar1 = string_to_type(st1)
|
225
|
+
ar2 = string_to_type(st2)
|
226
|
+
|
227
|
+
# Make all the sequential combinations until we fall back
|
228
|
+
# on the first one.
|
229
|
+
ts = ar1.size.lcm(ar2.size)
|
230
|
+
ar1 *= ts/ar1.size
|
231
|
+
ar2 *= ts/ar2.size
|
232
|
+
|
233
|
+
arf = []
|
234
|
+
ar1.each_index do |i|
|
235
|
+
arf << Utils::mix_objects(ar1[i], ar2[i], fact)
|
236
|
+
end
|
237
|
+
return arf
|
216
238
|
else
|
217
239
|
array = super
|
218
240
|
end
|