Skip to content

Conversation

@jon-myers
Copy link
Contributor

Summary

  • Fixed crop_frequency() and crop_time() to preserve time_resolution parameter
  • Both methods were falling back to DEFAULT_TIME_RESOLUTION instead of using the accurate value

Problem

When spectrograms are cropped, the new SpectrogramData instances were created without passing time_resolution, causing them to use the default value (0.01508s) instead of the accurate value calculated from the recording database (e.g., 0.015103s).

This small 0.00023s discrepancy accumulates over long recordings:

  • For a 2192-second recording, the timing error reached ~0.15 seconds
  • This caused visible misalignment between spectrograms and pitch trajectories in visualizations

Changes

  • crop_frequency(): Now passes time_resolution=self._time_resolution to new instance
  • crop_time(): Now passes time_resolution=self._time_resolution to new instance

Testing

  • Verified that cropped spectrograms now report correct time_resolution
  • Duration mismatch reduced from 0.15s to 0.007s (truncation only)
  • Spectrogram/trajectory alignment now correct in visualizations

🤖 Generated with Claude Code

Both crop methods were not passing time_resolution to new SpectrogramData
instances, causing them to fall back to DEFAULT_TIME_RESOLUTION (0.01508s)
instead of the accurate value calculated from database duration (e.g. 0.015103s).

This small discrepancy accumulates over long recordings, causing significant
timing misalignment. For a 2192-second recording, the error reached ~0.15s.

Now both methods preserve the parent spectrogram's time_resolution, ensuring
accurate timing throughout the crop chain.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

📦 Test Package Built Successfully!

This PR has been automatically built and uploaded to TestPyPI for testing.

🔗 TestPyPI Link: https://test.pypi.org/project/idtap/

To test this version:

pip install --index-url https://test.pypi.org/simple/ idtap

✅ All tests passed and package builds successfully.

@jon-myers jon-myers merged commit e140e51 into main Nov 7, 2025
1 check passed
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.

2 participants