Module: HDF5

Defined in:
lib/hdf5/ffi_10.rb,
lib/hdf5.rb,
lib/hdf5/ffi.rb,
lib/hdf5/file.rb,
lib/hdf5/dtype.rb,
lib/hdf5/group.rb,
lib/hdf5/ffi_14.rb,
lib/hdf5/ffi_20.rb,
lib/hdf5/native.rb,
lib/hdf5/dataset.rb,
lib/hdf5/version.rb,
lib/hdf5/attribute.rb,
lib/hdf5/hierarchy.rb,
lib/hdf5/selection.rb,
lib/hdf5/data_helpers.rb,
lib/hdf5/file_context.rb,
lib/hdf5/string_codec.rb

Overview

require_relative 'ffi'

Defined Under Namespace

Modules: DataHelpers, FFI, Hierarchy, Native, StringCodec Classes: Attribute, AttributeManager, ClosedError, ConversionError, DType, Dataset, Empty, Error, File, FileContext, Group, NativeError, Selection, ShapeError, Slice, UnsupportedFeatureError, UnsupportedTypeError

Constant Summary collapse

DEFAULT_PROPERTY_LIST =
0
VERSION =
'0.0.4'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lib_pathObject

Returns the value of attribute lib_path.



29
30
31
# File 'lib/hdf5.rb', line 29

def lib_path
  @lib_path
end

Class Method Details

.search_hdf5libObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/hdf5.rb', line 38

def search_hdf5lib
  name = "libhdf5.#{FFI::Platform::LIBSUFFIX}"
  env_path = ENV['HDF5_LIB_PATH']
  return env_path if env_path && File.file?(env_path)
  return File.expand_path(name, env_path) if env_path && File.directory?(env_path)

  begin
    require 'pkg-config'
    libs = PKGConfig.libs('hdf5')
    pattern = %r{(?<=-L)/[^ ]+}
    libs.scan(pattern).each do |lib_dir|
      lib_path = File.expand_path(name, lib_dir)
      return lib_path if File.exist?(lib_path)
    end
  rescue PackageConfig::NotFoundError
    warn 'hdf5.pc not found.'
  end

  name
end

.slice(range, step:) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
35
36
# File 'lib/hdf5.rb', line 31

def slice(range, step:)
  raise ArgumentError, 'slice step must be a positive integer' unless step.is_a?(Integer) && step.positive?
  raise ArgumentError, 'slice range must be a Range' unless range.is_a?(Range)

  Slice.new(range:, step:)
end