file_read

Reads data from the datasets in .PHOTON file.

This is a low-level function providing direct access to the datasets stored in the file. To deal with photons stream data prefer using read_photons function.

Syntax

data = file_read(filename, dataset)
data = file_read(filename, dataset, offset, count)

Description

data = file_read(filename, dataset)

Retrieves all the data from the .PHOTONS of named dataset in the the file filename.

data = file_read(filename, dataset, offset, count)

Reads a subset of count long elements from dataset starting from the element pointed by offset.

Parameters

filename

String specifying the name of .PHOTONS file.

dataset

String specifying fully qualified dataset name in the .PHOTONS file given by filename parameter.

offset

Numeric value specifying the place to start reading the data. This is 0-based index. Prefer using uint64 type value to be able addressing the offsets in large datasets.

count

Numeric value specifying the amount of data to read.

Return values

data

Vector of read values.

Examples

Read an all x positions of the photons in the file 'gfp.photons':

>> photonscore.file_read('gfp.photons', '/photons/x')
ans =

  59905889×1 uint16 column vector

   2904
   1519
   1876
   1803
   1997
   1858
   1379
   2111
   3467
   1867
   ....

Read five x positions starting from the forth value:

>> photonscore.file_read('gfp.photons', '/photons/x', 3, 5)

ans =

  5×1 uint16 column vector

   1803
   1997
   1858
   1379
   2111

Note that to start reading from the 4th element, e.g. 1803 offset parameter value 3 is given.