Repository navigation
feat: new command chipstream-compress - #30
Merged
paulmueller merged 3 commits intoNov 30, 2026
Merged
Conversation
Lossless compression of .rtdc files with `dcnum.write.compress`, optionally with cropped event images (`--crop-event-images`, same format as `dclab-compress --crop-event-images`). Features in file basins (e.g. the image data of the raw file of a "_dcn.rtdc" file) are written to the output file; moved basin files can be specified with `-b`. Supports `-r`, `-c`, and `--num-cpus` like `chipstream-cli`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcnum 0.32.0 copies features that are already compressed with the same or a higher Zstandard level, so the `-c` test now requests a higher level than the input data. Mention the copying in the `-c` help text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
==========================================
+ Coverage 80.99% 81.56% +0.56%
==========================================
Files 23 24 +1
Lines 1721 1817 +96
==========================================
+ Hits 1394 1482 +88
- Misses 327 335 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
paulmueller
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New command
chipstream-compressfor lossless compression of .rtdc files, based ondcnum.write.compress(dcnum 0.32.0, DC-analysis/dcnum#125, #126, #128-#130).Usage
PATH_OUTis optional: by default, the output is written to<name>_compressed.rtdcnext to the input file. A missing ".rtdc" suffix is added. Existing output files are not overwritten (error).--crop-event-images: store only the image data around the events (same format and data asdclab-compress --crop-event-images);--crop-method dilation|box(default "dilation"). Requires processed data ("mask", "image_bg", "size_x", "size_y", "frame"); raw data give a clear error.-b/--basin PATH(optional, multiple): location of a moved basin file (e.g. the raw data file). Without image data (neither in the input file nor in its basins), the command fails with a message that lists the unavailable basins.-c/--compression(default "zstd-5", validated: 'none' or 'zstd-1' to 'zstd-9'). Features that are already compressed with the same or a higher level are copied.-r/--recursive: likechipstream-cli -r, with an optional target directory; files ending with "_compressed.rtdc" are ignored, files with an existing output file are skipped (not counted as failures), failures are listed at the end (exit code 1).--num-cpus: number of worker processes.Entry point
chipstream-compress = "chipstream.cli:main_compress"(cli extra), README and docs/install.rst mention the new command.Benchmark (dcnum, Windows lab PC, 8 cores)
Pipeline output with 2,191,988 events (images from the 38 GB raw file), wall time including writing:
Peak memory (summed USS): dcnum 2.0 GB with cropping, 1.0 GB without; dclab ≥ 0.95 GB with cropping, 0.29 GB without.
Tests
tests/test_cli_compress.py: compression of achipstream-clioutput with and without cropping (the output does not need the raw file), moved raw file (-b, crop method "box",-c,--num-cpus), errors (invalid compression, cropping raw data, directory without-r, file with-r, output path is a directory, existing output file, suffix), recursive mode (target directory, skipped and failed files, compressed files are not compressed again), unexpected errors.chipstream/cli/cli_compress.py: 100 %.🤖 Generated with Claude Code