Character matrices with more than one row come back transposed from <blob>
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
まず src/datajoint/blob.py の CHAR のシリアライズと reshape のロジック、特に issue でリンクされている行を確認してください。提供された2行の NumPy 配列で往復変換を再現し、列優先で書き込むことで Python が保存した blob が保持され、MATLAB 用の期待される行列が生成されるかを確認してください。文字行列が変更されずに往復変換され、MATLAB でも変更されずに読み込めれば完了です。
索引モデルが issue の本文から書いたものです。
説明
A character array (S1) with two or more rows comes back transposed from a <blob> attribute.
import numpy as np
from datajoint import blob
x = np.array([[b"a", b"b", b"c"], [b"d", b"e", b"f"]])
blob.unpack(blob.pack(x))
# array([['a', 'c', 'e'],
# ['b', 'd', 'f']], dtype='<U1')
The same happens through a table (insert1 and fetch1 on a <blob> attribute), on MySQL and PostgreSQL, with master at eefe74b4.
The writer stores CHAR data in row-major order: array.view(np.uint8).astype(np.uint16).tobytes() (blob.py#L345). The reader reshapes it in column-major order (blob.py#L309), which is how MATLAB writes it and how every other array type is written. Bytes laid out the MATLAB way read back correctly. Commit 8f868518 (2019) changed the writer from array.tobytes(order='F') to the current form.
One-row and one-dimensional character arrays are not affected, because they are read back as a single string.
Expected
A character matrix round-trips unchanged, and MATLAB reads it unchanged.
Suggested fix
Write the CHAR data in column-major order: array.view(np.uint8).astype(np.uint16).tobytes(order="F"). Values already stored by Python keep their row-major bytes, so they read back as they do today.
- 主要言語
- Python
- スター
- 198
- フォーク
- 103
- 平均マージ
- 6日 1時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
datajoint/datajoint-python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
datajoint/datajoint-python#1703 ·
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
datajoint/datajoint-python#1701 ·
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
datajoint/datajoint-python#1691 ·
メンテナーはふだん 6 日以内に返信
-
dependencies needs-discussion
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
datajoint/datajoint-python#1687 ·
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
datajoint/datajoint-python#1668 ·
メンテナーはふだん 6 日以内に返信
datajoint/datajoint-python の issue をすべて見る
似ている issue
-
cognition
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
collabnix/awesome-mcp-lists#433 ·
メンテナーはふだん 4 日以内に返信
-
CrossEntropyFilter raises on zero probabilities and single-class results対応中かも @NopeCharon が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Archmonger/ServeStatic#129 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信