Skip to content

Commit

Permalink
Merge pull request #2468 from AllenInstitute/ticket/2306
Browse files Browse the repository at this point in the history
tolist() can be expensive; use list comprehension instead which is fas…
  • Loading branch information
aamster authored Jun 9, 2022
2 parents fdcdec1 + 67a59ae commit 6f74fdc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def from_nwb(cls, nwbfile: NWBFile) \
# We want rois x timepoints, hence the transpose
f_traces = corr_fluorescence_nwb.data[:].T.copy()
roi_ids = corr_fluorescence_nwb.rois.table.id[:].copy()
df = pd.DataFrame({'corrected_fluorescence': f_traces.tolist()},
df = pd.DataFrame({'corrected_fluorescence': [x for x in f_traces]},
index=pd.Index(
data=roi_ids,
name='cell_roi_id'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def from_nwb(cls, nwbfile: NWBFile) -> "DFFTraces":
# We want rois x timepoints, hence the transpose
dff_traces = dff_nwb.data[:].T

df = pd.DataFrame({'dff': dff_traces.tolist()},
df = pd.DataFrame({'dff': [x for x in dff_traces]},
index=pd.Index(data=dff_nwb.rois.table.id[:],
name='cell_roi_id'))
return DFFTraces(traces=df)
Expand Down

0 comments on commit 6f74fdc

Please sign in to comment.