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
8fbd9152
Commit
8fbd9152
authored
Apr 13, 2017
by
Roque Porchetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving external methods to portal_components
parent
665f62f7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
287 additions
and
1 deletion
+287
-1
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.py
...mplateItem/portal_components/external_process_raw_data.py
+30
-0
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.xml
...plateItem/portal_components/external_process_raw_data.xml
+133
-0
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/unit_test_external.py
...nsionTemplateItem/portal_components/unit_test_external.py
+15
-0
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/unit_test_external.xml
...sionTemplateItem/portal_components/unit_test_external.xml
+106
-0
bt5/erp5_wendelin_telecom_ingestion/SkinTemplateItem/portal_skins/erp5_wendelin_telecom/processRawData.xml
...tem/portal_skins/erp5_wendelin_telecom/processRawData.xml
+1
-1
bt5/erp5_wendelin_telecom_ingestion/bt/template_extension_id_list
..._wendelin_telecom_ingestion/bt/template_extension_id_list
+2
-0
No files found.
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.py
0 → 100644
View file @
8fbd9152
import
os
import
mne
import
json
from
Products.ERP5Type.Log
import
log
def
getMetadata
(
raw_info
):
dict
=
{
'filename'
:
raw_info
[
'filename'
],
'nchan'
:
raw_info
[
'nchan'
],
'ch_names'
:
raw_info
[
'ch_names'
],
'sfreq'
:
raw_info
[
'sfreq'
]
}
return
json
.
dumps
(
dict
)
def
processRawData
(
data_stream
,
data_array
,
data_stream_metadata
):
try
:
data_stream_content
=
data_stream
.
getData
()
raw_file
=
"ernoise_raw.fif"
with
open
(
raw_file
,
'wb'
)
as
file
:
file
.
write
(
data_stream_content
)
raw
=
mne
.
io
.
read_raw_fif
(
raw_file
,
preload
=
True
)
data_array
.
setArray
(
raw
.
_data
)
log
(
"Data Array array: "
+
str
(
data_array
.
getArray
()))
metadata
=
getMetadata
(
raw
.
info
)
data_stream_metadata
.
appendData
(
metadata
)
log
(
"Data Stream metadata: "
+
str
(
data_stream_metadata
.
getData
()))
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
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/external_process_raw_data.xml
0 → 100644
View file @
8fbd9152
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Extension Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
external_process_raw_data
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
external_process_raw_data
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Extension Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 19, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 7, 2: Redefining built-in \'dict\' (redefined-builtin)
</string>
<string>
W: 18, 33: Redefining built-in \'file\' (redefined-builtin)
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/unit_test_external.py
0 → 100644
View file @
8fbd9152
import
transaction
import
time
import
mne
def
generateRawData
(
array
):
info
=
mne
.
create_info
(
ch_names
=
[
'MEG1'
,
'MEG2'
,
'EEG1'
,
'EEG2'
,
'EOG'
],
ch_types
=
[
'grad'
,
'grad'
,
'eeg'
,
'eeg'
,
'eog'
],
sfreq
=
100
)
info
=
mne
.
create_info
(
array
.
shape
[
0
],
array
.
shape
[
1
])
raw
=
mne
.
io
.
RawArray
(
array
,
info
)
raw
.
save
(
"test_raw_data.fif"
,
overwrite
=
True
)
with
open
(
"test_raw_data.fif"
,
"rb"
)
as
file
:
content
=
file
.
read
()
return
content
bt5/erp5_wendelin_telecom_ingestion/ExtensionTemplateItem/portal_components/unit_test_external.xml
0 → 100644
View file @
8fbd9152
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Extension Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
unit_test_external
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
unit_test_external
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Extension Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 13, 42: Redefining built-in \'file\' (redefined-builtin)
</string>
<string>
W: 1, 0: Unused import transaction (unused-import)
</string>
<string>
W: 2, 0: Unused import time (unused-import)
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_wendelin_telecom_ingestion/SkinTemplateItem/portal_skins/erp5_wendelin_telecom/processRawData.xml
View file @
8fbd9152
...
...
@@ -12,7 +12,7 @@
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
external
</string>
</value>
<value>
<string>
external
_process_raw_data
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_wendelin_telecom_ingestion/bt/template_extension_id_list
0 → 100644
View file @
8fbd9152
external_process_raw_data
unit_test_external
\ No newline at end of file
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