hdf5 0.2.0 → 0.2.1
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 +4 -4
- data/VERSION +1 -1
- data/hdf5.gemspec +2 -2
- data/lib/hdf5.rb +26 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 768ec911dfe373d8df6c7b9c01d9c6d6a8341c30
|
|
4
|
+
data.tar.gz: 2c9259ac302f0c8e6642737c044ff55e7edb31ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 903f50b1de170a73a520727b5dbe7d720844c486341d852cd4e776aa22a60a4828a956ba46e6d560ef2095788b732ceafb918056b56457ff97e4353a9e4dbdfa
|
|
7
|
+
data.tar.gz: 51240f356a351cd3e4d759e7e6e0d7fb3040c58fe82a30bebc2292335bfc6c70113a7babcd483b114c1426a2a0f7bbe3e1d6bbb366114d339b53ed171d83df83
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.1
|
data/hdf5.gemspec
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: hdf5 0.2.
|
|
5
|
+
# stub: hdf5 0.2.1 ruby lib
|
|
6
6
|
# stub: ext/hdf5/extconf.rb
|
|
7
7
|
|
|
8
8
|
Gem::Specification.new do |s|
|
|
9
9
|
s.name = "hdf5"
|
|
10
|
-
s.version = "0.2.
|
|
10
|
+
s.version = "0.2.1"
|
|
11
11
|
|
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
13
13
|
s.require_paths = ["lib"]
|
data/lib/hdf5.rb
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
require 'ffi'
|
|
2
2
|
class NArray
|
|
3
|
-
|
|
3
|
+
# Returns an FFI::Pointer which points to the location
|
|
4
|
+
# of the actual data array in memory.
|
|
5
|
+
def ffi_pointer
|
|
4
6
|
FFI::Pointer.new(Hdf5.narray_data_address(self))
|
|
5
7
|
end
|
|
6
8
|
end
|
|
9
|
+
|
|
10
|
+
# This is a module for reading and manipulating HDF5 (Hierarchical Data Format)
|
|
11
|
+
# files. At the current time (July 2014) it is capable of basic reading operations.
|
|
12
|
+
# However, its use of the FFI library means that extending its capabilities is easy
|
|
13
|
+
# and quick. For a basic example see the test file.
|
|
14
|
+
# Basic usage:
|
|
15
|
+
# file = Hdf5::H5File.new('filename.hdf5')
|
|
16
|
+
# dataset = file.dataset('/path/to/dataset')
|
|
17
|
+
# narray = dataset.narray_all
|
|
18
|
+
# file.close
|
|
19
|
+
|
|
20
|
+
|
|
7
21
|
module Hdf5
|
|
22
|
+
|
|
23
|
+
# A module containing functions for relating HDF5 types to the appropriate
|
|
24
|
+
# FFI symbol. At the moment these are set by hand, but at some point in the
|
|
25
|
+
# future they should be set dynamically by interrogation of the the library.
|
|
8
26
|
module H5Types
|
|
9
27
|
extend FFI::Library
|
|
10
28
|
class << self
|
|
@@ -49,7 +67,12 @@ module Hdf5
|
|
|
49
67
|
attach_function :group_open, :H5Gopen2, [H5Types.hid_t, :string, H5Types.hid_t], H5Types.hid_t
|
|
50
68
|
attach_function :get_type, :H5Iget_type, [H5Types.hid_t], H5Types.hid_t
|
|
51
69
|
#
|
|
52
|
-
# Object for wrapping an HDF file
|
|
70
|
+
# Object for wrapping an HDF file. Basic usage:
|
|
71
|
+
# file = Hdf5::H5File.new('filename.hdf5')
|
|
72
|
+
# dataset = file.dataset('/path/to/dataset')
|
|
73
|
+
# narray = dataset.narray_all
|
|
74
|
+
# file.close
|
|
75
|
+
#
|
|
53
76
|
class H5File
|
|
54
77
|
extend FFI::Library
|
|
55
78
|
ffi_lib 'hdf5'
|
|
@@ -141,7 +164,7 @@ module Hdf5
|
|
|
141
164
|
# complex datatypes.
|
|
142
165
|
def narray_all
|
|
143
166
|
narr = NArray.send(narray_type, *dataspace.dims)
|
|
144
|
-
basic_read(@id, datatype.id, 0, 0, 0, narr.
|
|
167
|
+
basic_read(@id, datatype.id, 0, 0, 0, narr.ffi_pointer)
|
|
145
168
|
narr
|
|
146
169
|
end
|
|
147
170
|
#def array
|