Skip to content

Commit

Permalink
implementing pathlib instead of os
Browse files Browse the repository at this point in the history
  • Loading branch information
kttakasaki committed Sep 14, 2023
1 parent 1d7fe71 commit ae0e3c7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions acpreprocessing/stitching_modules/acstitch/zarrutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import pathlib
import zarr

def get_zarr_group(zpath,grpname):
Expand All @@ -7,10 +7,14 @@ def get_zarr_group(zpath,grpname):
zf = zarr.open(zpath)
return zf[grpname]

def get_group_from_src(srcpath):
def get_group_from_src(srcpath,
outpath='zarr://http://bigkahuna.corp.alleninstitute.org/ACdata', # Url for ACdata for NG hosted on BigKahuna
inpath = 'J:'):
# returns zarr group given a neuroglancer source path
# used to get datasets from neuroglancer layer json
pathout = 'zarr://http://bigkahuna.corp.alleninstitute.org/ACdata' # Url for ACdata for NG hosted on BigKahuna
pathin = 'J:' # Local path to ACdata
s = os.path.split(srcpath.replace(pathout,pathin))
return get_zarr_group(zpath=s[0],grpname=s[1])
p = pathlib.Path(srcpath.replace(outpath,inpath))
if p.exists():
return get_zarr_group(p.parent,p.name)
else:
print(str(p) + " not found!")
return None

0 comments on commit ae0e3c7

Please sign in to comment.