Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
as_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Böhmländer
as_tools
Commits
a5493786
Commit
a5493786
authored
2 weeks ago
by
Alexander Böhmländer
Browse files
Options
Downloads
Patches
Plain Diff
Added test.
parent
b03a3a3a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/example_Calculations_size_distributions.py
+0
-0
0 additions, 0 deletions
Examples/example_Calculations_size_distributions.py
tests/test_Calculations_size_distributions.py
+36
-0
36 additions, 0 deletions
tests/test_Calculations_size_distributions.py
with
36 additions
and
0 deletions
test
_Calculations_size_distributions.py
→
Examples/example
_Calculations_size_distributions.py
+
0
−
0
View file @
a5493786
File moved
This diff is collapsed.
Click to expand it.
tests/test_Calculations_size_distributions.py
0 → 100644
+
36
−
0
View file @
a5493786
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 24 00:07:14 2024
@author: alex
"""
import
unittest
class
TestCalc
(
unittest
.
TestCase
):
def
test_lognormal_number_distribution_log_scale
(
self
):
import
numpy
as
np
from
pathlib
import
Path
import
math
import
sys
sys
.
path
.
insert
(
0
,
str
(
Path
(
__file__
).
parents
[
2
]))
from
as_tools.Calculations
import
size_distribution
as
sd
particle_diameter
=
np
.
geomspace
(
1e-3
,
10
,
500
)
# µm
number_size_distribution_nucleation
=
sd
.
lognormal_number_distribution_log_scale
(
number_concentration
=
7100
,
standard_deviation
=
np
.
exp
(
0.232
),
median_particle_diameter
=
0.0117
,
particle_diameter
=
particle_diameter
)
# test for the number of particles, the area under dNdlogdp should be the total
# number concentration
dlogdp
=
np
.
diff
(
np
.
log10
(
particle_diameter
)).
mean
()
number_concentration_nucleation
=
(
number_size_distribution_nucleation
*
dlogdp
).
sum
()
result
=
math
.
isclose
(
7100
,
number_concentration_nucleation
)
self
.
assertTrue
(
result
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment