Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 4dbf0ec391b877f21402aed9e8351fe8f7468d14 authored by D019 Rig on 19 December 2019, 23:25:22 UTC, committed by D019 Rig on 19 December 2019, 23:25:22 UTC
Update Calibration
1 parent 4cac1d4
  • Files
  • Changes
  • cb6e09d
  • /
  • Tools
  • /
  • VOR_Analysis
  • /
  • extractStepSegs.m
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:4dbf0ec391b877f21402aed9e8351fe8f7468d14
directory badge Iframe embedding
swh:1:dir:f5b842836a02193b4b53d8570e1b32a462cadd75
content badge Iframe embedding
swh:1:cnt:1657c971ee4d9b1ec0557625e2a3f863aebd0665

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
extractStepSegs.m
function [startTimes, endTimes] = extractStepSegs(folder)
%% setup
[~, file] = fileparts(folder);
chanlist = readSpikeFile(fullfile(folder,[file '.smr']),[]);
chanindsAll = [chanlist.number];
chaninds = find(      arrayfun(@(x) any(strcmp(x.title,{'Keyboard'})),chanlist)     );
rawdata = importSpike(fullfile(folder,[file '.smr']),chanindsAll(chaninds));

%% Pulse Experiments
SampleKeys = strcat(rawdata.samplerate(any(rawdata.samplerate == ['P' 'p' 'l' 'L'], 2))');
SampleKeyTimes = rawdata.data(any(rawdata.samplerate == ['P' 'p' 'l' 'L'], 2))';

% Pulse only
start_Pp_loc = SampleKeyTimes(strfind(SampleKeys, 'Pp'));
end_Pp_loc = SampleKeyTimes(strfind(SampleKeys, 'Pp')+1);

% test/train segs
start_Plp_loc = SampleKeyTimes(strfind(SampleKeys, 'Plp'));
start_Plp_loc = [start_Plp_loc SampleKeyTimes(strfind(SampleKeys, 'Plp')+1)];
end_Plp_loc = SampleKeyTimes(strfind(SampleKeys, 'Plp')+2);
end_Plp_loc = [end_Plp_loc SampleKeyTimes(strfind(SampleKeys, 'Plp')+1)];

% okr
start_Lp_loc = SampleKeyTimes(strfind(SampleKeys, 'Lp'));
end_Lp_loc = SampleKeyTimes(strfind(SampleKeys, 'Lp')+1);

% vor
start_Llp_loc = SampleKeyTimes(strfind(SampleKeys, 'Llp')+1);
start_Llp_loc = start_Llp_loc + 1.5; % Hack-y. There is no actual start KeyboardMark
end_Llp_loc = SampleKeyTimes(strfind(SampleKeys, 'Llp')+2);


startTimes = sort([start_Pp_loc start_Plp_loc start_Lp_loc start_Llp_loc])';
endTimes = sort([end_Pp_loc end_Plp_loc end_Lp_loc end_Llp_loc])';

%% Take the Experiment start time listed in the excel file, and remove incorrect segments

% remove segments before start time
expmt_start_time = xlsread(fullfile(folder,[file '.xlsx']), 1, 'G2' );
endTimes(startTimes < (expmt_start_time)) = [];
startTimes(startTimes < (expmt_start_time)) = [];

% remove segments after experiment is over
[~, segment_Names, ~] = xlsread(fullfile(folder,[file '.xlsx']), 1, 'A2:A500' );
if length(segment_Names) < length(endTimes)
    endTimes(length(segment_Names)+1:end) = [];
    startTimes(length(segment_Names)+1:end) = [];
end

%% place start and end times into the excel file
xlswrite(fullfile(folder,[file '.xlsx']), startTimes, 'Sheet1', 'D2')
xlswrite(fullfile(folder,[file '.xlsx']), endTimes, 'Sheet1', 'E2')
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API