-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align the starting_time
of the processed fiber photometry data
#29
Conversation
…d and align the starting time
Example 20200205-0001.nwb: |
I'll first test this for all sessions and then reopen, sorry for pinging too early @alessandratrapani |
src/dombeck_lab_to_nwb/azcorra2023/interfaces/azcorra2023_processedfiberphotometryinterface.py
Outdated
Show resolved
Hide resolved
…essedfiberphotometryinterface.py
@alessandratrapani I think this is ready for review (we can discuss in our next meeting if something is unclear), also will add this as a note for the mid-way meeting to double check with them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is clear to me. Looks good!
def get_original_timestamps(self) -> np.ndarray: | ||
binned_photometry_data = read_mat(filename=str(self.file_path))["#subsystem#"]["MCOS"][2] | ||
channel_index = self.column_names.index("chMov") | ||
data = binned_photometry_data[channel_index] | ||
if len(self.depth_ids) > 1: | ||
data = data[self.depth_index] | ||
num_frames = len(data) | ||
return np.arange(num_frames) / self._sampling_frequency | ||
|
||
def get_timestamps(self, stub_test: bool = False) -> np.ndarray: | ||
timestamps = self._timestamps if self._timestamps is not None else self.get_original_timestamps() | ||
if stub_test: | ||
return timestamps[:6000] | ||
return timestamps | ||
|
||
def set_aligned_timestamps(self, aligned_timestamps: np.ndarray) -> None: | ||
self._timestamps = np.array(aligned_timestamps) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at the converted files I noticed that some recordings might be cropped (the picoscope data was longer than the processed data). After digging into their processing code I found out that in some cases they were cropping the beginning of the recording and saving the crop point named "cropStart".
I'm using this variable to align the starting time of the processed interface, so we are saving the processed behavior data and fiber photometry data with the correct starting time.