Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add guess_tables() to tecmag for reading sequence tables from PSEQ#257

Open
dpizetta wants to merge 1 commit into
jjhelmus:masterfrom
dpizetta:add-guess-tables-tecmag
Open

Add guess_tables() to tecmag for reading sequence tables from PSEQ#257
dpizetta wants to merge 1 commit into
jjhelmus:masterfrom
dpizetta:add-guess-tables-tecmag

Conversation

@dpizetta
Copy link
Copy Markdown

Closes #123.

The PSEQ section of Tecmag .tnt files stores sequence tables (rfamp, delay tables, etc.) as pairs of length-prefixed Pascal strings. This adds guess_tables() to expose them as a dict.

The pytnt library (chatcannon/pytnt, GPL-3.0) reads delay tables by matching the default TNMR naming pattern de[0-9]+:[0-9]. As noted by robbyblum in #123, most users assign descriptive names to their tables (e.g. "rfamp", "tp"), which pytnt's regex does not catch. This implementation generalizes the parser to find any valid Pascal-string pair in PSEQ, with strict length-prefix validation to reject coincidental substring matches.

The function follows the API suggested by kaustubhmote in #123: a standalone guess_tables() function with optional name filtering. Single-value (scalar) entries are excluded since they typically represent sequence variable defaults rather than swept tables.

SI-prefix conversion (e.g. '100u' -> 1e-4) mirrors pytnt's convert_si() behavior so unit-suffixed tokens are returned in base SI units.

Tests cover the numeric parsing, SI conversion, scalar exclusion, name filtering, the convert_si=False mode, files without a PSEQ section, rejection of invalid length prefixes, rejection of non-ASCII names, and mixed whitespace separators.

Closes jjhelmus#123.

The PSEQ section of Tecmag .tnt files stores sequence tables (rfamp,
delay tables, etc.) as pairs of length-prefixed Pascal strings. This
adds guess_tables() to expose them as a dict.

The pytnt library (chatcannon/pytnt, GPL-3.0) reads delay tables by
matching the default TNMR naming pattern `de[0-9]+:[0-9]`. As noted by
robbyblum in jjhelmus#123, most users assign descriptive names to their tables
(e.g. "rfamp", "tp"), which pytnt's regex does not catch. This
implementation generalizes the parser to find any valid Pascal-string
pair in PSEQ, with strict length-prefix validation to reject
coincidental substring matches.

The function follows the API suggested by kaustubhmote in jjhelmus#123:
a standalone guess_tables() function with optional name filtering.
Single-value (scalar) entries are excluded since they typically
represent sequence variable defaults rather than swept tables.

SI-prefix conversion (e.g. '100u' -> 1e-4) mirrors pytnt's
convert_si() behavior so unit-suffixed tokens are returned in base
SI units.

Tests cover the numeric parsing, SI conversion, scalar exclusion,
name filtering, the convert_si=False mode, files without a PSEQ
section, rejection of invalid length prefixes, rejection of
non-ASCII names, and mixed whitespace separators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reading tables from tecmag file

2 participants