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
  • /
  • Program_Spike2_CEDS64
  • /
  • Examples
  • /
  • ExampleMask.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
swh:1:dir:a09ef28de3196ccfd7aac15c79dc54216cc697d7
content badge
swh:1:cnt:4ad10ff7f1593131c948fb3bf2d36bc362c07198

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 ...
ExampleMask.m
%This function opens the file created by ExampleCreateFile and reads the marker channels using random marker masks and then copies the masked channels to a new file

% clear workspace
clear;
% add path to CED code
if isempty(getenv('CEDS64ML'))
    setenv('CEDS64ML', 'C:\path\to\your\folder\CEDS64ML');
end
cedpath = getenv('CEDS64ML');
addpath(cedpath);
% load ceds64int.dll
CEDS64LoadLib( cedpath );

% create 8 random masks
CEDS64MaskReset();
for k=1:8
    CEDS64MaskMode(k, 0);
    newfilter = zeros(256, 4, 'uint8');
    [ iOk, mode ] = CEDS64MaskMode(k);
    if (mode ~= 0)
        warning('CEDS64MaskMode has failed');
    end
    for c=1:4
        for r=1:256
            if (r > 15 )
                newfilter(r,c) = 1;
            else
                newfilter(r,c) = 0;
            end
        end
    end
    CEDS64MaskCodes(k, newfilter);
    CEDS64MaskCol(k, mod(k,4));
    [ iOk, col ] = CEDS64MaskCol(k);
    if (col ~= mod(k,4))
        warning('CEDS64MaskCol has failed');
    end
end

CEDS64MaskMode(4, 1);
newfilter = zeros(256, 4, 'uint8');
newfilter(1+1,1) = 1;
newfilter(2+1,1) = 1;
newfilter(3+1,1) = 1;
newfilter(7+1,1) = 1;
newfilter(11+1,1) = 1;
newfilter(19+1,1) = 1;
newfilter(43+1,1) = 1;
newfilter(67+1,1) = 1;
newfilter(163+1,1) = 1;

[ iOk, Codes ] = CEDS64MaskCodes(4, newfilter);
[ iOk, Codes ] = CEDS64MaskCodes(4);

fhand1 = CEDS64Open( '..\Data\ExampleCreateFile.smrx' );
if (fhand1 <= 0); unloadlibrary ceds64int; return; end
maxchans = CEDS64MaxChan( fhand1 );

fhand2 = CEDS64Create( '..\Data\ExampleMask.smrx', maxchans, 2 );
if (fhand2 <= 0); unloadlibrary ceds64int; return; end

timebase = CEDS64TimeBase( fhand1 );
CEDS64TimeBase( fhand2, timebase );

for m = 1:maxchans
    type = CEDS64ChanType( fhand1, m );
    if (type > 0)
        chandiv = CEDS64ChanDiv( fhand1, m );
        rate = CEDS64IdealRate( fhand1, m );
    end
    switch(type)
        case 0 % there is no channel with this number
        case 1 % ADC channel
        case 2 % Event Fall
        case 3 % Event Rise
        case 4 % Event Both.
        case 5 % Marker
            % read all markers
            maxTimeTicks = CEDS64ChanMaxTime( fhand1, m )+1;
            [ markerread, markervals ] = CEDS64ReadMarkers( fhand1, m, 100000, 0 );
            if (markerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetMarkerChan( fhand2, chan, rate, 5 );
                CEDS64WriteMarkers( fhand2, chan, markervals );
            end
            % read markers with a mask
            [ iOk, Codes ] = CEDS64MaskCodes( 1 );
            [ markerread, markervals ] = CEDS64ReadMarkers( fhand1, m, 100000, 0, -1, 1 );
            if (markerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetMarkerChan( fhand2, chan, rate, 5 );
                CEDS64WriteMarkers( fhand2, chan, markervals );
            end
            % read markers with a mask as events
            [ evread, evtimes ] = CEDS64ReadEvents( fhand1, m, 100000, 0, -1, 1 );
            if (evread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetEventChan( fhand2, chan, rate, 2 );
                CEDS64WriteEvents( fhand2, chan, evtimes );
            end
        case 6 % Wave Mark
            % read all markers
            maxTimeTicks = CEDS64ChanMaxTime( fhand1, m )+1;
            [ iOk, dOffset ] = CEDS64ChanOffset( fhand1, m );
            [ iOk, dScale ] = CEDS64ChanScale( fhand1, m );
            [ iOk, Rows, Cols ] = CEDS64GetExtMarkInfo( fhand1, m );
            [ wmarkerread, wmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0 );
            if (wmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan(fhand2, chan, rate, 6, Rows, Cols, chandiv);
                CEDS64WriteExtMarks( fhand2, chan, wmarkervals);
            end
            CEDS64ChanOffset( fhand2, chan, dOffset );
            CEDS64ChanScale( fhand2, chan, dScale );
            % read markers with a mask
            [ wmarkerread, wmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0, -1, 2 );
            if (wmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan(fhand2, chan, rate, 6, Rows, Cols, chandiv);
                CEDS64WriteExtMarks( fhand2, chan, wmarkervals);
            end
            CEDS64ChanOffset( fhand2, chan, dOffset );
            CEDS64ChanScale( fhand2, chan, dScale );
            % read marker after 2.5s as waveform - we only get the first one
            [ waveread, wavevals, i64Time ] = CEDS64ReadWaveF( fhand1, m, 100000, CEDS64SecsToTicks(fhand1, 2.5) );
            if (waveread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetWaveChan( fhand2, chan, chandiv, 9, rate );
                CEDS64WriteWave( fhand2, chan, wavevals, i64Time);
            end
            CEDS64ChanOffset( fhand2, chan, dOffset );
            CEDS64ChanScale( fhand2, chan, dScale );
            % read markers with a mask as waveform
            [ waveread, wavevals, i64Time ] = CEDS64ReadWaveF( fhand1, m, 100000, 0, -1, 2 );
            if (waveread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetWaveChan( fhand2, chan, chandiv, 9, rate );
                CEDS64WriteWave( fhand2, chan, wavevals, i64Time);
            end
            CEDS64ChanOffset( fhand2, chan, dOffset );
            CEDS64ChanScale( fhand2, chan, dScale );
        case 7 % Real Mark
            % read all markers
            maxTimeTicks = CEDS64ChanMaxTime( fhand1, m )+1;
            [ iOk, Rows, Cols ] = CEDS64GetExtMarkInfo( fhand1, m );
            [ rmarkerread, rmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0 );
            if (rmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan( fhand2, chan, rate, 7, Rows, Cols, -1);
                CEDS64WriteExtMarks( fhand2, chan, rmarkervals);
            end
            % read markers with a mask
            [ rmarkerread, rmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0, -1, 3 );
            if (rmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan( fhand2, chan, rate, 7, Rows, Cols, -1);
                CEDS64WriteExtMarks( fhand2, chan, rmarkervals);
            end
            % read markers with a mask as events
            [ evread, evtimes ] = CEDS64ReadEvents( fhand1, m, 100000, 0, -1, 3 );
            if (evread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetEventChan( fhand2, chan, rate, 2 );
                CEDS64WriteEvents( fhand2, chan, evtimes );
            end
        case 8 % Text Mark
            % read all markers
            maxTimeTicks = CEDS64ChanMaxTime( fhand1, m )+1;
            [ iOk, Rows, Cols ] = CEDS64GetExtMarkInfo( fhand1, m );
            [ tmarkerread, tmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0 );
            if (tmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan( fhand2, chan, rate, 8, Rows, Cols, -1 );
                CEDS64WriteExtMarks( fhand2, chan, tmarkervals );
            end
            % read markers with a mask
            [ iOk, Codes ] = CEDS64MaskCodes( 4 );
            [ tmarkerread, tmarkervals ] = CEDS64ReadExtMarks( fhand1, m, 100000, 0, -1, 4 );
            if (tmarkerread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetExtMarkChan( fhand2, chan, rate, 8, Rows, Cols, -1 );
                CEDS64WriteExtMarks( fhand2, chan, tmarkervals );
            end
            % read markers with a mask as events
            [ evread, evtimes ] = CEDS64ReadEvents( fhand1, 8, 100000, 0, -1, 4 );
            if (evread >= 0)
                chan = CEDS64GetFreeChan( fhand2 );
                CEDS64SetEventChan( fhand2, chan, rate, 2 );
                CEDS64WriteEvents( fhand2, chan, evtimes );
            end
        case 9 % Realwave
    end
    % copy units, comments, offsets etc.
    if (type > 4 && type < 9)
        [ iOk, sComment ] = CEDS64ChanComment( fhand1, m );
        CEDS64ChanComment( fhand2, chan, sComment );
        [ iOk, sTitle ] = CEDS64ChanTitle( fhand1, m );
        CEDS64ChanTitle( fhand2, chan, sTitle );
        [ iOk, sUnits ] = CEDS64ChanUnits( fhand1, m );
        CEDS64ChanUnits( fhand2, chan, sUnits );
    end
end

unloadlibrary ceds64int;
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