https://github.com/biochem-fan/cheetah
Raw File
Tip revision: bbe2266b6cadc022ce66cf064b89445695b76fd7 authored by Takanori Nakane on 07 February 2024, 03:51:27 UTC
Added MPCCD-8B0-2-008 (assembled from outer panels of older SWD MPCCDs)
Tip revision: bbe2266
read_h5.pro
;;
;;	Basic IDL code to read in our simple HDF5 file format
;;	Returns the content of the 'data' field in a given HDF5 file
;;	Anton Barty, CFEL, 2009
;;

function read_h5, filename, field=field

	if n_elements(filename) eq 0 then $
		filename = dialog_pickfile()
	if filename[0] eq '' then $
		return, -1
		
	if NOT KEYWORD_SET(field) then $
		field = '/data/data'

	file_id = H5F_OPEN(filename) 
 	dataset_id = H5D_OPEN(file_id, field) 
	data = H5D_READ(dataset_id) 
	H5D_CLOSE, dataset_id 
	H5F_CLOSE, file_id 

	return, data
END 
back to top