Subsampling nwb - #78
Conversation
cycles per trial independent of whether scan is patch or pointing I've tested that new version of code give the same result as earlier for sample_miniscan_fred....
ageorgou
left a comment
There was a problem hiding this comment.
Looks good, apart from the TDMS reading order (see comment).
Otherwise, find_used_planes may also need to be updated as I think it always return an empty list right now. This doesn't matter much because its output is only used in copy_pockels_file (where it's ignored anyway, see below) and copy_zstack (and I think it's fine to not include those images?)
Unrelated to these changes, but it looks like the copy_pockels_file is copying the whole file (which may be what we need, if we want to retain all the Zstack "locations", but in that case could be simplified a bit)
| n_all_trials = len(nwb['/intervals/trials/id']) | ||
| return np.int(nwb['acquisition/ROI_001_Red/timestamps'].shape[0] / n_all_trials) |
There was a problem hiding this comment.
Can we get this directly from nwb['general/silverlab_optophysiology/cycles_per_trial']?
| for roi_index, roi_to_keep in enumerate(all_rois[0:nrois]): | ||
| starts = np.arange(cycles_per_trial(nwb)) * total_pixels + previous_pixels[roi_index] | ||
| stops = starts + all_roi_pixels[roi_index] | ||
| inds = np.array([np.arange(start, stop) for (start, stop) in zip(starts, stops)]) | ||
| ch_data = ch_obj.data[inds].flatten() | ||
| subset = np.concatenate((subset, ch_data)) |
There was a problem hiding this comment.
So this gets all the data for one ROI across all cycles, then appends the data for the next ROI for all cycles etc, but the original TDMS is structured the other way around: it has data for all ROIs for the first cycle, then all ROIs for the second cycle etc. This may be why we the sampled file is not consistent with the original!
May be wrong! Previous version had all data from the first ROI followed by the second etc, but the original TDMS stores data in complete cycles (first cycle for all ROIs, then second cycle for all ROIs etc). This is a bit less general than the previous version, which could have been easily adapted for non-consecutive ROIs. However, the whole file is based on the assumption that we are keeping only the first N ROIs, so the simplification is probably worth the loss of generality in one function...
|
I've pushed some changes which I think should read things in the right order, but I haven't tried them! (the second commit should do the same, but removing some loops) |
this ensures the dimensions listed ROI.dat and those of the TDMS data are consistent with each other.
e.g. so we don't have to start from ROI 1.
No description provided.