SimpleOutput 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/simpleoutput.rb +10 -10
  3. data/lib/simpleplot.rb +14 -7
  4. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c43ac995639242acb36652731cccb9b1c5308285
4
- data.tar.gz: c246a5a67964804ed11a752cd78a88bad69d4144
3
+ metadata.gz: 465d6f7a8e2d6052323ad71fd384a8b623e6c932
4
+ data.tar.gz: 8db7514414c0bf09374a197e38c671d18e5773cc
5
5
  SHA512:
6
- metadata.gz: f3175c5785140c1e50f38d4c3b4e67041b93702ebf24af97ef31d2549f4ec1782151b226714c430d48f9d3d6d053146138e91968e1ca12c7f92b3aa813c37e70
7
- data.tar.gz: 80cdbfe19577e94d90ecb9b2ab2ac13c26040932df3cfa72cc51c2b069f2d5a53313966205208bef94276be21ec544af09c9f8191060beabd52a7a6367d545ca
6
+ metadata.gz: 97fffa2db7b4d1b238337b8d8e8bc62de53d8ccee4d1839a88477517e478c970a3cfc9907e9fa303360439d3b74c63c2cdc1b57b140bb6b190b6a3048077ab56
7
+ data.tar.gz: d54fdf640e1c75eeaed646a2cebfaec9c0f552971533183e923fc4aa4af6f143bfc48da4c20bdd606c046f8f04b1b6eec59dff7f3d6c0cfb1f9a80c806bc839a
data/lib/simpleoutput.rb CHANGED
@@ -264,35 +264,35 @@ module SimpleOutput
264
264
  # array [x,y ]
265
265
  #Interface Functions
266
266
  def appendXY( x=[], y=[],name=nil, options={})
267
- @plugins.each {|plugin| plugin.appendXY(x,y,name, options)}
267
+ @plugins.each {|plugin| plugin.appendXY(x.clone,y.clone,name, options)}
268
268
  end
269
269
 
270
270
  def appendXYarray(data=[], name=nil, options={})
271
- @plugins.each {|plugin| plugin.appendXY(data[0],data[1],name, options)}
271
+ @plugins.each {|plugin| plugin.appendXY(data[0].clone,data[1].clone,name, options)}
272
272
  end
273
273
 
274
274
  def setXYarray(data = [], name=nil, options={})
275
- @plugins.each {|plugin| plugin.setXY(data[0],data[1], name, options)}
275
+ @plugins.each {|plugin| plugin.setXY(data[0].clone,data[1].clone, name, options)}
276
276
  end
277
277
 
278
278
  def setXY(x=[], y=[], name=nil, options={})
279
- @plugins.each {|plugin| plugin.setXY(x,y,name, options)}
279
+ @plugins.each {|plugin| plugin.setXY(x.clone,y.clone,name, options)}
280
280
  end
281
281
 
282
282
  def appendPoints(points =[], name=nil, options={})
283
- @plugins.each {|plugin| plugin.appendPoints(points,name, options)}
283
+ @plugins.each {|plugin| plugin.appendPoints(points.clone,name, options)}
284
284
  end
285
285
 
286
286
  def setPoints(points = [], name=nil, options={})
287
- @plugins.each {|plugin| plugin.setPoints(points,name, options)}
287
+ @plugins.each {|plugin| plugin.setPoints(points.clone,name, options)}
288
288
  end
289
289
 
290
290
  def appendHash(hash = {}, name=nil, options={})
291
- @plugins.each {|plugin| plugin.appendHash(hash,name, options)}
291
+ @plugins.each {|plugin| plugin.appendHash(hash.clone,name, options)}
292
292
  end
293
293
 
294
294
  def setHash(hash ={}, name=nil, options={})
295
- @plugins.each {|plugin| plugin.setHash(hash,name, options)}
295
+ @plugins.each {|plugin| plugin.setHash(hash.clone,name, options)}
296
296
  end
297
297
 
298
298
  def setArray(data = [], name=nil, options={})
@@ -305,12 +305,12 @@ module SimpleOutput
305
305
  def appendArray(data = [], name=nil, options={})
306
306
  x = []
307
307
  data.count.times {|i| x << i}
308
- y = data
308
+ y = data.clone
309
309
  self.appendXY(x,y,name,options)
310
310
  end
311
311
 
312
312
  def annotate(annotation, name=nil, options={})
313
- @plugins.each {|plugin| plugin.annotate(annotation, name, options)}
313
+ @plugins.each {|plugin| plugin.annotate(annotation.clone, name, options)}
314
314
  end
315
315
 
316
316
  def save()
data/lib/simpleplot.rb CHANGED
@@ -68,6 +68,7 @@ class SimplePlot < SimpleOutput::SimpleOutputPlugin
68
68
  end
69
69
 
70
70
  def new_data_callback(name)
71
+ name = translate_name(name)
71
72
  @metadata[name] = {'length' => 0, 'xlabel' => 'x', 'ylabel' => 'y', 'xmin' => 0 , 'xmax' => 10, 'ymin' => 0, 'ymax' => 10, 'series_titles' => [], 'histogram' => false, 'bincount' => 10, 'normalized' => false}
72
73
  end
73
74
 
@@ -106,11 +107,12 @@ class SimplePlot < SimpleOutput::SimpleOutputPlugin
106
107
 
107
108
  def save()
108
109
  data = self.getDataAsXY()
109
- Gnuplot.open do |gp|
110
- data.each do |set_name, series|
110
+ data.each do |set_name, series|
111
+ Gnuplot.open do |gp|
111
112
  Gnuplot::Plot.new(gp) do |plot|
112
113
  plot.terminal "png"
113
114
  #plot.size 0.95
115
+
114
116
  plot.output "#{set_name+@name}.png"
115
117
 
116
118
  plot.title set_name
@@ -118,12 +120,14 @@ class SimplePlot < SimpleOutput::SimpleOutputPlugin
118
120
  plot.xlabel @metadata[set_name]['xlabel']
119
121
  plot.ylabel @metadata[set_name]['ylabel']
120
122
  plot.data = []
123
+
121
124
  if @metadata[set_name]['histogram']
122
125
  size = @metadata[set_name]['length']
123
126
  bins = @metadata[set_name]['bincount']
124
127
  max = @metadata[set_name]['ymax']
125
128
  min = @metadata[set_name]['ymin']
126
- width = (max-min).to_f/bins.to_f
129
+
130
+ width = (max.to_f-min.to_f).to_f/bins.to_f
127
131
  #bins = size.to_f/width.to_f
128
132
  plot.yrange '[0:]'
129
133
  plot.xrange "[#{min}:#{max}]"
@@ -137,19 +141,22 @@ class SimplePlot < SimpleOutput::SimpleOutputPlugin
137
141
  plot.yrange "[#{@metadata[set_name]['ymin']}:#{@metadata[set_name]['ymax']}]"
138
142
  end
139
143
  series.each_with_index do |line, index|
144
+
140
145
  if @metadata[set_name]['histogram']
141
- line = line[1]
146
+ data_pts = line[1]
147
+ else
148
+ data_pts = line
142
149
  end
143
- d = Gnuplot::DataSet.new(line)
150
+
151
+ d = Gnuplot::DataSet.new(data_pts)
144
152
  d.title = @metadata[set_name]['series_titles'][index]
145
153
 
146
154
  if @metadata[set_name]['histogram']
147
- d.using = "(#{width}*floor($1/#{width})+#{width}/2.0):(1.0) smooth freq w boxes lc rgb\"blue\""
155
+ d.using = "(#{width.to_f}*floor($1/#{width.to_f})+#{width.to_f}/2.0):(1.0) smooth freq w boxes lc rgb\"blue\""
148
156
  else
149
157
  d.with = "linespoints"
150
158
  d.linewidth = 2
151
159
  end
152
-
153
160
  plot.data << d
154
161
 
155
162
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SimpleOutput
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austen Higgins-Cassidy
@@ -14,40 +14,40 @@ dependencies:
14
14
  name: gnuplot
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.6'
20
- - - ">="
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.6.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '2.6'
30
- - - ">="
30
+ - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.6.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ~>
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.7'
40
- - - ">="
40
+ - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.7.7
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
49
  version: '1.7'
50
- - - ">="
50
+ - - '>='
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.7.7
53
53
  description: A pluging based graphing and report rendering system with multiple simultanous
@@ -73,12 +73,12 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []