Skip to content

Add function to convert size from bytes to a more readable format#101

Merged
ehrenfeu merged 4 commits intoimcf:develfrom
lguerard:add_byte_conversion
Mar 25, 2026
Merged

Add function to convert size from bytes to a more readable format#101
ehrenfeu merged 4 commits intoimcf:develfrom
lguerard:add_byte_conversion

Conversation

@lguerard
Copy link
Copy Markdown
Contributor

@lguerard lguerard commented May 6, 2025

Fixes #95

@codecov
Copy link
Copy Markdown

codecov bot commented May 6, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 25%. Comparing base (7a0be28) to head (6e7b2fe).
⚠️ Report is 5 commits behind head on devel.

Files with missing lines Patch % Lines
src/imcflibs/imagej/misc.py 88% 1 Missing ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           devel   #101   +/-   ##
====================================
  Coverage     25%    25%           
====================================
  Files         25     25           
  Lines       1756   1761    +5     
====================================
+ Hits         439    443    +4     
- Misses      1317   1318    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ehrenfeu ehrenfeu added this to the 2.0.0 milestone Jan 14, 2026
@ehrenfeu ehrenfeu added enhancement New feature or request new-minor Change introduced in PR will require a new minor release. labels Jan 14, 2026
@ehrenfeu ehrenfeu linked an issue Jan 14, 2026 that may be closed by this pull request
@ehrenfeu ehrenfeu moved this to In review in imcflibs Jan 14, 2026
@ehrenfeu ehrenfeu self-requested a review January 14, 2026 12:51
Copy link
Copy Markdown
Member

@ehrenfeu ehrenfeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name convert_bytes isn't really telling what it's actually doing, it only reveals the bytes are converted to something unknown.

Please rename it to human_bytes or similar.

@ehrenfeu ehrenfeu moved this from In review to In progress in imcflibs Jan 14, 2026
@ehrenfeu ehrenfeu removed this from the 2.0.0 milestone Jan 14, 2026
@ehrenfeu
Copy link
Copy Markdown
Member

Removed it from the current milestone as this is probably not blocking other code - feel free to re-add if you need it already now.

@ehrenfeu ehrenfeu added the changelog Needs to be mentioned in release changelogs label Jan 14, 2026
@ehrenfeu
Copy link
Copy Markdown
Member

#126

@ehrenfeu ehrenfeu force-pushed the add_byte_conversion branch 2 times, most recently from 6efda65 to 073a1f7 Compare January 21, 2026 11:23
@ehrenfeu
Copy link
Copy Markdown
Member

ehrenfeu commented Jan 21, 2026

I rebased this PR onto current devel in order to reduce the complexity of merging it (misc.py had many other changes already in devel, resulting in a lot of potential conflicts).

🚨 @lguerard please make sure to git pull delete your local branch and create a new one from the PR before continuing your work on this!! 🚨

Let me know if you need help with this!

@ehrenfeu ehrenfeu added this to the 2.0.0 milestone Jan 21, 2026
@lguerard lguerard requested a review from ehrenfeu January 21, 2026 14:16
lguerard and others added 4 commits March 25, 2026 22:30
- Implemented `bytes_to_human_readable` function to convert byte sizes into a more readable format.
- Added unit tests for the new function to ensure accuracy across various sizes.
* Ensure common sizes are formatted into human-readable strings.
* Verify formatting for large sizes such as terabytes.
@ehrenfeu ehrenfeu force-pushed the add_byte_conversion branch from 2f7d719 to 6e7b2fe Compare March 25, 2026 21:34
@ehrenfeu
Copy link
Copy Markdown
Member

Rebased this onto current devel in order to resolve merge conflicts.

def save_image_in_format(
imp, format, out_dir, series, pad_number, split_channels, suffix=""
):
"""Save an ImagePlus object in the specified format.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please be more careful when crafting / assembling commits, those changes (originating from code linting and formatting tools) are completely unrelated to the PR and destroy the logical context of the code history when being committed with the message of the actual change.

@ehrenfeu ehrenfeu merged commit 379487b into imcf:devel Mar 25, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in imcflibs Mar 25, 2026
@lguerard lguerard deleted the add_byte_conversion branch March 26, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Needs to be mentioned in release changelogs enhancement New feature or request new-minor Change introduced in PR will require a new minor release.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add method to convert bytes

2 participants