Skip to content

Make the NPM timestamp unit a session-wide parameter - #412

Merged
pauladkisson merged 1 commit into
mainfrom
npm_units
Aug 4, 2026
Merged

Make the NPM timestamp unit a session-wide parameter#412
pauladkisson merged 1 commit into
mainfrom
npm_units

Conversation

@pauladkisson

@pauladkisson pauladkisson commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes #411

Details (AI-generated)

Fixes #411.

The NPM timestamp unit is now one value per session folder, supplied as a plain parameter that
defaults to seconds, with no inference from file layout. It is persisted resolved, so
.npm_params.json always states the unit the run was read with.

The unit and timestamp-column questions are now asked independently: the unit always, the column
only when the session's files offer more than one. That drops the accumulating column-name list
behind the asymmetry in #411sampleData_NPM_2 and sampleData_NPM_4 are the same layout, but
only the former was asked which timestamp column to use, on a dropdown with one option, and the
answer set the divisor for the whole folder.

Scope:

  • npm_time_units / npm_timestamp_column_names become the scalars npm_time_unit /
    npm_timestamp_column_name throughout (extractor, guppy.testing.api, .npm_params.json).
  • needs_ts_unit is replaced by timestamp_column_options, which reports each file's own
    timestamp columns.
  • The file listing and layout classification that _decompose_streams, has_multiple_event_ttls
    and the column probe each had their own copy of are extracted into _list_npm_files /
    _classify_npm_file, so the form and the extractor cannot classify a session differently.
  • load_npm_params rejects files written by v2.0.0-alpha7/8, whose recorded unit cannot be
    trusted, with a message to re-run Step 1.

Two consequences worth flagging:

  • Header-less sessions must now state their unit; left at the default one is read as seconds where
    GuPPy previously assumed milliseconds. No magnitude sanity check is included.
  • Every NPM session now shows one unit dropdown in Step 1, where sampleData_NPM_4 and
    sampleData_NPM_5 previously showed none.

All four NPM consistency cases pass against the v1.3.0 references, so no numeric output changed.

🤖 Generated with Claude Code

The unit recorded in .npm_params.json did not always match the one applied:
the Step 1 form fabricated "seconds" for files it never asked about, while
_decompose_streams divided header-less (data_np) timestamps by 1000.

The unit is now one value per session folder, supplied as a plain parameter
defaulting to seconds with no inference from file layout, and persisted
resolved so the recorded value is always the applied one. The unit and
timestamp-column questions are asked independently: the unit always, the
column only when the files offer more than one. That removes the accumulating
column-name list that asked which timestamp column to use for the second file
of a session -- a question with one possible answer whose real effect was
choosing the divisor for the whole folder.

Also extracts the file listing and layout classification that _decompose_streams,
has_multiple_event_ttls and the column probe each had their own copy of, so the
form and the extractor can no longer classify a session differently.

Fixes #411

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pauladkisson
pauladkisson enabled auto-merge August 4, 2026 14:57
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.86207% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/guppy/extractors/npm_recording_extractor.py 94.17% 4 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@pauladkisson
pauladkisson merged commit b1172ff into main Aug 4, 2026
12 checks passed
@pauladkisson
pauladkisson deleted the npm_units branch August 4, 2026 15:11
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.

NPM timestamp unit recorded in .npm_params.json does not match the one GuPPy applies

1 participant