hdf5 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/hdf5.gemspec +2 -2
  4. data/lib/hdf5.rb +26 -3
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b29f81b9aa64ee2dacbcfb1d0e572433ddfe6ea4
4
- data.tar.gz: d1437ce28a4b03e0f7d6566f70645805901694cc
3
+ metadata.gz: 768ec911dfe373d8df6c7b9c01d9c6d6a8341c30
4
+ data.tar.gz: 2c9259ac302f0c8e6642737c044ff55e7edb31ee
5
5
  SHA512:
6
- metadata.gz: a35e8318c4748305fbc5007c4c892653e9414f92f07d9db80be31747a8922a682c08f6bc6a68aeae6eb69169fc8413826c24963c884aeeb51920dc9ca8a2b587
7
- data.tar.gz: 8129fed65a5829e1f902a9f9642910e1b8c31f643ec8178ced2515ee07acb0964346dd8d50ff295bef65120a38afdb82770bdbd30bb7dc027278ef7c2a41f9d2
6
+ metadata.gz: 903f50b1de170a73a520727b5dbe7d720844c486341d852cd4e776aa22a60a4828a956ba46e6d560ef2095788b732ceafb918056b56457ff97e4353a9e4dbdfa
7
+ data.tar.gz: 51240f356a351cd3e4d759e7e6e0d7fb3040c58fe82a30bebc2292335bfc6c70113a7babcd483b114c1426a2a0f7bbe3e1d6bbb366114d339b53ed171d83df83
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
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.0 ruby lib
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.0"
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
- def ffi_mem_pointer
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.ffi_mem_pointer)
167
+ basic_read(@id, datatype.id, 0, 0, 0, narr.ffi_pointer)
145
168
  narr
146
169
  end
147
170
  #def array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hdf5
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock