-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscalogramGen2
More file actions
78 lines (61 loc) · 2.66 KB
/
scalogramGen2
File metadata and controls
78 lines (61 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# scalogramGen - scalogram generator
# version 1.0 Nov 8, 2012
# A function dedicated to processing the channels in .lwr files to generate their respective amplitude and phase scalograms
# Copyright (C) 2014 Christian Richard
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
# Author contact info:
# lifepupil@gmail.com
# UPDATE (4-2-14):
# - minor modifications made to integrate with preproc_v1
# - assumes that all 6 EEG channels get processed
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setproc scalogramGen {{&wtrans mwt} {&image LWR} {&image scalogramImage} {&listv WTparams} {&string mouse}} {
# PROPERTIES OF PASSED ARGUMENTS:
# mwt contains blank &wtrans
# LWR contains 6 EEG recordings, 1 row for each electrode pair
# scalogramImage is blank &image into which scalograms are put for saving to disk
# WTparams is list of wavelet transform values passed from preproc_v1 (old main1) script
# mouse is mouse ID passed for purpose of saving to disk
source wt_to_img
amin = WTparams[0]
vox = WTparams[1]
omax = WTparams[2]
morletOscillations = WTparams[3]
Morlet_Scale = WTparams[4]
sampleRate = WTparams[5]
scalAPath = WTparams[6]
scalPPath = WTparams[7]
WTparamStr = WTparams[8]
thisMorlet = [fftw_MorletWavelets morletOscillations]
MorletWindowSize = sampleRate/2
# CHANNEL LOOP
foreach channel 0:5 {
ch = channel+1
mwt.A[0,0] = LWR[channel;:]
echo Morlet wavelet transform for mouse $mouse channel $ch STARTED
fftw_cwtd mwt amin omax vox thisMorlet -e Morlet_Scale
echo Putting spectral power results into image...
wt_to_img mwt scalogramImage
echo Writing image to disk...
iwrite scalogramImage scalAPath+mouse+'_$WTparamStr'+'$channel'+'.scalA'
echo Amplitude scalogram written
echo
fftw_cwtd mwt amin omax vox thisMorlet -e Morlet_Scale -p mwt
echo Putting spectral phase results into image...
wt_to_img mwt scalogramImage
echo Writing image to disk...
iwrite scalogramImage scalPPath+mouse+'_$WTparamStr'+'$channel'+'.scalP'
echo Phase scalogram written
echo Morlet wavelet transform channel $ch DONE
echo
}
}