y_petri 2.1.33 → 2.1.34

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43e532fceaec5c32c5ee7ca4364a2165f134d94f
4
- data.tar.gz: 2ca12cc72e7f7372d513eaccea15f024a6eda626
3
+ metadata.gz: eaa1e130702b9531a81dd9cc1edc9d9e62b8caf8
4
+ data.tar.gz: b55819cc1a3b556516105ff971b434a97e4cde9a
5
5
  SHA512:
6
- metadata.gz: ab51a968eeb6c30f87d5f12dba00311a32e5bb6042ba0cc8a4d638cdecf352294a32da4dd5737f96f4a3da8220801d858a8cd4b120792f2837124edd9592b549
7
- data.tar.gz: 2f4e63e8c7d3ec1d619b8685886bc66cba4a899b46c4ac69f6ca6929df878110e6015970d3b0cc99e696d2b4f994d5855029cc913ba04b05d6ce05bb992e0665
6
+ metadata.gz: 64d8b917eae58576d9f3b0c359c6f09ba7be768cbb581996f41dd303cae2b074d5cac17c00d2d39c4cf82aa16d112360e862057ffc79fea8744fd88e4b936864
7
+ data.tar.gz: 8d3a8be4cc3728908fa2d44f1e1ba7ace44bc6c80808cad9ed4169c0552dd17caa0b5fcdb8e0c411ae1b0dc37afdd62ea5663b43402a8d0d347693dae7072054
@@ -258,11 +258,15 @@ class YPetri::Net::DataSet < Hash
258
258
  map { |lbl, rec| [ lbl, *rec ].join ',' }.join "\n"
259
259
  end
260
260
 
261
- # Plots the dataset.
261
+ # Plots the dataset. Takes several optional arguments: The list of features
262
+ # to plot as the first ordered argument,
262
263
  #
263
- def plot( time: nil, **nn )
264
+ def plot( feature_ids=nil, time: nil, except: [], **nn )
265
+ time = nn.may_have :time, syn!: :time_range
264
266
  events = events()
265
- data_ss = series
267
+ ff = feature_ids.nil? ? features : net.state.features( feature_ids )
268
+ ff -= net.state.features( except )
269
+ data_ss = series( ff )
266
270
  x_range = if time.nil? then
267
271
  from = events.first || 0
268
272
  to = events.last && events.last > from ? events.last :
@@ -279,7 +283,7 @@ class YPetri::Net::DataSet < Hash
279
283
  plot.title nn[:title] || "#{net} plot"
280
284
  plot.ylabel nn[:ylabel] || "Values"
281
285
  plot.xlabel nn[:xlabel] || "Time [s]"
282
- features.labels.zip( data_ss ).each do |label, data_array|
286
+ ff.labels.zip( data_ss ).each do |label, data_array|
283
287
  plot.data << Gnuplot::DataSet.new( [ events, data_array ] ) { |ds|
284
288
  ds.with = "linespoints"
285
289
  ds.title = label
@@ -126,6 +126,12 @@ class YPetri::Net::State::Feature::Delta < YPetri::Net::State::Feature
126
126
  ! timed?
127
127
  end
128
128
 
129
+ # Type of this feature.
130
+ #
131
+ def type
132
+ :delta
133
+ end
134
+
129
135
  # A string briefly describing this delta feature.
130
136
  #
131
137
  def to_s
@@ -66,6 +66,12 @@ class YPetri::Net::State::Feature::Firing < YPetri::Net::State::Feature
66
66
  end
67
67
  end
68
68
 
69
+ # Type of this feature.
70
+ #
71
+ def type
72
+ :flux
73
+ end
74
+
69
75
  # A string briefly describing the firing feature.
70
76
  #
71
77
  def to_s
@@ -51,7 +51,7 @@ class YPetri::Net::State::Feature::Flux < YPetri::Net::State::Feature
51
51
  # identifier).
52
52
  #
53
53
  def initialize id
54
- @transition = net.transition( id.is_a?( Flux ) ? id.transition : id )
54
+ @transition = net.transition id.is_a?( Flux ) ? id.transition : id
55
55
  end
56
56
 
57
57
  # Extracts the receiver marking feature from the argument. This can be
@@ -66,6 +66,12 @@ class YPetri::Net::State::Feature::Flux < YPetri::Net::State::Feature
66
66
  end
67
67
  end
68
68
 
69
+ # Type of this feature.
70
+ #
71
+ def type
72
+ :flux
73
+ end
74
+
69
75
  # A string briefly describing the flux feature.
70
76
  #
71
77
  def to_s
@@ -78,6 +78,12 @@ class YPetri::Net::State::Feature::Gradient < YPetri::Net::State::Feature
78
78
  end
79
79
  end
80
80
 
81
+ # Type of this feature.
82
+ #
83
+ def type
84
+ :gradient
85
+ end
86
+
81
87
  # A string briefly describing the gradient feature.
82
88
  #
83
89
  def to_s
@@ -65,6 +65,12 @@ class YPetri::Net::State::Feature::Marking < YPetri::Net::State::Feature
65
65
  end
66
66
  end
67
67
 
68
+ # Type of this feature.
69
+ #
70
+ def type
71
+ :marking
72
+ end
73
+
68
74
  # A string briefly describing the marking feature.
69
75
  #
70
76
  def to_s
@@ -1,4 +1,4 @@
1
1
  module YPetri
2
- VERSION = "2.1.33"
2
+ VERSION = "2.1.34"
3
3
  DEBUG = false
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_petri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.33
4
+ version: 2.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris