Skip to content

Commit 5b52ce6

Browse files
authored
Merge pull request #171 from NeurodataWithoutBorders/preloaded_ros3_zarr
2 parents 2b3d831 + 7e5ad20 commit 5b52ce6

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

src/nwb_benchmarks/benchmarks/network_tracking_remote_slicing.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,25 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
312312
self.data_to_slice = self.neurodata_object.data
313313

314314

315+
class HDF5PyNWBROS3PreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
316+
"""
317+
Time the read of a continuous data slice from remote HDF5 NWB files using pynwb and the ROS3 driver with preloaded
318+
data.
319+
"""
320+
321+
params = hdf5_params
322+
323+
def setup(self, params: dict[str, str | Tuple[slice]]):
324+
https_url = params["https_url"]
325+
object_name = params["object_name"]
326+
slice_range = params["slice_range"]
327+
328+
self.nwbfile, self.io, _ = read_hdf5_pynwb_ros3(https_url=https_url)
329+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
330+
self.data_to_slice = self.neurodata_object.data
331+
self._temp = self.data_to_slice[slice_range]
332+
333+
315334
class LindiLocalJSONContinuousSliceBenchmark(ContinuousSliceBenchmark):
316335
"""
317336
Time the read of a continuous data slice from remote HDF5 NWB files by reading the local LINDI JSON files with
@@ -350,6 +369,24 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
350369
self.data_to_slice = self.neurodata_object.data
351370

352371

372+
class ZarrPyNWBS3PreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
373+
"""
374+
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 with preloaded data.
375+
"""
376+
377+
params = zarr_params
378+
379+
def setup(self, params: dict[str, str | Tuple[slice]]):
380+
https_url = params["https_url"]
381+
object_name = params["object_name"]
382+
slice_range = params["slice_range"]
383+
384+
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r")
385+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
386+
self.data_to_slice = self.neurodata_object.data
387+
self._temp = self.data_to_slice[slice_range]
388+
389+
353390
class ZarrPyNWBS3ForceNoConsolidatedContinuousSliceBenchmark(ContinuousSliceBenchmark):
354391
"""
355392
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 and without using
@@ -365,3 +402,22 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
365402
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r-")
366403
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
367404
self.data_to_slice = self.neurodata_object.data
405+
406+
407+
class ZarrPyNWBS3ForceNoConsolidatedPreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
408+
"""
409+
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 and without using
410+
consolidated metadata with preloaded data.
411+
"""
412+
413+
params = zarr_params
414+
415+
def setup(self, params: dict[str, str | Tuple[slice]]):
416+
https_url = params["https_url"]
417+
object_name = params["object_name"]
418+
slice_range = params["slice_range"]
419+
420+
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r-")
421+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
422+
self.data_to_slice = self.neurodata_object.data
423+
self._temp = self.data_to_slice[slice_range]

src/nwb_benchmarks/benchmarks/time_remote_slicing.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,25 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
300300
self.data_to_slice = self.neurodata_object.data
301301

302302

303+
class HDF5PyNWBROS3PreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
304+
"""
305+
Time the read of a continuous data slice from remote HDF5 NWB files using pynwb and the ROS3 driver with preloaded
306+
data.
307+
"""
308+
309+
params = hdf5_params
310+
311+
def setup(self, params: dict[str, str | Tuple[slice]]):
312+
https_url = params["https_url"]
313+
object_name = params["object_name"]
314+
slice_range = params["slice_range"]
315+
316+
self.nwbfile, self.io, _ = read_hdf5_pynwb_ros3(https_url=https_url)
317+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
318+
self.data_to_slice = self.neurodata_object.data
319+
self._temp = self.data_to_slice[slice_range]
320+
321+
303322
class LindiLocalJSONContinuousSliceBenchmark(ContinuousSliceBenchmark):
304323
"""
305324
Time the read of a continuous data slice from remote HDF5 NWB files by reading the local LINDI JSON files with
@@ -338,6 +357,24 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
338357
self.data_to_slice = self.neurodata_object.data
339358

340359

360+
class ZarrPyNWBS3PreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
361+
"""
362+
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 with preloaded data.
363+
"""
364+
365+
params = zarr_params
366+
367+
def setup(self, params: dict[str, str | Tuple[slice]]):
368+
https_url = params["https_url"]
369+
object_name = params["object_name"]
370+
slice_range = params["slice_range"]
371+
372+
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r")
373+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
374+
self.data_to_slice = self.neurodata_object.data
375+
self._temp = self.data_to_slice[slice_range]
376+
377+
341378
class ZarrPyNWBS3ForceNoConsolidatedContinuousSliceBenchmark(ContinuousSliceBenchmark):
342379
"""
343380
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 and without using
@@ -353,3 +390,22 @@ def setup(self, params: dict[str, str | Tuple[slice]]):
353390
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r-")
354391
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
355392
self.data_to_slice = self.neurodata_object.data
393+
394+
395+
class ZarrPyNWBS3ForceNoConsolidatedPreloadedContinuousSliceBenchmark(ContinuousSliceBenchmark):
396+
"""
397+
Time the read of a continuous data slice from remote Zarr NWB files using pynwb with S3 and without using
398+
consolidated metadata with preloaded data.
399+
"""
400+
401+
params = zarr_params
402+
403+
def setup(self, params: dict[str, str | Tuple[slice]]):
404+
https_url = params["https_url"]
405+
object_name = params["object_name"]
406+
slice_range = params["slice_range"]
407+
408+
self.nwbfile, self.io = read_zarr_pynwb_s3(https_url=https_url, mode="r-")
409+
self.neurodata_object = get_object_by_name(nwbfile=self.nwbfile, object_name=object_name)
410+
self.data_to_slice = self.neurodata_object.data
411+
self._temp = self.data_to_slice[slice_range]

0 commit comments

Comments
 (0)