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
Goran Jelic-Cizmek
coffe
Commits
df4665b2
Commit
df4665b2
authored
Nov 29, 2021
by
Goran Jelic-Cizmek
Browse files
`set_parameters` takes kwargs instead of a dict
parent
0bf3502d
Changes
2
Hide whitespace changes
Inline
Side-by-side
coffe.pyx
View file @
df4665b2
...
...
@@ -100,7 +100,7 @@ cdef class Coffe:
self
.
_power_spectrum_flag
=
0
if
kwargs
:
self
.
set_parameters
(
kwargs
)
self
.
set_parameters
(
**
kwargs
)
def
_free_background
(
self
):
...
...
@@ -197,14 +197,10 @@ cdef class Coffe:
return
writable
def
set_parameters
(
self
,
value
:
dict
):
def
set_parameters
(
self
,
**
value
):
"""
Bulk setter of parameters.
The passed object _must_ be a dictionary with strings as keys.
"""
if
not
isinstance
(
value
,
dict
):
raise
TypeError
for
key
in
value
:
if
not
hasattr
(
self
,
key
):
raise
AttributeError
(
...
...
test_coffe.py
View file @
df4665b2
...
...
@@ -123,7 +123,8 @@ class TestCoffe:
def
test_covariance_multipoles
(
self
):
cosmo
=
coffe
.
Coffe
(
cosmo
=
coffe
.
Coffe
()
cosmo
.
set_parameters
(
has_density
=
True
,
has_rsd
=
True
,
number_density
=
[
1e-3
],
...
...
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