Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PK_Optimizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tu, Ethan
PK_Optimizer
Commits
08e8841f
Commit
08e8841f
authored
4 years ago
by
Tu, Ethan
Browse files
Options
Downloads
Patches
Plain Diff
Delete test_pk2Comp.py
parent
6186b8dc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pk_optimizer/test/test_pk2Comp.py
+0
-86
0 additions, 86 deletions
pk_optimizer/test/test_pk2Comp.py
with
0 additions
and
86 deletions
pk_optimizer/test/test_pk2Comp.py
deleted
100644 → 0
+
0
−
86
View file @
6186b8dc
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 27 16:26:32 2020
@author: Ethan
"""
from
scipy.integrate
import
odeint
import
pk2Comp
import
pytest
def
test_pkOptimizer_init
():
pk1
=
pk2Comp
.
pk2Comp
()
#Test directory is same as one given
assert
pk1
.
numParam
==
4
assert
pk1
.
flow
==
1
/
60
assert
pk1
.
Vp
==
0.05
assert
pk1
.
Visf
==
0.15
assert
pk1
.
PS
==
1
/
60
assert
pk1
.
Cp0
==
0
# Initial concentration of tracer in plasma
assert
pk1
.
Cisf0
==
0
# Initial concentration of tracer in plasma
assert
pk1
.
tmax
==
10
#Time in seconds
assert
pk1
.
dt
==
1
#Time step
assert
pk1
.
a
==
2.
# Alpha for gamma distribution
assert
pk1
.
sol
==
[]
def
test_pkOptimizer_init_newVals
():
pk2
=
pk2Comp
.
pk2Comp
(
5
,
1.15
,
1
/
60
,
2.3
/
60
,
7
)
#Test directory is same as one given
assert
pk2
.
numParam
==
5
assert
pk2
.
flow
==
1.15
assert
pk2
.
Vp
==
1
/
60
assert
pk2
.
Visf
==
2.3
/
60
assert
pk2
.
PS
==
7
# Initial concentration of tracer in plasma
def
test_pkOptimizer_init_badVals0
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
-
5
,
1.15
,
1
/
60
,
2.3
/
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_pkOptimizer_init_badVals1
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
5
,
-
1.15
,
1
/
60
,
2.3
/
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_pkOptimizer_init_badVals2
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
5
,
1.15
,
-
1
/
60
,
2.3
/
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_pkOptimizer_init_badVals3
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
-
5
,
1.15
,
1
/
60
,
-
2.3
/
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_pkOptimizer_init_badVals4
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
5
,
1.15
,
1
/
60
,
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_pkOptimizer_init_badVals5
():
with
pytest
.
raises
(
ValueError
)
as
excinfo
:
pk3
=
pk2Comp
.
pk2Comp
(
5
,
1.15
,
60
,
2.3
/
60
)
assert
"
Input values are incorrect.
"
in
str
(
excinfo
.
value
)
def
test_main
():
pk1
=
pk2Comp
.
pk2Comp
()
pk1
.
main
()
pk2
=
pk2Comp
.
pk2Comp
(
5
,
1.15
,
1
/
60
,
2.3
/
60
)
pk2
.
main
()
assert
1
==
1
def
test_derivs
():
pk1
=
pk2Comp
.
pk2Comp
()
ssol
=
odeint
(
pk1
.
derivs
,
[
0
,
0
],
pk1
.
time
)
assert
ssol
[:,
0
].
max
().
round
(
3
)
==
0.151
ssol
=
odeint
(
pk1
.
derivs
,
[
1
,
0
],
pk1
.
time
)
assert
ssol
[:,
0
].
max
().
round
(
3
)
==
1.0
ssol
=
odeint
(
pk1
.
derivs
,
[
0
,
1
],
pk1
.
time
)
assert
ssol
[:,
0
].
max
().
round
(
3
)
==
0.526
ssol
=
odeint
(
pk1
.
derivs
,
[
-
2
,
0
],
pk1
.
time
)
assert
ssol
[:,
0
].
max
().
round
(
3
)
==
-
0.08
ssol
=
odeint
(
pk1
.
derivs
,
[
0
,
-
2
],
pk1
.
time
)
assert
ssol
[:,
0
].
max
().
round
(
3
)
==
0.0
\ No newline at end of file
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