Skip to content

New snippet for png/s3: aws-chammi-75-multichannel-pretraining - #61

Merged
mia-autodev[bot] merged 1 commit into
mainfrom
snippets/issue-58
Nov 14, 2026
Merged

mia-autodev[bot] merged 1 commit into
mainfrom
snippets/issue-58

Conversation

@mia-autodev

@mia-autodev mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Closes #58: For aws-chammi-75-multichannel-pretraining: dataset aws-chammi-75-multichannel-pretraining has no snippet that reads it.

Implemented by snippets: Claude Code running in a sandboxed job on the cluster. The agent's own
summary is the first comment.

  • Merge: approve this PR, or comment /approve <head sha> (needed when running under a personal token; a
    trusted worker posts it when the output of this head is approved).
    snippets merges once an approval matches the current head and checks are not failing.
  • Request changes: submit a review with Request changes, or comment /revise <what to change>.
    Up to 3 revision rounds.
  • Stop: close this PR.

…annel of a field, stacked as cyx

For aws-chammi-75-multichannel-pretraining (issue #58): the catalog had no PNG reader.
One url is yx, several urls are the channels in binding order; each file is decoded
whole with imagecodecs (access: file). The example binds the record's idr0001 field
(2 channels, 1040x1376) and hpa0018 field (4 channels, 512x512).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

snippets: round 1 pushed 39e2a984c9f2 to snippets/issue-58 · $2.67

Added snippets/png-channels/, a reader for greyscale PNGs stored one file per channel, and committed it as 39e2a98 on snippets/issue-58 (not pushed). The smoke test passes on the real CHAMMI-75 data.

What it does

  • One URL is read as a yx image; several URLs are the channels of one field of view, stacked as cyx in binding order.
  • Formats: 8- or 16-bit grey PNG, from a plain URL or a zip member, decoded whole with imagecodecs (access: file). RGB, palette, alpha and sub-8-bit PNGs are refused at open with a clear message.
  • No params, and no new dependency (numpy, imagecodecs are on the allowlist).
  • Only the first file's header is read at open. A later channel that is missing or has a different shape or bit depth fails when it is read.

The example binding

examples/aws-chammi-75-multichannel-pretraining.yaml binds the two fields the record inspected, each with all of its channel files instead of the draft's channel 0 alone:

raw field array
0 idr0001 (..._channel-0.png, -1) cyx 2×1040×1376 uint8
1 hpa0018 (<uuid>-ch0.png … ch3) cyx 4×512×512 uint8

I found the sibling channel files by listing each field's key prefix on chammi-data.s3.amazonaws.com, the allowlisted host. All URLs are on that host, not the s3.us-west-2 one.

Testing

Smoke summary, run as CLAUDE.md prescribes with MIA_HARNESS_ALLOWED_HOSTS=chammi-data.s3.amazonaws.com:

{"ok": true, "shapes": {"raw": [[2, 1040, 1376], [4, 512, 512]], "labels": []},
 "warnings": [], "errors": [], "bytes_fetched": 784737}
  • Real-data crops: harness crop --n 4 made 4 crops, drawn from both channels.
  • harness verify: with the issue's Record block as given, all 4 crops fail with "crop.json has no licence", because that block has no license field. With a placeholder licence added to a local copy of the record, all 4 pass.
  • CI checker: ci/check_pr.py --base origin/main passes.
  • Existing suites: harness tests 225 passed, CI-checker tests 21 passed.
  • Edge cases: 15 local tests over the harness range server pass (uint8/uint16, channel order, interlaced and multi-block files, a server without Range, stored and deflated zip members with a glob, and the refusals). These are not committed, because CI rejects a snippet PR that touches harness/tests.

Limits to know about

  • Two fields out of about 2.8 million files. The bucket has no directory index and the snippet does not enumerate it, so a binding names each field URL by URL. Covering the dataset at scale needs the file list from an S3 listing or the bucket's metadata CSV, which is outside what a snippet can do.
  • Channel names and voxel size are not set. Neither is in a PNG, and the record sets neither.

@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Review judge: approve

The PR adds a new png-channels snippet that reads 8/16-bit greyscale PNGs over HTTP(S) or from zip members, as yx for one file or as cyx when several per-channel files are stacked. It also adds the requested CHAMMI-75 example binding, which lists two fields with explicit global-host URLs. The code follows the spec's interface, I/O and dependency rules and only adds files under a new snippet directory. The one open question is whether the extra channel URLs exist, because the record does not verify them.

item severity note
snippets/png-channels/snippet.py ok It decodes greyscale PNGs with imagecodecs.png_decode, giving yx for one URL and cyx for several, which is what the issue asks for. It imports only struct, numpy, imagecodecs and mia_harness.api, and all I/O goes through io.open/io.fetch/io.expand, with the NeedsFetch fallback the spec describes.
snippets/png-channels/snippet.py ok open_array reads only the 33-byte signature+IHDR header, not voxel data, as spec §2 requires. Its signature matches the required annotation, and access is reported as 'file' at runtime.
snippets/png-channels/snippet.py ok Only grey PNGs (colour type 0) at 8 or 16 bits are accepted. Each channel is checked against the first file's shape and dtype, and a decode that adds an alpha sample from tRNS is caught. Error messages name the URL.
snippets/png-channels/snippet.yaml ok Name matches the directory, formats are [png], containers are [http, zip], params are empty, requires is [numpy, imagecodecs] (both shown in the spec's allowlist example), and tested_on matches the example binding.
snippets/png-channels/examples/aws-chammi-75-multichannel-pretraining.yaml ok The binding is at the path the issue asks for. It uses explicit URLs on the global chammi-data.s3.amazonaws.com host with no glob over the missing S3 index, and binds no labels, consistent with the record.
snippets/png-channels/examples/aws-chammi-75-multichannel-pretraining.yaml suspect The record verifies only idr0001 channel-0 and hpa0018 ch0. The channel-1 and ch1..ch3 URLs depend on a prefix listing the agent says it ran, which the evidence does not show; the crops status will confirm them.
snippets/png-channels/README.md ok Documents glob support (needed by spec §2), access mode and known limits, and explains why snippets_commit is the pre-snippet base commit.
diff ok Only adds files under one new snippets/png-channels/ directory. No protected paths or existing snippets are touched.
ci.json suspect CI was not awaited (shadow), so neither the check nor the real-data crops result is in evidence.

confidence 0.8 · model claude-opus-5-5 · prompt f5f9c39cc98e · policy v1 · $0.23

Shadow mode: this verdict is recorded and compared with the human label; it decides nothing.

@mia-autodev

mia-autodev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Crops at 39e2a984c9f2f1b3fe960d8adfaf42ce817df0bb: passed, 16 of 16 verified (at least 8 needed); the crop job fetched 1737277 bytes.

16 crops
raw overlay caption
raw overlay i27354089-e1794579687471-b0-000 · z=None c=0 · (732, 554)
raw overlay i27354089-e1794579687471-b0-001 · z=None c=0 · (532, 271)
raw overlay i27354089-e1794579687471-b0-002 · z=None c=1 · (144, 1026)
raw overlay i27354089-e1794579687471-b0-003 · z=None c=1 · (618, 1028)
raw overlay i27354089-e1794579687471-b0-004 · z=None c=0 · (223, 897)
raw overlay i27354089-e1794579687471-b0-005 · z=None c=0 · (127, 372)
raw overlay i27354089-e1794579687471-b0-006 · z=None c=1 · (369, 704)
raw overlay i27354089-e1794579687471-b0-007 · z=None c=0 · (424, 623)
raw overlay i27354089-e1794579687471-b0-008 · z=None c=1 · (366, 458)
raw overlay i27354089-e1794579687471-b0-009 · z=None c=1 · (196, 804)
raw overlay i27354089-e1794579687471-b0-010 · z=None c=0 · (483, 829)
raw overlay i27354089-e1794579687471-b0-011 · z=None c=1 · (218, 291)
raw overlay i27354089-e1794579687471-b0-012 · z=None c=0 · (447, 1111)
raw overlay i27354089-e1794579687471-b0-013 · z=None c=1 · (170, 512)
raw overlay i27354089-e1794579687471-b0-014 · z=None c=1 · (694, 470)
raw overlay i27354089-e1794579687471-b0-015 · z=None c=0 · (49, 1020)

Binding (sha256 4f2180e0705743b2057181f4c6cd5db3c434aae19186f434d9974e652b405b9c):

record: aws-chammi-75-multichannel-pretraining
record_commit: 3f75709f1d2778fe86fd9c436b2b5ff948a72c7b
snippets_commit: 39e2a984c9f2f1b3fe960d8adfaf42ce817df0bb
raw:
- snippet: png-channels
  urls:
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/idr0001/idr0001-plate_100A-converted/Meas_01%282013-01-14_11-13-43%29_001001001_series-0_z-9_t-0_channel-0.png
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/idr0001/idr0001-plate_100A-converted/Meas_01%282013-01-14_11-13-43%29_001001001_series-0_z-9_t-0_channel-1.png
  params: {}
- snippet: png-channels
  urls:
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/hpa0018/00070df0-bbc3-11e8-b2bc-ac1f6b6435d0-ch0.png
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/hpa0018/00070df0-bbc3-11e8-b2bc-ac1f6b6435d0-ch1.png
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/hpa0018/00070df0-bbc3-11e8-b2bc-ac1f6b6435d0-ch2.png
  - https://chammi-data.s3.amazonaws.com/CHAMMI-75/CHAMMI-75_train/hpa0018/00070df0-bbc3-11e8-b2bc-ac1f6b6435d0-ch3.png
  params: {}
labels: []
reasons:
- 'png-channels instead of the draft''s tiff-zip-member: every raw is a single-channel
  8-bit grey PNG (record technical.arrays: format png, axes yx, uint8, deflate), which
  tifffile refuses (''not a TIFF file: header=b''\x89PNG''''); png-channels decodes
  PNG and has no params'
- 'raw 0 is the record''s sampled idr0001 field with both of its channel files as
  cyx 2x1040x1376 instead of the draft''s channel-0 alone: the dataset stores one
  PNG per channel of a field (record path_pattern <field>_channel-<c>.png), and a
  listing of the field''s key prefix on chammi-data.s3.amazonaws.com (?list-type=2&prefix=...001001001_)
  returns exactly channel-0 and channel-1'
- 'raw 1 is the record''s probed hpa0018 field (00070df0-..., <uuid>-ch<c>.png) with
  its four channel files ch0..ch3 as cyx 4x512x512, so the binding covers both file
  layouts and both shapes the record saw (shape_varies: true); the same prefix listing
  returns exactly ch0..ch3'
- 'all urls on chammi-data.s3.amazonaws.com, not the s3.us-west-2 host of the record''s
  hpa0018 url: the record notes say the regional host is not on the allowlist and
  that the global host serves the same keys'
- 'explicit urls, no glob: the bucket has no HTTP directory index (harness list on
  the prefix returns 404), so the channels of a field are listed one url each, in
  channel-number order'
- 'two fields only: the other ~2.8M PNGs are not named in the record (listing_complete:
  false) and each field is its own array, since shapes and channel counts differ by
  study'
- 'no voxel size and no channel names: neither is in a PNG, and the record sets neither
  (they differ by source study)'
- 'no labels bound: record annotations.present is false (self-supervised pre-training
  set)'

@mia-autodev

mia-autodev Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

/approve 39e2a98

@mia-autodev
mia-autodev Bot merged commit d425182 into main Nov 14, 2026
2 checks passed
@mia-autodev
mia-autodev Bot deleted the snippets/issue-58 branch November 14, 2026 03:11
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.

New snippet for png/s3: aws-chammi-75-multichannel-pretraining

0 participants