EleFits  5.3.1
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches

◆ read_segment()

VecColumn< T, N > read_segment ( const Segment rows,
ColumnKey  key 
) const

Read the segment of a column specified by its name or index.

Parameters
rowsThe included lower and upper bounds of the row indices to be read
keyThe name or 0-based index of the column to be read
columnThe preexisting Column to be filled

Methods to read column segments are similar to methods to read complete columns (see read()). They accept an additional parameter to specify the rows to be read, as the bounds of a closed interval.

Example usages:

// Create a new Column
auto segment = columns.read_segment<float>({10, 50}, "NAME");
// Read into an existing Column
// This is a more complex example which demonstrates the use of offsets
Segment source_bounds = {10, 50};
long destination_row = 20;
std::vector<float> values(100);
PtrColumn<float> segment({"NAME", "m/s", 1}, 20, &values[destination_row]);
columns.read_segment_to(source_bounds, "NAME", segment);
Bounds of a closed index interval.
Definition: Segment.h:20
See also
read()