Option to deflate TRX files created with Python
まだ誰も着手していません。
評価
調査の方向性
tff_convert_tractogram.py から始め、既存の --positions_dtype と --offsets_dtype オプションを使って、TRX ZIP ファイルが作成される場所を特定します。Python の zipfile の圧縮オプションと、issue の zip2zip.py の例を確認します。ツールが設定可能なレベルで stored または deflate 圧縮を選択でき、既存の動作を維持できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I find the tff_convert_tractogram.py tool useful, and it provides options for both --positions_dtype and --offsets_dtype. However, the TRX zip files are always uncompressed (store) rather than using compression (some level of deflate). It might be nice to trade off file creation speed with file size (and transmission time).
I did write a little Python script to do this, but it would be nice to integrate this. My standalone script allows you to recompress any zip file (including trx) with a desired compression level:
python zip2zip.py -c 9 IFOF_L32.trx IFOF_L32_z9.trx
The code is:
import zipfile
import argparse
import sys
def recompress_zip(input_zip: str, output_zip: str, compression_level: int):
"""Recompress a ZIP file with a specified compression level (0-9)."""
compression_type = zipfile.ZIP_DEFLATED if compression_level > 0 else zipfile.ZIP_STORED
with zipfile.ZipFile(input_zip, 'r') as src_zip:
with zipfile.ZipFile(output_zip, 'w', compression=compression_type, compresslevel=compression_level) as dst_zip:
for file_info in src_zip.infolist():
with src_zip.open(file_info.filename, 'r') as src_file:
dst_zip.writestr(file_info, src_file.read(), compress_type=compression_type)
print(f"Recompressed {input_zip} -> {output_zip} with compression level {compression_level}")
def main():
parser = argparse.ArgumentParser(description="Recompress a ZIP file with a specified compression level.")
parser.add_argument("input_zip", help="Path to the input ZIP file")
parser.add_argument("output_zip", help="Path to the output compressed ZIP file")
parser.add_argument("-c", "--compression", type=int, choices=range(0, 10), default=9,
help="Compression level (0-9, where 0 is uncompressed and 9 is max compression, default: 9)")
args = parser.parse_args()
try:
recompress_zip(args.input_zip, args.output_zip, args.compression)
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
- 主要言語
- Python
- スター
- 27
- フォーク
- 20
- 平均マージ
- 1日 14分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tee-ar-ex/trx-python のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
tee-ar-ex/trx-python#77 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
tee-ar-ex/trx-python#72 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
tee-ar-ex/trx-python#51 · コメント 23 件 ·
-
good first issue
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
tee-ar-ex/trx-python#39 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
tee-ar-ex/trx-python#21 · コメント 4 件 ·
tee-ar-ex/trx-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
volcengine/OpenViking#6445 ·
メンテナーはふだん 1 日以内に返信
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be edited対応中かも @ManyaJain111 が今日担当しました。 オープンbug enhancement possible-duplicate
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
AOSSIE-Org/PictoPy#1637 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
deepspeedai/DeepSpeed#8884 ·
メンテナーはふだん 3 日以内に返信
-
Flaky: test_advisor_live_calibrates_an_unmeasured_circuit ranks engines by a 1.8ms sleep marginオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
flagos-ai/FlagQuantum#718 ·
メンテナーはふだん 1 日以内に返信
-
bug CI-failure high priority
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
vllm-project/afd-plugin#483 ·
メンテナーはふだん 1 日以内に返信