SIGCLEAR Program reference

sgoutcsv

Export selected dataset fields or vectors as CSV

Package: sigclear-io · Version: 1.0.2 Download JSON

Description

Write selected scalar fields or numeric samples as CSV rows. Fields mode writes
one row per input column, including complete fixed-width text cells. Vector mode
writes one selected numeric field as a row per input column. Vectors mode writes
selected numeric fields from only the first input column as CSV columns.

Selections must name existing fields; empty or unknown names are errors.
Fields mode accepts numeric/complex scalars and fixed-width cN text. Numeric
vector modes require equal sample counts in vectors mode; one-sample numeric
fields are allowed. Float/double values use round-trip significant-digit
precision, and integers retain their native precision. Complex values retain
the real+imaginaryI notation, with full precision for both components.

Text is bounded by its field width. Empty text becomes an empty cell; trailing
NUL padding is omitted, but spaces are preserved. Embedded NULs followed by
non-padding data are rejected. Quoted CSV is not supported: commas, double
quotes, line breaks and other ASCII control bytes in text or headers are errors.
CSV does not preserve field types, text widths, units or sampling metadata;
record these separately when exchanging data.

Synopsis

sgoutcsv mode=fields <stdin fields= vector="data" vectors="data" >stdout

Parameters

sgoutcsv parameters
ParameterTypeDefaultDescription
mode enum fields output layout: fields: selected numeric/complex scalars and fixed-width text, one row per input column vector: samples of one numeric field, one CSV row per input column, without a header vectors: equal-length numeric fields from the first input column, with one sample per row
Allowed: fields vector vectors
in ifile stdin input SOIG dataset containing the selected scalar/text fields or numeric sample arrays
fields strs Unknown required comma-separated scalar/text field names, in output order
vector str data numeric field to export in vector mode; defaults to data
vectors strs "data" comma-separated numeric field names in vectors mode; defaults to data
out ofile stdout output CSV table in the selected layout, preserving numeric precision and fields-mode text

Input and output

Input

input SOIG dataset containing the selected scalar/text fields or numeric sample arrays

Output

output CSV table in the selected layout, preserving numeric precision and fields-mode text

Examples

1. Export labels and measurements as CSV columns

sgoutcsv mode=fields fields=label,value <measurements.sg >measurements.csv

Each input column becomes a CSV row under the label,value header. label is a
fixed-width text field; value is a numeric scalar. Empty labels remain empty
cells, and floating-point values retain round-trip precision.

2. Export paired numeric vectors from the first input column

sgoutcsv mode=vectors vectors=time,data <traces.sg >samples.csv

time and data must have equal sample counts. The header is time,data and each
following row contains one sample pair from the first input column only.