API Reference
TRSFiles.TraceParam
— TypeEncodes a trace parameter
- typ is a coding byte, see trs_coding
- len is the number of elements (i.e. number of bytes is len * typ.width)
- offset is the byte offset in the data field where this param lives
For example TraceParam(trs_coding(UInt16), 16, 0)
is a 16 element short array at byte offset 0. A next parameter would thus be at byte offset 32 (even though you probably shouldn't overlap parameters, the library allows it).
When you create a TRS file and your header has trace parameters, we sanity check and adjust the data length so that it fits.
Example use:
trs = trs_open("bla.trs", "w"; header = Dict(
TRSFiles.TITLE_SPACE => ntitle,
TRSFiles.LENGTH_DATA => ndata,
TRSFiles.NUMBER_SAMPLES => nsamples,
TRSFiles.SAMPLE_CODING => trs_coding(sampletype),
TRSFiles.TRACE_PARAMETER_DEFINITIONS => Dict(
"INPUT" => TraceParam(trs_coding(UInt8), 16, 0),
"KEY" => TraceParam(trs_coding(UInt8), 16, 16),
"OUTPUT" => TraceParam(trs_coding(UInt8), 16, 32),
)))
TRSFiles.trs_coding
— Methodreturns the byte that encodes a julia type (or nothing if not supported)
TRSFiles.trs_data
— MethodReturns a matrix view of the data for key key
in the trace set. Every column i
contains the data for key key
of trace i
.
Calling this function without a key returns a matrix view of all data.
TRSFiles.trs_data_keys
— MethodReturns a set of the data keys in the trace set, for example "LEGACY_DATA" or "INPUT", "OUTPUT", etc.
These keys are used as the key parameters in trs_data
.
TRSFiles.trs_open
— FunctionOpens a trace set, you can use modes "r" or "w" or "a", but no combinations. Using mode "w" requires you to pass a header dictionary.
TRSFiles.trs_samples
— MethodReturns a matrix view of the samples in the trace set. Every column i
contains the samples of trace i
.
TRSFiles.trs_title
— MethodReturns a matrix view of the title bytes in the trace set. Every column i
contains the title bytes of trace i
.
TRSFiles.trs_xaxis
— MethodReturns the values of the x-axis for this trace set
TRSFiles.trs_xlabel
— MethodReturns the label for the x-axis for this trace set, or "" if none
TRSFiles.trs_ylabel
— MethodReturns the label for the y-axis for this trace set, or "" if none
TRSFiles.trs_yscale
— MethodReturns the scaling factor for the y-values in this traces. Multiplying the samples with this factor makes the values of the unit label returned by trs_ylabel
.