Closed ramav87 closed 3 years ago
Need to raise an error when user attempts to set a dimension that is higher than what is actually present. Should write a unit test as well for this.
data_mat = np.random.uniform(size=(10,10,32))
x_dim = np.linspace(0, 1E-6, data_mat.shape[0]) y_dim = np.linspace(0, 1E-6, data_mat.shape[1]) z_dim = xvec
data_set = sid.Dataset.from_array(data_mat, name='Current_spectral_map')
data_set.data_type = sid.DataType.SPECTRAL_IMAGE
data_set.set_dimension(0, sid.Dimension(x_dim, name='x', units='m', quantity='x', dimension_type='spatial')) data_set.set_dimension(1, sid.Dimension(y_dim, name='y', units='m', quantity='y', dimension_type='spatial')) data_set.set_dimension(2, sid.Dimension(z_dim, name='Voltage', units='V', quantity='Voltage', dimension_type='spectral'))
data_set.set_dimension(3, sid.Dimension(z_dim, name='Voltage2', units='V', quantity='Voltage', dimension_type='spectral'))
Pull request #132 takes care of this
Need to raise an error when user attempts to set a dimension that is higher than what is actually present. Should write a unit test as well for this.
data_mat = np.random.uniform(size=(10,10,32))
Specify dimensions
x_dim = np.linspace(0, 1E-6, data_mat.shape[0]) y_dim = np.linspace(0, 1E-6, data_mat.shape[1]) z_dim = xvec
Make a sidpy dataset
data_set = sid.Dataset.from_array(data_mat, name='Current_spectral_map')
Set the data type
data_set.data_type = sid.DataType.SPECTRAL_IMAGE
Add dimension info
data_set.set_dimension(0, sid.Dimension(x_dim, name='x', units='m', quantity='x', dimension_type='spatial')) data_set.set_dimension(1, sid.Dimension(y_dim, name='y', units='m', quantity='y', dimension_type='spatial')) data_set.set_dimension(2, sid.Dimension(z_dim, name='Voltage', units='V', quantity='Voltage', dimension_type='spectral'))
data_set.set_dimension(3, sid.Dimension(z_dim, name='Voltage2', units='V', quantity='Voltage', dimension_type='spectral'))