diff --git a/ARCTIC/shared-v1.0/doc/validation/full/MEDIA_VALIDATION.md b/ARCTIC/shared-v1.0/doc/validation/full/MEDIA_VALIDATION.md index c81021c161557237a37e0e7c6fb4987755cbb15e..c35eeba92c62b20bb18ad4df5cbbdd16a32c0018 100644 --- a/ARCTIC/shared-v1.0/doc/validation/full/MEDIA_VALIDATION.md +++ b/ARCTIC/shared-v1.0/doc/validation/full/MEDIA_VALIDATION.md @@ -6,6 +6,6 @@ 并行只发生于同一数据集内部的媒体任务;一个序列的数值计算与媒体任务交错,最多一个重型数据集 worker。实测范围、各并行度耗时和可用内存见 [加速验收](acceleration-benchmark.json),实际设置见 [配置](../../../script/acceleration-config.json)。完整像素回归包含 ARCTIC 全分辨率相机及 HOT3D 彩色/灰度相机。 -切换前已完成产物保留原来的逐帧像素证明。旧脚本快照在 `script/history/pre-acceleration-20260920/`;当前脚本在 `script/`。一次性重新核验所有已完成产物的内容摘要和现行结构/valid 规则,记录在 `acceleration-revalidation/`,不修改旧检查点的历史脚本摘要。早期 HOT3D 烟雾测试没有内嵌脚本摘要,重新核验另补全输入资产依赖,不能将其视为当时已记录代码指纹。 +切换前已完成产物保留原来的逐帧像素证明。旧脚本版本由本报告保留的脚本清单与 SHA256、以及仓库固定提交历史追溯;当前入口与冻结实现位于 `script/`。一次性重新核验所有已完成产物的内容摘要和现行结构/valid 规则,记录在 `acceleration-revalidation/`,不修改旧检查点的历史脚本摘要。早期 HOT3D 烟雾测试没有内嵌脚本摘要,重新核验另补全输入资产依赖,不能将其视为当时已记录代码指纹。 以上是自动检查;全量人工确认仍待完成,未授权发布。运行日志只在 tmp,原始包永久保留。 diff --git a/ARCTIC/shared-v1.0/script/README.md b/ARCTIC/shared-v1.0/script/README.md index 1dfaee31c247eb3668e3153d3257066fc6587654..25306bac69b60aece47cdefa51afd249ff492745 100644 --- a/ARCTIC/shared-v1.0/script/README.md +++ b/ARCTIC/shared-v1.0/script/README.md @@ -1,2 +1,28 @@ -运行条件与配置见 ../doc/RAW_TO_SHARED.md。 -模型权重不分发;日志与提取缓存不分发。 +# ARCTIC shared-v1.0 脚本 + +这里仅保留能够解释和复现当前 shared-v1.0 的入口、配置与实现。所有脚本默认假定数据集根目录仍采用生产时的 `raw/`、`shared-v1.0/`、`tmp/` 布局,并要求项目根目录中的 hand-warehouse/1.0 规范与运行环境可用。 + +## 入口 + +- `convert.py`:生产转换/断点续跑入口;无参数时执行原受控队列。 +- `validate.py VIEW`:校验一个相机视图目录的结构、帧映射、张量和媒体声明。 +- `render_review.py`:重建已登记的完整序列试点报告。 +- `config.json`:生产时采用的媒体并行与存储配置快照。 +- `internal/`:上述入口依赖的冻结生产实现;通常无需直接调用。 + + +ARCTIC 的 `internal/correct_arctic_source_fps_metadata.py` 是已执行并发布的 30 FPS 元数据修正工具;它不修改 MKV。对象扩展审核由 `internal/arctic_object_review.py` 与 `internal/finalize_arctic_objects_review.py` 复现。 + +## 常用命令 + +```powershell +python script/convert.py +python script/validate.py +python script/render_review.py +``` + +转换入口保持原来的单实例锁、摘要、空间和断点检查。已完成数据集会按封存记录核验并跳过,不应通过删除状态文件强制重跑。 + +## 历史证据 + +`doc/validation/` 中的脚本清单和 SHA256 描述的是对应生产/验收发生时的代码快照,继续作为历史证据保留。旧代码不再重复放进当前 `script/history/`;远端 Git 提交历史及这些固定指纹可用于追溯。运行日志、上传状态、缓存和临时文件属于 `tmp/`,不在本目录发布。 diff --git a/ARCTIC/shared-v1.0/script/acceleration-config.json b/ARCTIC/shared-v1.0/script/config.json similarity index 100% rename from ARCTIC/shared-v1.0/script/acceleration-config.json rename to ARCTIC/shared-v1.0/script/config.json diff --git a/ARCTIC/shared-v1.0/script/convert.py b/ARCTIC/shared-v1.0/script/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f4d97c36b184636fb6bf71538f3da7c35b061d2e --- /dev/null +++ b/ARCTIC/shared-v1.0/script/convert.py @@ -0,0 +1,14 @@ +"""Resume the verified ARCTIC production queue.""" +from pathlib import Path +import argparse, os, runpy, sys +q=argparse.ArgumentParser(description='Resume the ARCTIC conversion queue using its existing plan and checkpoints.') +q.add_argument('--mode',choices=['run','migrate'],default='run') +q.add_argument('--sequence',help='advanced: process exactly one source sequence') +a=q.parse_args() +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE/'internal')) +os.environ['HAND_DATASET_SCOPE']='ARCTIC' +if a.sequence: sys.argv=[sys.argv[0],'worker','--dataset','ARCTIC','--sequence',a.sequence] +elif a.mode=='migrate': sys.argv=[sys.argv[0],'migrate','--dataset','ARCTIC'] +else: sys.argv=[sys.argv[0],'run'] +runpy.run_path(str(HERE/'internal'/'preprocess_fresh_full.py'),run_name='__main__') diff --git a/ARCTIC/shared-v1.0/script/diagnose_hot3d_alignment.py b/ARCTIC/shared-v1.0/script/diagnose_hot3d_alignment.py deleted file mode 100644 index 900891a64a5423524cebe337443877682f357cdb..0000000000000000000000000000000000000000 --- a/ARCTIC/shared-v1.0/script/diagnose_hot3d_alignment.py +++ /dev/null @@ -1,47 +0,0 @@ -"""Independent native pose/bbox checks for the HOT3D opening-frame complaint.""" -from fresh_sequence_common import * -from review_fresh_sequence_pilots import arr - -def pose(row): - T=np.eye(4);T[:3,:3]=Rotation.from_quat([float(row['q_wo_'+k]) for k in 'xyzw']).as_matrix();T[:3,3]=[float(row['t_wo_'+k+'[m]']) for k in 'xyz'];return T - -def rows(z,name):return list(csv.DictReader(io.StringIO(z.read(name).decode()))) - -def diagnose(): - base=DATA_ROOT/'HOT3D';root=base/RELEASE;seq='P0015_179e1b84';src=base/'raw/data/Aria'/seq;cache=base/'tmp/full-video-review-v2/diagnostic';doc=root/'doc/validation' - with zipfile.ZipFile(next(src.glob('*ground_truth.zip'))) as z: - cams=json.loads(z.read('camera_models.json'));heads={int(r['timestamp[ns]']):pose(r) for r in rows(z,'headset_trajectory.csv')} - objects={(int(r['timestamp[ns]']),r['object_uid']):pose(r) for r in rows(z,'dynamic_objects.csv')};boxes=rows(z,'box2d_objects.csv');masks=rows(z,'masks/mask_qa_pass.csv') - diagnostics=[];plate='248247003992116' - for c in cams: - cam=c['stream_id'];p=root/'data'/seq/cam;fr=[json.loads(x) for x in (p/'camera/frames.jsonl').read_text().splitlines()];meta=load(p/'metainfo.json') - dc=c['T_Device_Camera'];Tdc=np.eye(4);Tdc[:3,:3]=Rotation.from_quat(np.roll(dc['quaternion_wxyz'],-1)).as_matrix();Tdc[:3,3]=dc['translation_xyz'] - nativeE=np.stack([np.linalg.inv(heads[f['timecode_ns']]@Tdc) for f in fr]);storedE=arr(p/'camera/extrinsic.pt');eerr=float(np.max(np.abs(nativeE-storedE)));assert eerr<2e-6 - rawhead=np.stack([heads[f['timecode_ns']] for f in fr]);firstchange=next(i for i in range(len(fr)) if not np.array_equal(rawhead[i],rawhead[0])) - op=p/'annotation/object'/plate;om=load(op/'metainfo.json');mesh=trimesh.load(p/om['original_glb_ref'],process=False,force='mesh');v=np.asarray(mesh.vertices) - storedP=arr(cache/cam/'annotation/object'/plate/'pose.pt');qa={int(r['timestamp[ns]']):r['mask']=='True' for r in masks if r['stream_id']==cam} - lookup={int(r['timestamp[ns]']):r for r in boxes if r['stream_id']==cam and r['object_uid']==plate} - tests=[] - for i in [0,1,26,27,179,180,253,507,760]: - ts=fr[i]['timecode_ns'];P=nativeE[i]@objects[(ts,plate)];error=float(np.max(np.abs(P-storedP[i])));assert error<2e-6 - xyz=v@P[:3,:3].T+P[:3,3];uv=project_points(xyz,'fisheye624',c['projectionParams']);good=np.isfinite(uv).all(1) - box=lookup.get(ts);diff=None;expected=None - if box and box['x_min[pixel]'] and good.all(): - expected=np.array([float(box[k]) for k in ['x_min[pixel]','y_min[pixel]','x_max[pixel]','y_max[pixel]']]);bb=np.r_[uv.min(0),uv.max(0)];diff=float(np.max(np.abs(expected-bb))) - tests.append({'frame_index':i,'source_frame_id':fr[i]['source_frame_id'],'official_qa_pass':qa[ts],'native_vs_cached_pose_max_abs':error,'source_plate_bbox_vs_projection_max_pixel':diff}) - if i in [0,180]: - files=sorted((base/'tmp'/RUN/seq/'images').glob(cam+'-*.jpg'));image=np.asarray(Image.open(files[i]).convert('RGB')).copy() - if expected is not None:cv2.rectangle(image,tuple(expected[:2].astype(int)),tuple(expected[2:].astype(int)),(255,235,0),2) - inds=np.arange(0,len(uv),max(1,len(uv)//5000));pix=uv[inds];ok=np.isfinite(pix).all(1)&(pix[:,0]>=0)&(pix[:,0]=0)&(pix[:,1]/pose.pt [1014,4,4] | 源 world_from_object 转 camera_from_object;米,固定实例UID在序列各相机间保持对应 | -| ground_truth.zip:box2d_objects.csv 的 visibility_ratio[%] | 各物体 visibility.pt [1014] | 比例与独立有效性,归所属物体组件属性 | -| assets/hot3d_models.zip 的 BOP PLY+PNG+models_info.json | object//assets/*.obj、MTL、纹理 | BOP id 通过 original_id 对应原UID;PLY顶点mm→m。检查尺寸、三角形及纹理像素往返一致 | -| assets/object_models/obj_*.glb | 各物体 assets 中原生材质伴随资产 | 按 BOP id 对齐,原文件字节不变,保留可能超出 OBJ/MTL 的材质信息;标准 mesh_ref 始终指向米制 OBJ | - -本序列使用6个物体:spatula_red、potato_masher、can_parmesan、plate_bamboo、carton_oj、bottle_ranch。部件为刚体,未伪造机械关节。图像/手/物体的标注匹配与最大误差在各帧 annotation_matches 明确保存。整手/物体 visibility 的源时间匹配阈值另在属性 source_locator 声明。 - -缺省与选择:无深度相机流;`masks/*.csv` 是帧条件,不是像素分割,QA已合入手/物体valid及依赖姿态的visibility有效性。没有额外生成接触、手关键点或独立hand_mesh。UmeTrack参数、MPS在线相机与SLAM轨迹保留在raw;本版shared选择MANO和ground_truth内相机参数。依据固定提交官方README的参与者划分,P0015属于train,metainfo记录来源。 - -转换语义依据 HOT3D 官方固定提交 [`146b34a`](https://github.com/facebookresearch/hot3d/tree/146b34afef8c1a32adeef7e981c070109f225c87) 的 `mano_layer.py`、`loader_hand_poses.py`、`AriaDataProvider.py`。物体包依据官方 BOP HOT3D仓库固定提交 [`30fe967`](https://huggingface.co/datasets/bop-benchmark/hot3d/tree/30fe9674782f32e1e5edba98476b6ff4300132c5)。Fisheye624预览按Project Aria官方FisheyeRadTanThinPrism公式实现;内参原值不修改。 -''' - -if __name__=='__main__': - for dataset,text in [('ARCTIC',ARCTIC),('HOT3D',HOT)]: - root=DATA_ROOT/dataset/RELEASE - (root/'doc/RAW_TO_SHARED.md').write_text(text+COMMON,encoding='utf-8') - shutil.copyfile(Path(__file__),root/'script'/Path(__file__).name) - (root/'script/README.md').write_text('运行条件与配置见 ../doc/RAW_TO_SHARED.md。\n模型权重不分发;日志与提取缓存不分发。\n',encoding='utf-8') - print('DOCUMENTED',dataset) diff --git a/ARCTIC/shared-v1.0/script/finalize_fresh_sequence_review.py b/ARCTIC/shared-v1.0/script/finalize_fresh_sequence_review.py deleted file mode 100644 index 06b629a9af67ecea87e9692de2b5f631995a4458..0000000000000000000000000000000000000000 --- a/ARCTIC/shared-v1.0/script/finalize_fresh_sequence_review.py +++ /dev/null @@ -1,48 +0,0 @@ -"""Check full-video artifacts; never infer visual acceptance from numeric success.""" -from fresh_sequence_common import * -from review_fresh_sequence_pilots import validate_view, arr -from html.parser import HTMLParser - -class Links(HTMLParser): - def __init__(self):super().__init__();self.refs=[];self.videos=[] - def handle_starttag(self,tag,attrs): - a=dict(attrs) - for k in ['href','src']: - if a.get(k):self.refs.append(a[k]) - if tag=='video':self.videos.append(a.get('src')) - -def finalize(): - for ds,n in [('ARCTIC',9),('HOT3D',3)]: - root=DATA_ROOT/ds/RELEASE;doc=root/'doc/validation';r=load(doc/'report.json') - assert r['human_review']=='pending' and len(r['full_video_views'])==n - parser=Links();parser.feed((doc/'index.html').read_text(encoding='utf-8')) - assert len(parser.videos)==n+len(r['asset_previews']) - for ref in parser.refs: - if not ref.startswith(('http:','https:','#')):assert (doc/ref).is_file(),ref - for view in r['full_video_views']: - file=doc/view['video_ref'];assert digest(file)==view['video_sha256'] - assert len(framehash(['-i',str(file)],copy=True))==view['frames']==view['rendered_frames'] - for p in (root/'data').glob('*/*/metainfo.json'):validate_view(p.parent) - if ds=='ARCTIC': - with zipfile.ZipFile(DATA_ROOT/ds/'raw/data/meta.zip') as z:raw=np.asarray(json.loads(z.read('meta/object_vtemplates/laptop/parts.json')),np.int64) - for mp in (root/'data/s09_laptop_use_03').glob('*/metainfo.json'): - p=mp.parent;m=load(mp);assert np.array_equal(arr(p/'annotation/object/laptop/vertex_part_ids.pt'),1-raw) - for c in m['components'].values(): - if c.get('valid_policy',{}).get('local_excluded_frame_indices'): - indices=c['valid_policy']['local_excluded_frame_indices'];assert not arr(p/c['valid_ref'])[indices].any() - assert m['acceptance']['training_release_approved'] is False - r['stage']='blocked_pending_visual_review';r['agent_visual_inspection']={'status':'known_residual_hand_alignment_issue','scope':'user screenshots, camera6 frame270 before/after, source exposure contact sheets and selected video snapshots','remaining':'full-camera sequence human acceptance; no claim of all-frame visual pass'} - else: - r['agent_visual_inspection']={'status':'source_QA_failures_excluded_new_full_video_review_pending','scope':'official QA, independent native pose/bbox checks; diagnostic snapshots','remaining':'human review of full sequence'} - for p in (root/'script').glob('*.py'):compile(p.read_text(encoding='utf-8-sig'),str(p),'exec') - assert not list(root.rglob('*.log')) and not list((root/'data').rglob('hand_mesh*')) - r['offline_artifact_check']={'relative_links':'passed','full_camera_videos':n,'frames':sum(v['frames'] for v in r['full_video_views']),'video_hash_and_frame_counts':'passed','tensor_validity_and_refs':'passed','script_compile':'passed','visual_acceptance':'not_granted'} - save(doc/'report.json',r);save(doc/'status.json',{'stage':r['stage'],'human_review':'pending','full_preprocessing_authorized':False,'upload_authorized':False}) - shutil.copyfile(Path(__file__),root/'script'/Path(__file__).name) - print(ds,'ARTIFACT_CHECK_PASSED','human acceptance remains pending',flush=True) - p=WORK/'tmp/dataset-work-state.json';state=load(p) - for ds in ['ARCTIC','HOT3D']: - state['active'][ds].update(stage='blocked_pending_visual_review' if ds=='ARCTIC' else 'pilot_full_video_awaiting_human_review',human_sample_review='pending',full_preprocessing_authorized=False,upload_authorized=False) - save(p,state) - -if __name__=='__main__':finalize() diff --git a/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/apply_hot3d_qa.py b/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/apply_hot3d_qa.py deleted file mode 100644 index 942ced8b3d5b27195bd14b959a20d07e92c5ed9b..0000000000000000000000000000000000000000 --- a/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/apply_hot3d_qa.py +++ /dev/null @@ -1,65 +0,0 @@ -"""Apply native HOT3D manual QA to supervision validity, preserving raw diagnostics.""" -from fresh_sequence_common import * - -VIDEO_RUN='full-video-review-v2' -SEQ='P0015_179e1b84' - -def csvrows(z,name):return list(csv.DictReader(io.StringIO(z.read(name).decode()))) - -def apply_qa(sequence=None,publish=True): - seq=sequence or SEQ - base=DATA_ROOT/'HOT3D';root=base/RELEASE;src=base/'raw/data/Aria'/seq - gtfile=next(src.glob('*ground_truth.zip'));qa_report={} - with zipfile.ZipFile(gtfile) as z: - masks=csvrows(z,'masks/mask_qa_pass.csv');hands=csvrows(z,'box2d_hands.csv');objects=csvrows(z,'box2d_objects.csv') - for meta in sorted((root/'data'/seq).glob('*/metainfo.json')): - p=meta.parent;m=load(meta);cam=m['camera_id'];T=m['num_frames'];frames=[json.loads(x) for x in (p/'camera/frames.jsonl').read_text().splitlines()] - cache=base/'tmp'/VIDEO_RUN/'diagnostic'/(cam if seq==SEQ else seq+'/'+cam) - if (cache/'snapshot.json').exists():assert Path(load(cache/'snapshot.json')['source_view']).resolve()==p.resolve() - if not (cache/'snapshot.json').exists(): - cache.mkdir(parents=True,exist_ok=True) - for file in p.rglob('*.pt'): - target=cache/file.relative_to(p);target.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(file,target) - save(cache/'metainfo.json',m);save(cache/'snapshot.json',{'purpose':'pre-QA native parameter diagnostics only; not shared usable labels','source_view':str(p),'frames':T}) - lookup={int(r['timestamp[ns]']):r['mask']=='True' for r in masks if r['stream_id']==cam} - qa=np.array([lookup[f['timecode_ns']] for f in frames],bool) - source={'archive':gtfile.relative_to(base).as_posix(),'member':'masks/mask_qa_pass.csv','stream_id':cam,'time_index_ref':'camera/frames.jsonl:timecode_ns'} - policy={'semantics':'usable_annotation','formula':'source_annotation_present AND source_numerically_valid AND official_manual_qa_pass', - 'qa_scope':'all visible hand/object poses in this camera frame; conservatively exclude all hand/object supervision if false', - 'source_locator':source,'no_qa_source_rule':'use the component source-validity rules; do not invent QA'} - for key,c in m['components'].items(): - # Camera calibration and RGB are not labels covered by this manual hand/object QA flag. - if key=='mano' or c['schema_id'] in ['object/rigid/v1','object/joint_state/v1','object_keypoints/camera/v1']: - values=torch.load(cache/c['data_ref'],weights_only=True).numpy();present=torch.load(cache/c['valid_ref'],weights_only=True).numpy() - valid=present & qa.reshape((T,)+(1,)*(present.ndim-1));values=values.copy();values[~valid]=np.nan - tensor(p/c['data_ref'],values);tensor(p/c['valid_ref'],valid);c['valid_policy']=policy - for attrname,a in c.get('attributes',{}).items(): - if attrname!='visibility':continue - ishand=key=='mano';oid=c['source_locator'].get('object_uid');ids=[0,1] if ishand else [oid] - rows=hands if ishand else objects;identity='hand_index' if ishand else 'object_uid' - native={(int(r['timestamp[ns]']),str(r[identity])):float(r['visibility_ratio[%]']) for r in rows if r['stream_id']==cam and r['visibility_ratio[%]']!=''} - values=np.array([[native.get((f['timecode_ns'],str(k)),np.nan) for k in ids] for f in frames],np.float32) - if not ishand:values=values[:,0] - present=np.isfinite(values);assert ((values[present]>=0)&(values[present]<=1)).all() - # Correct the diagnostic copy as well: these values are fractions, despite the source header. - tensor(cache/a['data_ref'],values);tensor(cache/a['valid_ref'],present) - valid=present & qa.reshape((T,)+(1,)*(present.ndim-1));filtered=values.copy();filtered[~valid]=np.nan - tensor(p/a['data_ref'],filtered);tensor(p/a['valid_ref'],valid) - a['provenance']={'kind':'source','method':'native [0,1] ratio retained; official loader does not divide misleading [%] header by 100'} - a['valid_policy']={'semantics':'usable_visibility_annotation','formula':'source_ratio_present AND official_manual_qa_pass','source_locator':source} - a['source_locator']['match_method']='exact' - m['validity_revision']='usable-annotation-2026-09-20' - m['split']='train';m['split_scheme']='HOT3D_official_participant_split';m.pop('split_reason',None) - m['split_source_locator']={'url':'https://github.com/facebookresearch/hot3d/blob/146b34afef8c1a32adeef7e981c070109f225c87/README.md#testtrain-split','participant_id':seq.split('_')[0]} - assert seq.split('_')[0] not in {'P0004','P0005','P0006','P0008','P0016','P0020'} - save(meta,m) - qa_report[cam]={'frames':T,'qa_pass':qa.tolist(),'passed_count':int(qa.sum()),'source_locator':source, - 'interpretation':'manual QA of visible hand/object poses; not RGB validity or individual error localization'} - print('QA_APPLIED',cam,'pass',int(qa.sum()),'fail',int((~qa).sum()),flush=True) - save(root/'doc/validation/source_qa.json' if publish else base/'tmp'/RUN/'qa'/f'{seq}.json',qa_report) - if publish: - for f in ['apply_hot3d_qa.py','fresh_sequence_common.py','convert_fresh_sequence_pilots.py']: - shutil.copyfile(WORK/'scripts'/f,root/'script'/f) - return qa_report - -if __name__=='__main__':apply_qa() diff --git a/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/convert_fresh_sequence_pilots.py b/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/convert_fresh_sequence_pilots.py deleted file mode 100644 index ba9baf7b2f8e28ff41bd022f53bb4def194f3224..0000000000000000000000000000000000000000 --- a/ARCTIC/shared-v1.0/script/history/pre-acceleration-20260920/convert_fresh_sequence_pilots.py +++ /dev/null @@ -1,344 +0,0 @@ -"""Convert one complete, freshly downloaded sequence per dataset, all cameras. - -Run: python scripts/convert_fresh_sequence_pilots.py ARCTIC|HOT3D -Requires the local CPU runtime and licensed MANO models described in README.md. -No full-dataset conversion or upload is performed by this entry point. -""" -from fresh_sequence_common import * -from pilot_hot_normalize import csv_transform, transform -import concurrent.futures - -ARCTIC_SEQ='s09/laptop_use_03' -HOT3D_SEQ='P0015_179e1b84' - -def loadzipcsv(z,name):return list(csv.DictReader(io.StringIO(z.read(name).decode()))) - -def expand(rows,indices,shape): - a=np.full(shape,np.nan);good=(indices>=0)&(indices