Skip to content

[datetime] Keep track of recording time trough the different processes#868

Open
Edouard2laire wants to merge 24 commits into
brainstorm-tools:masterfrom
Edouard2laire:time-process
Open

[datetime] Keep track of recording time trough the different processes#868
Edouard2laire wants to merge 24 commits into
brainstorm-tools:masterfrom
Edouard2laire:time-process

Conversation

@Edouard2laire
Copy link
Copy Markdown
Collaborator

@Edouard2laire Edouard2laire commented Dec 10, 2025

This makes sure all the common processes affect the date of acquisition well

  • Synchronize recordings
    Done. I also added some information in the history about the offset between files.

  • Combine recordings

Note: For synchronizing and combining recordings, I had to use a user-interaction to find what is the correct date when multiple dates are present. This won't work if those two processes are called from a. script. Is there a better way to do it?

@Edouard2laire Edouard2laire marked this pull request as ready for review December 11, 2025 23:57
@Edouard2laire Edouard2laire marked this pull request as draft February 3, 2026 16:55
@Edouard2laire
Copy link
Copy Markdown
Collaborator Author

Moving to draft. This will need to be adjusted once #880 is merged.

Comment thread toolbox/process/functions/process_timeoffset.m Outdated
Comment thread toolbox/process/functions/process_timeoffset.m Outdated
Comment thread toolbox/process/functions/process_timeoffset.m Outdated
@Edouard2laire Edouard2laire marked this pull request as ready for review April 9, 2026 16:57
@Edouard2laire
Copy link
Copy Markdown
Collaborator Author

Ok. It's ready for review.

@Edouard2laire Edouard2laire deleted the time-process branch April 14, 2026 17:35
@Edouard2laire Edouard2laire restored the time-process branch April 16, 2026 23:46
@Edouard2laire Edouard2laire reopened this Apr 16, 2026
@Edouard2laire
Copy link
Copy Markdown
Collaborator Author

Sems i made a manipulation error that lead to the closure of the PR. re-openning :)

Comment on lines +113 to +118
file_str = cell(length(sInputs), 1);
for iFile = 1:length(sInputs)
file_str{iFile} = sprintf('%s : %s', sInputs(iFile).Condition, sMetaData(iFile).F.t0);
end
ind = java_dialog('radio', 'Select the acquisition date:', 'Acquisition date', [], file_str, 1);
NewT0 = sMetaData(ind).F.t0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A process call should not have interactive parts, this stops the execution of pipelines.

A decision should be taken in the case or more than one T0, either a new one or one of the existent (the one for the first file?)

Comment thread toolbox/process/functions/process_combine_recordings.m Outdated
Comment on lines +231 to +239
iInput = find(has_T0);
file_str = cell(length(iInput), 1);
for iFile = 1:length(iInput)
file_str{iFile} = sprintf('%s : %s', sInputs(iInput(iFile)).Condition, sOldTiming{iInput(iFile)}.T0);
end
ind = java_dialog('radio', 'Select the acquisition date:', 'Acquisition date', [], file_str, 1);
iInput = iInput(ind);
ts0 = datetime(sOldTiming{iInput}.T0, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss.SSS');
new_T0 = str_datetime(ts0 - duration(0,0, OffsetTime(iInput)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in process_combine_recordings, there should not be interactive calls

ind = java_dialog('radio', 'Select the acquisition date:', 'Acquisition date', [], file_str, 1);
NewT0 = sMetaData(ind).F.t0;
else
NewT0 = str_datetime(datetime('now'));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to set a T0 even when none of the recordings to sync has it?

ts0 = datetime(sOldTiming{iInput}.T0, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss.SSS');
new_T0 = str_datetime(ts0 - duration(0,0, OffsetTime(iInput)));
else
new_T0 = str_datetime(datetime('now'));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in process_combine_recordings, do we want to set a new T0?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realize this process is missing:

  • A brief description in the GUI:

    • Recordings to combine must have similar times for Beginning and End
    • The higher fs among the files will be used for the resulting file
  • A history entry indicating the files that were combined

This PR is a good moment to add those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants