Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandratrapani committed Oct 9, 2024
1 parent a96f063 commit a2010bd
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def __init__(self, folder_path: PathType):
self._roi_response_baseline = self._trace_extractor_read(field="b0")
self._roi_response_neuropil = self._trace_extractor_read(field="f")
self._roi_response_deconvolved = self._trace_extractor_read(field="S")
self._image_maximum_projection = self._file_extractor_read("/max_proj.zarr/max_proj")
# TODO add extraction of motion correction
self._image_maximum_projection = np.array(self._file_extractor_read("/max_proj.zarr/max_proj"))
self._image_masks = self._roi_image_mask_read()
self._background_image_masks = self._background_image_mask_read()
self._times = self._timestamps_extractor_read()
Expand All @@ -61,7 +60,7 @@ def _file_extractor_read(self, zarr_group=""):
warnings.warn(f"Group '{zarr_group}' not found in the Zarr store.", UserWarning)
return None
else:
return zarr.open(self.folder_path + f"/{zarr_group}", "r")
return zarr.open(str(self.folder_path) + f"/{zarr_group}", "r")

def _roi_image_mask_read(self):
"""Read the image masks from the zarr output.
Expand Down Expand Up @@ -104,7 +103,6 @@ def _trace_extractor_read(self, field):
trace: numpy.ndarray
The traces specified by the field.
"""

dataset = self._file_extractor_read(f"/{field}.zarr")

if dataset is None or field not in dataset:
Expand All @@ -119,16 +117,15 @@ def _timestamps_extractor_read(self):
Returns
-------
list
np.ndarray
The timestamps of the denoised trace.
"""

csv_file = self.folder_path + "timeStamps.csv"
csv_file = self.folder_path / "timeStamps.csv"
df = pd.read_csv(csv_file)
frame_numbers = self._file_extractor_read("/C.zarr/frame")
filtered_df = df[df['Frame Number'].isin(frame_numbers)]
filtered_df = df[df['Frame Number'].isin(frame_numbers)]*1e-3

return filtered_df['Time Stamp (ms)'].tolist()
return filtered_df['Time Stamp (ms)'].to_numpy()

def get_image_size(self):
dataset = self._file_extractor_read("/A.zarr")
Expand Down

0 comments on commit a2010bd

Please sign in to comment.