gonexus

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 3 Imported by: 0

README

gonexus

gonexus is a Go library for reading NeXus (HDF5) scientific data files using CGO bindings to HDF5 C libraries. It provides Go-friendly access to metadata and dataset contents for scientific computing, machine learning, or data analysis.

Features

  • Read NeXus (HDF5) files in Go
  • Extract metadata as Go maps
  • Read datasets (1D, 2D, 3D) into Go slices
  • Fast C-backed access using CGO

Requirements: Go 1.18+, HDF5 development libraries (libhdf5 + headers), C compiler (GCC/Clang)


Installation

# Clone the repository:
git clone https://github.com/CHESSComputing/golib.git
cd golib/gonexus

# Build the C helper library:
make

This creates libnexus.so library


Environment Setup

Before running Go code, point your system to the shared library:

# on Linux
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gonexus

# On macOS:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/path/to/gonexus

Example Program

For concrete examples of how to use this library please refer to integration area which contains examples written in C, Go, and Python.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HDF5Data

type HDF5Data struct {
	Data  []float64
	Shape []int
	Rank  int
	Size  int
}

HDF5Data represents HDF5 data

func ReadHDF5

func ReadHDF5(filename, dataset string) (*HDF5Data, error)

ReadHDF5 function reads a given dataset from a file path and returns medata (as a map), data array (as floats64) and error

type HDF5MetaData

type HDF5MetaData struct {
	Name  string
	DType string
	Shape []int
	Size  int64
}

HDF5MetaData represents content of single dataset within HDF5 file

func Content

func Content(fileName string) ([]HDF5MetaData, error)

Content provides content of the given HDF5 file and return list of HDF5MetaData structs

Directories

Path Synopsis
integration
gotest command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL