샘플
scipy 1.18.0: ndimage
검증된 샘플 — pypi scipy 1.18.0: ndimage. python 3.12 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert gaussian_filter smooths multidimensional array…
sha256:1abd373b80ca31003cf734e0e88817d6ad30a109a8496688134b86e3fe3bc43e
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 pip
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962… |
2026-08-27 |
케이스
HOW- 목표
- verify scipy.ndimage in pkg:pypi/scipy@1.18.0
- 패키지
- 심벌
-
- scipy.ndimage
- 생성일
- 2026-08-27T19:57:50Z
컨트랙트
- assert gaussian_filter smooths multidimensional array with specified standard deviation
- assert label and find_objects identify contiguous connected components and return slice tuples
- assert binary_dilation and binary_erosion expand and shrink binary structures
- assert center_of_mass computes spatial centroids for labeled regions
- assert rotate and zoom perform array scaling and rotation transformations
파일
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify scipy.ndimage in pkg:pypi/scipy@1.18.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/scipy@1.18.0
Demonstrate these symbols/APIs:
- scipy.ndimage
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:9afe217477421b616d963d6631b5bc74b0f3d771fac79127140f3ac671c8b227","contract":["assert gaussian_filter smooths multidimensional array with specified standard deviation","assert label and find_objects identify contiguous connected components and return slice tuples","assert binary_dilation and binary_erosion expand and shrink binary structures","assert center_of_mass computes spatial centroids for labeled regions","assert rotate and zoom perform array scaling and rotation transformations"],"goal":"verify scipy.ndimage in pkg:pypi/scipy@1.18.0","kind":"HOW","packages":["pkg:pypi/scipy@1.18.0"],"schemaVersion":1,"symbols":["scipy.ndimage"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/scipy@1.18.0"],"schemaVersion":1,"subject":"pkg:pypi/scipy@1.18.0","symbols":["scipy.ndimage"],"verifierAdapter":"python@1"}
[project]
name = "verify-scipy-ndimage"
version = "0.1.0"
dependencies = [
"scipy==1.18.0",
"numpy==2.5.2",
]
scipy==1.18.0
numpy==2.5.2
{
"schemaVersion": 1,
"goal": "verify scipy.ndimage in pkg:pypi/scipy@1.18.0",
"kind": "HOW",
"packages": [
"pkg:pypi/scipy@1.18.0"
],
"symbols": [
"scipy.ndimage"
]
}
import numpy as np
import scipy.ndimage as ndi
def test_gaussian_filter():
arr = np.zeros((5, 5), dtype=np.float64)
arr[2, 2] = 1.0
filtered = ndi.gaussian_filter(arr, sigma=1.0)
assert filtered.shape == (5, 5)
assert filtered[2, 2] > filtered[0, 0]
assert np.isclose(filtered.sum(), 1.0, atol=1e-2)
def test_label_and_find_objects():
binary_grid = np.array([
[1, 1, 0, 0],
[1, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 1, 1],
], dtype=np.int32)
labeled, num_features = ndi.label(binary_grid)
assert num_features == 2
slices = ndi.find_objects(labeled)
assert len(slices) == 2
assert slices[0] == (slice(0, 2, None), slice(0, 2, None))
assert slices[1] == (slice(2, 4, None), slice(2, 4, None))
def test_morphology_dilation_and_erosion():
grid = np.zeros((7, 7), dtype=bool)
grid[3, 3] = True
struct = ndi.generate_binary_structure(2, 1)
dilated = ndi.binary_dilation(grid, structure=struct)
assert dilated.sum() == 5
assert bool(dilated[3, 3]) is True
assert bool(dilated[2, 3]) is True
eroded = ndi.binary_erosion(dilated, structure=struct)
assert np.array_equal(eroded, grid)
def test_center_of_mass():
grid = np.array([
[1, 1, 0, 0],
[1, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 1, 1],
], dtype=np.float64)
labeled, _ = ndi.label(grid)
com = ndi.center_of_mass(grid, labels=labeled, index=[1, 2])
assert np.allclose(com[0], (0.5, 0.5))
assert np.allclose(com[1], (2.5, 2.5))
def test_geometric_transforms():
img = np.ones((4, 4), dtype=np.float64)
zoomed = ndi.zoom(img, zoom=2.0)
assert zoomed.shape == (8, 8)
rotated = ndi.rotate(img, angle=90.0, reshape=False)
assert rotated.shape == (4, 4)
def main():
test_gaussian_filter()
test_label_and_find_objects()
test_morphology_dilation_and_erosion()
test_center_of_mass()
test_geometric_transforms()
print("All scipy.ndimage contract assertions passed.")
if __name__ == "__main__":
main()
오리진 시더
익명