Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cigale
CIGALE
Commits
d28b636c
Commit
d28b636c
authored
Mar 30, 2017
by
Médéric Boquien
Browse files
Implement blocks of models when using the parameters_file option too.
parent
0f472264
Changes
1
Hide whitespace changes
Inline
Side-by-side
pcigale/managers/parameters.py
View file @
d28b636c
...
...
@@ -184,6 +184,8 @@ class ParametersManagerFile(object):
module
=
colname
.
split
(
'.'
,
1
)[
0
]
if
module
not
in
self
.
modules
:
self
.
modules
.
append
(
module
)
self
.
blocks
=
self
.
_split
(
range
(
self
.
size
),
conf
[
'analysis_params'
][
'blocks'
])
# The parameters file is read using astropy.Table. Unfortunately, it
# stores strings as np.str_, which is not marshalable, which means we
...
...
@@ -207,6 +209,26 @@ class ParametersManagerFile(object):
del
table
@
staticmethod
def
_split
(
l
,
nb
):
"""Split a list l into nb blocks.
Parameters
----------
l: list
List to split.
nb: int
Number of blocks.
"""
step
=
len
(
l
)
//
nb
if
step
>
0
:
return
[
l
[
i
*
step
:
(
i
+
1
)
*
step
]
for
i
in
range
(
nb
)]
raise
ValueError
(
"The number of blocks must be no more than the number"
"of models."
)
def
from_index
(
self
,
index
):
"""Provides the parameters of a model given an index.
...
...
Write
Preview
Supports
Markdown
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