class OMX::OMXFile

Object for wrapping an OMX file. Basic usage:

file = OMX::OMXFile.new('filename.omx')

> Do stuff

file.close

Attributes

id[R]

hid_t H5Aopen( hid_t obj_id, const char *attr_name, hid_t aapl_id ) attach_function :basic_openattr, :H5Aopen, [H5Types.hid_t, :string], H5Types.hid_t

Public Class Methods

new(filename) click to toggle source

Open the file with the given filename. Currently read only

# File lib/OpenMatriX.rb, line 143
def initialize(filename)
  raise Errno::ENOENT.new("File #{filename} does not exist") unless FileTest.exist?(filename)
  raise InvalidFile.new("File #{filename} is not a valid hdf5 file") unless basic_is_hdf5(filename) > 0
  @filename = filename
  @id = basic_open(filename, 0x0000, 0)
  raise InvalidFile.new("An unknown problem occured opening #{filename}") if @id < 0
end

Public Instance Methods

close() click to toggle source

Close the file

# File lib/OpenMatriX.rb, line 155
def close
  basic_close(@id)
end
dataset(name) click to toggle source

Return a dataset object with the given name (relative to the root of the file)

# File lib/OpenMatriX.rb, line 165
def dataset(name)
  return H5Dataset.open2(@id, name)
end
group(name) click to toggle source

Return a group object with the given name (relative to the root of the file)

# File lib/OpenMatriX.rb, line 160
def group(name)
  return H5Group.open(@id, name)
end
is_hdf5?() click to toggle source

Is the file a valid hdf5 file

# File lib/OpenMatriX.rb, line 151
def is_hdf5?
  basic_is_hdf5(@filename) > 0
end