R/RawHandle.R

Defines functions raw_handle

Documented in raw_handle

#' S3 class constructor for TOF object
#'
#' stores repeatedly used object information
#' @param filename name of the h5 file
#' @return S3 object
#' @import rhdf5
#' @export
raw_handle <- function(filename){
  fid <- H5Fopen(filename)
  tofblock <- H5Dopen(H5Gopen(fid, "FullSpectra"), "TofData")
  h5space <- H5Dget_space(tofblock)
  dims <- H5Sget_simple_extent_dims(h5space)

  out <- list(file = filename,
              fid = fid,
              full_dims = dims,
              full_space = h5space,
              pos_calc = function(id) dim_calc(id, dims$size[-1])
              )

  class(out) <- append(class(out), "raw_handle")
  return(out)
}
bdcaf/rawTof documentation built on July 17, 2019, 1:09 p.m.