::tclsimrawreader
Commands
configure
Queries or changes package-wide representation and collision defaults in this Tcl interpreter.
configure ?option? configure ?-output list|vector? ?-ifexists error|replace?
Parameters
-ifexists policy:Default destination collision policy: error or replace; initially error.
-output mode:Default output representation: list or vector; initially list.
Description
With no arguments, returns all settings as an option/value dictionary. With one option, returns its value. With option/value pairs, validates all settings before applying them and returns the complete configuration. Invalid options or values, or unavailable RBC support leave the configuration unchanged. Selecting vector mode requires an RBC-enabled build and a loadable rbc::vector package; list queries/settings do not load RBC. Defaults are independent in separate interpreters.
New raw-file handles capture these defaults unless -output or -ifexists is supplied explicitly at creation. Existing handles retain their settings. Per-read overrides take precedence over the handle default. This public command is not namespace-exported; call it as ::tclsimrawreader::configure. The collision policy affects vector output only; it can be configured while using list mode or without RBC. Replacement still requires a compatible, writable destination. Namespace selection and naming are unchanged.
Example:
set saved [::tclsimrawreader::configure]
::tclsimrawreader::configure -output vector -ifexists replace
::tclsimrawreader::configure -output
::tclsimrawreader::configure {*}$saved
Return value
selected option value for a single-option query; otherwise all settings as a dictionary.
openraw
Open channel to provided .raw file, creates subcommand, parses header(s) information from the file.
Every ::tclsimrawreader::openraw returns a command (e.g. ::tclsimrawreader::s1). The following
subcommands operate on that file instance.
openraw ?-dialect name? ?-output list|vector? ?-ifexists error|replace? ?-namespace name? filepath
Parameters
-dialect name:Optional dialect, possible values are
genericandltspice, default isgeneric-ifexists policy:Default collision policy,
errororreplace; inherits the package configuration (initiallyerror)-namespace name:Fixed destination namespace for all vector output; created with missing parents at open.
-output mode:Default output,
listorvector; inherits the package configuration (initiallylist)filepath:Path to SPICE .raw file.
Description
Relative namespace names resolve against the caller opening the handle. Empty names are rejected. If omitted, vector destinations continue to use the namespace calling each read. Closing the handle does not delete the namespace or output RBC vectors. The option also works with list defaults and later vector overrides.
Example:
set rawfile [tclsimrawreader::openraw /path/to/ac.raw]
set rawfile [tclsimrawreader::openraw /path/to/ac.raw -output vector -ifexists replace]
set rawfile [tclsimrawreader::openraw -dialect ltspice /path/to/ac.raw]
Return value
command name to work with the file, references as RAWFILE later
RAWFILE
A command ensemble.
RAWFILE subcommand ...
Description
The ensemble supports the following subcommands:
- close
Closes channel to provided .raw file and deletes subcommand.
- header
Gets dictionary containing metadata from the header for the selected plot. If provided without
-plotoption, returns header from the first plot.- names
Gets list of vectors’ (variables’) names defined in the header. If provided without
-plotoption, returns names from the first plot.- npoints
Returns the number of points in the selected plot.
- plots
Gets list of dictionaries containing information about the plots in the .raw file.
- vector
Gets the values of specified vector (variable) for selected plot, in certain range if specified. If plot index is not provided, return values from the first plot.
- vectors
Gets the values of specified vectors (variables) for selected plot (or all vectors), in certain range if specified. If plot index is not provided, return values from the first plot.
Refer to the documentation of each subcommand for details.
RAWFILE close
Closes channel to provided .raw file and deletes subcommand.
RAWFILE close ?-help?
Parameters
handle:Not documented.
Description
Example:
$rawfile close
The handle argument is supplied automatically when called as $handle close.
RAWFILE header
Gets dictionary containing metadata from the header for the selected plot. If provided without -plot
option, returns header from the first plot.
RAWFILE header ?-plot index?
Parameters
handle:Not documented.
-plot index:Index of the plot, optional.
Description
Result dictionary containing next keys:
title- string fromTitle:header fielddate- string fromDate:header fieldplotname- string fromPlotname:header fieldnvariables- string fromNo. Variables:header fieldnpoints- string fromNo. Points:header fieldpointstride- number of bytes occupied by a single pointflags- list of flags fromFlags:header fieldvariables- list of dictionaries containing information fromVariables:header block and derived data
Each variable key value contains dictionary with keys:
index- variable indexname- name of the variabletype- type of variablestorage- string characterising the storage of the value for variable, real32 = 4 bytes, real64 = 8 bytes, complex128 = 16 bytesvaluebytes- number of bytes per valueoffsetbytes- number of bytes from the start of point memory block to the start of variable value
Example:
$rawfile header
$rawfile header -plot 1
The handle argument is supplied automatically when called as $handle header.
Return value
dictionary
RAWFILE names
Gets list of vectors’ (variables’) names defined in the header. If provided without -plot option, returns
names from the first plot.
RAWFILE names ?-plot index?
Parameters
handle:Not documented.
-plot index:Index of the plot, optional.
Description
Example:
$rawfile names
$rawfile names -plot 1
The handle argument is supplied automatically when called as $handle names.
Return value
list
RAWFILE npoints
Returns the number of points in the selected plot.
RAWFILE npoints ?-plot index?
Parameters
handle:Not documented.
-plot index:Zero-based plot index; defaults to zero.
Description
The handle argument is supplied automatically when called as $handle npoints.
Return value
Returns the number of points in the selected plot.
RAWFILE plots
Gets list of dictionaries containing information about the plots in the .raw file.
RAWFILE plots ?-help?
Parameters
handle:Not documented.
Description
Each dictionary contains next keys:
index- index of the plot, starting with 0kind- format of the data, either binary or ASCIItitle- string fromTitle:plot’s header fieldplotname- string fromPlotname:plot’s header fieldnvariables- string fromNo. Variables:plot’s header fieldnpoints- string fromNo. Points:plot’s header fielddataoffset- number of bytes immediately afterBinary:/Values:marker line for plotdatabytes- number of bytes occupied by a data block of the plot
The handle argument is supplied automatically when called as $handle plots.
Return value
list of dictionaries
RAWFILE vector
Gets the values of specified vector (variable) for selected plot, in certain range if specified. If plot index is not provided, return values from the first plot.
RAWFILE vector ?-plot index? name ?-from index? ?-count index? ?-output list|vector? ?-ifexists error|replace? ?-name destination|#auto? ?-namespace name?
Parameters
handle:Not documented.
-count index:Number of values from the number provided by
-from, or from the start otherwise, optional, integer.-from index:Number of the values from the start of the vector, optional, integer.
-ifexists policy:Override collision handling for this call:
errororreplace-name destination:Explicit output name or
#autofor a fresh RBC-generated name; vector output only.-namespace name:Destination override for this read; vector output only, relative to the caller, created if missing.
-output mode:Override the handle output for this call:
listorvector-plot index:Index of the plot, optional.
name:Name of the vector (variable)
Description
In vector mode, safe literal names (including v(out) and v(1)) are preserved and qualified in the handle
namespace, if configured, or the calling namespace otherwise. A per-call -namespace takes
precedence. Unsupported/namespace-bearing names and names beginning with the reserved _raw_ prefix become
_raw_ plus uppercase hexadecimal UTF-8 bytes. Original dictionary keys are unchanged. Requires RBC’s -literal
true creation support. New vectors have no mapped arrays and outlive the handle. Complex raw data creates complex
RBC vectors. Replacement preserves same-type vector identity; an unrelated command or a numeric type mismatch is
an error. See the start page for naming and ownership. Relative -namespace resolves against the read caller and
creates missing parents. Empty namespaces are rejected. Fully qualified destinations override -namespace; their
parent must exist. RBC expands a final #auto component in the selected namespace. Overrides do not change handle
defaults.
Example:
$rawfile vector -plot 2 ID(M1)
$rawfile vector -plot 2 ID(M1) -from 5 -count 16
$rawfile vector ID(M1) -from 5
$rawfile vector ID(M1) -count 16
$rawfile vector ID(M1)
The handle argument is supplied automatically when called as $handle vector.
Return value
list of values in list mode, or fully qualified RBC vector command name in vector mode
RAWFILE vectors
Gets the values of specified vectors (variables) for selected plot (or all vectors), in certain range if specified. If plot index is not provided, return values from the first plot.
RAWFILE vectors ?-plot index? -all|namesList ?-from index? ?-count index? ?-output list|vector? ?-ifexists error|replace? ?-names dictionary|#auto? ?-namespace name?
Parameters
handle:Not documented.
-all|namesList:List of vectors’ (variables’) names, or
-allto read all availible vectors.-count index:Number of values from the number provided by
-from, or from the start otherwise, optional, integer.-from index:Number of the values from the start of the vector, optional, integer.
-ifexists policy:Override collision handling for this call:
errororreplace-names destinations:#autofor all selected signals, or a raw-name-to-destination dictionary; vector output only.-namespace name:Destination override for this read; vector output only, relative to the caller, created if missing.
-output mode:Override the handle output for this call:
listorvector-plot index:Index of the plot, optional.
Description
Options do not change the handle defaults. Vector naming, types, collision handling and ownership follow the
single-vector command. Relative -namespace resolves against the read caller and creates missing parents. Empty
namespaces are rejected. Fully qualified destinations override -namespace; their parent must exist. RBC expands
a final #auto component in the selected namespace. All selected data is decoded before any destination data is
replaced.
Example:
$rawfile vectors -plot 2 {ID(M1) V(VD)}
$rawfile vectors -plot 2 {ID(M1) V(VD)} -from 5 -count 16
$rawfile vectors {ID(M1) V(VD)} -from 5
$rawfile vectors {ID(M1) V(VD)} -count 16
$rawfile vectors {ID(M1) V(VD)}
$rawfile vectors -plot 2 -all
The handle argument is supplied automatically when called as $handle vectors.
Return value
dictionary of original raw names to value lists, or to fully qualified RBC vectors’ commands’ names
Copyright (c) George Yashin