Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
telecom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
telecom
Commits
cb14f974
Commit
cb14f974
authored
Nov 08, 2017
by
Roque Porchetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_wendelin_telecom_ingestion: process data operation processes also edf raw files
parent
d525c91a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.py
...mplateItem/portal_components/external_process_raw_data.py
+19
-6
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.xml
...plateItem/portal_components/external_process_raw_data.xml
+2
-2
No files found.
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.py
View file @
cb14f974
...
...
@@ -2,9 +2,8 @@ import os
import
mne
import
json
from
DateTime
import
DateTime
from
Products.ERP5Type.Log
import
log
from
mne.report
import
Report
from
mne
import
read_evokeds
#from Products.ERP5Type.Log import log
def
getHTMLReport
(
file_name
,
raw
):
try
:
...
...
@@ -28,14 +27,28 @@ def getJSONMetadata(raw_info):
}
return
json
.
dumps
(
info
)
def
getRawData
(
file_name
,
data_stream_content
):
with
open
(
file_name
,
'wb'
)
as
fif_file
:
fif_file
.
write
(
data_stream_content
)
raw
=
None
try
:
raw
=
mne
.
io
.
read_raw_fif
(
file_name
,
preload
=
True
)
except
:
pass
if
raw
is
None
:
try
:
raw
=
mne
.
io
.
read_raw_edf
(
file_name
,
preload
=
True
)
except
:
pass
return
raw
def
processRawData
(
data_stream
,
data_array
,
data_descriptor
):
file_name
=
"temporal_file_%s"
%
DateTime
().
strftime
(
'%Y%m%d-%H%M%S'
)
try
:
data_stream_content
=
data_stream
.
getData
()
raw_file
=
file_name
+
"_raw.fif"
with
open
(
raw_file
,
'wb'
)
as
fif_file
:
fif_file
.
write
(
data_stream_content
)
raw
=
mne
.
io
.
read_raw_fif
(
raw_file
,
preload
=
True
)
raw
=
getRawData
(
raw_file
,
data_stream_content
)
if
raw
is
None
:
raise
StandardError
(
"the file does not contain raw data."
)
json_metadata
=
getJSONMetadata
(
raw
.
info
)
html_report
=
getHTMLReport
(
file_name
,
raw
)
data_descriptor
.
setTextContent
(
json_metadata
)
...
...
@@ -46,4 +59,4 @@ def processRawData(data_stream, data_array, data_descriptor):
os
.
remove
(
raw_file
)
return
"Raw data processed."
except
Exception
,
e
:
return
"Error while processing raw data: "
+
str
(
e
)
\ No newline at end of file
return
"Error while processing raw data: "
+
str
(
e
)
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.xml
View file @
cb14f974
...
...
@@ -52,8 +52,8 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:
5, 0: Unused log imported from Products.ERP5Type.Log (unused-impor
t)
</string>
<string>
W:
7, 0: Unused read_evokeds imported from mne (unused-impor
t)
</string>
<string>
W:
36, 2: No exception type(s) specified (bare-excep
t)
</string>
<string>
W:
41, 4: No exception type(s) specified (bare-excep
t)
</string>
</tuple>
</value>
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment