diff --git a/acpreprocessing/stitching_modules/acstitch/zarrutils.py b/acpreprocessing/stitching_modules/acstitch/zarrutils.py index 06234ab..9af58ec 100644 --- a/acpreprocessing/stitching_modules/acstitch/zarrutils.py +++ b/acpreprocessing/stitching_modules/acstitch/zarrutils.py @@ -1,5 +1,6 @@ import pathlib import zarr +import json def get_zarr_group(zpath,grpname): # key to working with zarr files @@ -17,4 +18,11 @@ def get_group_from_src(srcpath, return get_zarr_group(p.parent,p.name) else: print(str(p) + " not found!") - return None \ No newline at end of file + return None + +def get_src_from_json(sourcejson,plane,tile): + with open(sourcejson,'r') as f: + js = json.load(f) + srcList = js[plane]['sources'] + ind = [s.split("_")[-1] for s in srcList].index(tile) + return srcList[ind] \ No newline at end of file