Class: SciYAG::Backends::MDBBackend::DataSet
- Inherits:
-
Object
- Object
- SciYAG::Backends::MDBBackend::DataSet
- Includes:
- Dobjects
- Defined in:
- lib/SciYAG/Backends/mdb.rb
Overview
A small class to hold a data set
Instance Attribute Summary collapse
-
#data_set_id ⇒ Object
The DataSetID property.
-
#name ⇒ Object
The name of the dataset.
Instance Method Summary collapse
-
#add_point(x, y, z, set = nil) ⇒ Object
Adds a point to the set.
-
#initialize(name, data_set_id) ⇒ DataSet
constructor
A new instance of DataSet.
-
#new_dvector ⇒ Object
Used internally to create a new dvector.
-
#subsets ⇒ Object
Returns the keys.
-
#x_data(set = nil) ⇒ Object
Returns the x_data for the given set.
-
#y_data(set = nil) ⇒ Object
Returns the y_data for the given set.
-
#z_data(set = nil) ⇒ Object
Returns the z_data for the given set.
Constructor Details
#initialize(name, data_set_id) ⇒ DataSet
Returns a new instance of DataSet.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/SciYAG/Backends/mdb.rb', line 73 def initialize(name, data_set_id) @name = name @data_set_id = data_set_id @subsets = [] @x_data = {} # A hash indexed on the set name @y_data = {} # A hash indexed on the set name @z_data = {} # A hash indexed on the set name end |
Instance Attribute Details
#data_set_id ⇒ Object
The DataSetID property
60 61 62 |
# File 'lib/SciYAG/Backends/mdb.rb', line 60 def data_set_id @data_set_id end |
#name ⇒ Object
The name of the dataset
57 58 59 |
# File 'lib/SciYAG/Backends/mdb.rb', line 57 def name @name end |
Instance Method Details
#add_point(x, y, z, set = nil) ⇒ Object
Adds a point to the set
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/SciYAG/Backends/mdb.rb', line 100 def add_point(x,y,z,set = nil) if not @x_data[set] @subsets << set @x_data[set] = new_dvector @y_data[set] = new_dvector @z_data[set] = new_dvector end @x_data[set] << x @y_data[set] << y @z_data[set] << z end |
#new_dvector ⇒ Object
Used internally to create a new dvector
63 64 65 |
# File 'lib/SciYAG/Backends/mdb.rb', line 63 def new_dvector return Dvector.new(1000).resize(0) end |
#subsets ⇒ Object
Returns the keys
68 69 70 71 |
# File 'lib/SciYAG/Backends/mdb.rb', line 68 def subsets # return @x_data.keys.compact # removes the nil key... return @subsets.compact end |
#x_data(set = nil) ⇒ Object
Returns the x_data for the given set
85 86 87 |
# File 'lib/SciYAG/Backends/mdb.rb', line 85 def x_data(set = nil) return @x_data[set] end |
#y_data(set = nil) ⇒ Object
Returns the y_data for the given set
90 91 92 |
# File 'lib/SciYAG/Backends/mdb.rb', line 90 def y_data(set = nil) return @y_data[set] end |
#z_data(set = nil) ⇒ Object
Returns the z_data for the given set
95 96 97 |
# File 'lib/SciYAG/Backends/mdb.rb', line 95 def z_data(set = nil) return @z_data[set] end |