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
1970e03d
Commit
1970e03d
authored
Feb 20, 2019
by
Martin Glatzle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to sdist.
parent
18170aee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
cosmic_dustbox/sdist.py
cosmic_dustbox/sdist.py
+10
-5
cosmic_dustbox/tests/test_sdist.py
cosmic_dustbox/tests/test_sdist.py
+6
-2
No files found.
cosmic_dustbox/sdist.py
View file @
1970e03d
...
...
@@ -165,7 +165,7 @@ class PowerLaw(SizeDist):
def
__init__
(
self
,
sizeMin
,
sizeMax
,
power
,
C
):
def
f
(
a
):
return
C
*
a
**
power
super
(
self
).
__init__
(
sizeMin
,
sizeMax
,
f
)
super
().
__init__
(
sizeMin
,
sizeMax
,
f
)
return
...
...
@@ -180,8 +180,13 @@ class Log_Normal(SizeDist):
nominator
=
(
3
*
_np
.
exp
(
-
4.5
*
sgma
**
2
)
*
bc
[
i
]
*
m_C
)
denominator
=
(
(
2
*
_np
.
pi
**
2
)
**
1.5
*
rho
*
a0
[
i
]
**
3
*
sgma
*
(
1
+
_np
.
erf
((
3
*
sgma
/
_np
.
sqrt
(
2
))
+
(
_np
.
log
((
a0
[
i
]
/
3.5
/
_u
.
angstrom
).
decompose
().
value
)
/
(
sgma
*
_np
.
sqrt
(
2
))))))
(
1
+
_np
.
erf
((
3
*
sgma
/
_np
.
sqrt
(
2
))
+
(
_np
.
log
((
a0
[
i
]
/
3.5
/
_u
.
angstrom
).
decompose
().
value
)
/
(
sgma
*
_np
.
sqrt
(
2
)))
)
)
)
# FIXME: what do we do if the denominator is zero
if
denominator
!=
0
:
B
=
(
nominator
/
denominator
).
decompose
().
value
...
...
@@ -194,7 +199,7 @@ class Log_Normal(SizeDist):
_np
.
log
((
a
/
a0
[
i
]).
decompose
().
value
)
/
sgma
)
**
2
)
for
i
in
range
(
2
)])
super
(
self
).
__init__
(
sizeMin
,
sizeMax
,
f
)
super
().
__init__
(
sizeMin
,
sizeMax
,
f
)
return
...
...
@@ -219,7 +224,7 @@ class WD01_dst(SizeDist):
return
C
*
(
a
/
a_t
)
**
alpha
/
a
\
*
F
(
a
)
*
exp_func
(
a
)
super
(
self
).
__init__
(
sizeMin
,
sizeMax
,
f
)
super
().
__init__
(
sizeMin
,
sizeMax
,
f
)
return
...
...
cosmic_dustbox/tests/test_sdist.py
View file @
1970e03d
...
...
@@ -63,7 +63,9 @@ class TestSdist(TestCase):
r
=
a
(
self
.
__class__
.
_sizes
)
r
[
np
.
where
(
r
!=
0
)]
=
r
[
np
.
where
(
r
!=
0
)]
+
scalar
self
.
assertTrue
(
np
.
all
(
b
(
self
.
__class__
.
_sizes
)
==
r
))
np
.
all
(
np
.
isclose
(
b
(
self
.
__class__
.
_sizes
),
r
,
rtol
=
1e-10
,
atol
=
0
)
))
return
def
test_add_scalar_quantity_float
(
self
):
...
...
@@ -73,5 +75,7 @@ class TestSdist(TestCase):
r
=
a
(
self
.
__class__
.
_sizes
)
r
[
np
.
where
(
r
!=
0
)]
=
r
[
np
.
where
(
r
!=
0
)]
+
scalar
self
.
assertTrue
(
np
.
all
(
b
(
self
.
__class__
.
_sizes
)
==
r
))
np
.
all
(
np
.
isclose
(
b
(
self
.
__class__
.
_sizes
),
r
,
rtol
=
1e-10
,
atol
=
0
)
))
return
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