Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cosmic_dustbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Glatzle
cosmic_dustbox
Commits
37c70eb0
Commit
37c70eb0
authored
Feb 21, 2019
by
Martin Glatzle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update sdist.
parent
438d4f66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
cosmic_dustbox/sdist.py
cosmic_dustbox/sdist.py
+5
-5
cosmic_dustbox/tests/test_sdist.py
cosmic_dustbox/tests/test_sdist.py
+2
-4
No files found.
cosmic_dustbox/sdist.py
View file @
37c70eb0
...
...
@@ -86,7 +86,7 @@ class SizeDist(object):
Overloading of ``+`` operator. Can add an instance of ``SizeDist`` (or
subclass thereof), any callable or a scalar to ``self.func``. No check
on units is performed. Returns an instance of ``
self.__class__
``, the
on units is performed. Returns an instance of ``
SizeDist
``, the
``func`` attribute of which is defined to return the corresponding sum.
If ``other`` is an instance of ``SizeDist`` (or subclass), take maximum
...
...
@@ -124,7 +124,7 @@ class SizeDist(object):
def
func
(
sizes
):
return
self
.
func
(
sizes
)
+
other
.
func
(
sizes
)
return
self
.
__class__
(
sizeMin
,
sizeMax
,
func
)
return
SizeDist
(
sizeMin
,
sizeMax
,
func
)
elif
callable
(
other
):
def
func
(
sizes
):
return
self
.
func
(
sizes
)
+
other
(
sizes
)
...
...
@@ -273,7 +273,7 @@ def WD01(RV, bc, case):
sizeMin
=
3.5
*
_u
.
angstrom
sizeMax
=
10
*
_u
.
micron
rho
=
2.24
*
_u
.
g
/
_u
.
cm
**
3
s_
gra
=
DoubleLogNormal
(
s_
car
=
DoubleLogNormal
(
sizeMin
,
sizeMax
,
rho
,
...
...
@@ -281,7 +281,7 @@ def WD01(RV, bc, case):
[
0.75
*
params
[
2
],
0.25
*
params
[
2
]],
[
3.5
*
_u
.
angstrom
,
30
*
_u
.
angstrom
]
)
l_
gra
=
WD01ExpCutoff
(
l_
car
=
WD01ExpCutoff
(
sizeMin
,
sizeMax
,
params
[
4
],
...
...
@@ -299,7 +299,7 @@ def WD01(RV, bc, case):
params
[
12
]
*
_u
.
m
,
params
[
13
]
)
return
s_
gra
,
l_gra
,
sil
return
s_
car
+
l_car
,
sil
###############################################################################
if
__name__
==
"__main__"
:
...
...
cosmic_dustbox/tests/test_sdist.py
View file @
37c70eb0
...
...
@@ -95,8 +95,7 @@ class TestWD01(TestCase):
return
def
test_out_of_bounds
(
self
):
sg
,
lg
,
sil
=
sdist
.
WD01
(
3.1
,
0.0
,
'A'
)
for
sd
in
[
sg
,
lg
,
sil
]:
for
sd
in
sdist
.
WD01
(
3.1
,
0.0
,
'A'
):
self
.
assertEqual
(
sd
(
np
.
array
([
1
])
*
u
.
angstrom
)[
0
],
0.0
/
u
.
angstrom
...
...
@@ -105,8 +104,7 @@ class TestWD01(TestCase):
sd
(
np
.
array
([
11
])
*
u
.
micron
)[
0
],
0.0
/
u
.
angstrom
)
sg
,
lg
,
sil
=
sdist
.
WD01
(
3.1
,
6.0
,
'A'
)
for
sd
in
[
sg
,
lg
,
sil
]:
for
sd
in
sdist
.
WD01
(
3.1
,
6.0
,
'A'
):
self
.
assertEqual
(
sd
(
np
.
array
([
1
])
*
u
.
angstrom
)[
0
],
0.0
/
u
.
angstrom
...
...
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