Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
30b2f699
Commit
30b2f699
authored
Jun 04, 2018
by
Mathieu Giraud
Browse files
fuse.py: more robust handling of diversities
parent
0f5c1d69
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/fuse.py
View file @
30b2f699
...
...
@@ -154,22 +154,20 @@ class Samples:
class
Diversity
:
keys
=
[
"index_H_entropy"
,
"index_E_equitability"
,
"index_Ds_diversity"
]
def
__init__
(
self
,
data
=
None
):
self
.
d
=
{}
if
data
==
None
:
self
.
d
[
"index_H_entropy"
]
=
[
"na"
]
self
.
d
[
"index_E_equitability"
]
=
[
"na"
]
self
.
d
[
"index_Ds_diversity"
]
=
[
"na"
]
else
:
self
.
d
[
"index_H_entropy"
]
=
[
data
[
"index_H_entropy"
]]
self
.
d
[
"index_E_equitability"
]
=
[
data
[
"index_E_equitability"
]]
self
.
d
[
"index_Ds_diversity"
]
=
[
data
[
"index_Ds_diversity"
]]
def
__add__
(
self
,
other
):
self
.
d
[
'index_H_entropy'
].
append
(
other
.
d
[
'index_H_entropy'
][
0
]
)
self
.
d
[
'index_E_equitability'
].
append
(
other
.
d
[
'index_E_equitability'
][
0
]
)
self
.
d
[
'index_Ds_diversity'
].
append
(
other
.
d
[
'index_Ds_diversity'
][
0
]
)
for
k
in
self
.
keys
:
if
data
==
None
or
not
(
k
in
data
):
self
.
d
[
k
]
=
[
"na"
]
else
:
self
.
d
[
k
]
=
[
data
[
k
]]
def
__add__
(
self
,
other
):
for
k
in
self
.
keys
:
self
.
d
[
k
].
append
(
other
.
d
[
k
][
0
])
return
self
def
__str__
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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