Skip to content

fix: make digital dtype11 decode spec-compliant and deterministic#40

Open
jgoedeke wants to merge 14 commits intoRecordEvolution:masterfrom
jgoedeke:dtype11-decode-bug
Open

fix: make digital dtype11 decode spec-compliant and deterministic#40
jgoedeke wants to merge 14 commits intoRecordEvolution:masterfrom
jgoedeke:dtype11-decode-bug

Conversation

@jgoedeke
Copy link
Contributor

I found an issue with datatype 11 parsing in scaled mode, where unset CR/CD fields lead to jibberish calculations and random float values. This PR is based on #39

  • Prevent uninitialized CR/CD metadata from leaking into decode paths by adding safe defaults and explicit presence handling
  • Apply CR scaling only where valid; keep datatype 11 (2-byte digital) on identity transform in scaled mode
  • Enforce clear fail-fast behavior when required CD timing metadata is missing for single-component channels
  • Add regression tests:
    • datatype 11 scaled output matches raw values
    • non-digital channels still satisfy scaled = raw * factor + offset

jgoedeke and others added 14 commits December 13, 2025 23:36
- Add pytest configuration for test management
- Implement test suite for CLI functionality and Python module
- Update README with testing instructions and badge
- Fix Dockerfile
- Create .dockerignore to exclude unnecessary files from Docker builds
- Add GitHub Actions workflows for testing
- Clean up makefile to include test commands
- Modified `component_group` and `channel` constructors to accept raw buffer pointers instead of vectors.
- Enhanced `load_all_data` and `init_metadata` methods for better data initialization and loading.
- Implemented `read_chunk` method in `channel` to facilitate chunked data reading with support for raw and scaled modes.
- Updated `convert_data_to_type` and `convert_chunk_to_double` functions to handle raw data more efficiently.
- Removed redundant `imc_result.hpp` file to streamline the codebase.
- Adjusted Python bindings in `imctermite.pyx` to manage C++ instance memory correctly.
- Update GitHub Actions workflow to support testing on multiple OS
- Refactor memory mapping in imc_buffer.hpp for Windows compatibility
- Improve makefile to handle .pyd files for Python builds
- Add comprehensive tests for streaming and chunking functionality in test_streaming.py
…ficiency (RecordEvolution#9)

Reduces memory usage by 90% for large datasets while maintaining comparable processing speed.
- Migrate from setup.cfg to pyproject.toml with PEP 517/621 compliance
- Update to Python build tools (replace setup.py commands with python -m build)
- Upgrade all GitHub Actions to latest versions (@v4, ubuntu-latest)
- Remove outdated cibuildwheel version pinning
- Add numpy as explicit build and runtime dependency
- Bump package version to 3.0.0
- Improve test documentation with development install guidance
- Add Python version badge to README
- Standardize python3 usage across makefiles
* restructure package significantly:
  - move native cython extension to private `_imctermite` module
  - introduce pure-python `__init__.py` wrapper for public api
* rename main class `imctermite` -> `ImcTermite` to follow PEP 8 class naming standards
* add deprecated alias for `imctermite` (with warning) for backwards compatibility
* add PEP 484 type hints and PEP 561 `py.typed` marker for proper IDE/mypy support
* support PEP 519 file system path protocol (allowing `pathlib.Path` objects)
* update usage examples and tests to reflect new API
* update build configuration (setup.py, pyproject.toml, MANIFEST.in) to support new structure
- Prevent uninitialized CR/CD metadata from leaking into decode paths by adding safe defaults and explicit presence handling
- Apply CR scaling only where valid; keep datatype 11 (2-byte digital) on identity transform in scaled mode
- Enforce clear fail-fast behavior when required CD timing metadata is missing for single-component channels
- Add regression tests:
  - datatype 11 scaled output matches raw values
  - non-digital channels still satisfy scaled = raw * factor + offset
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.

1 participant