Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
traffic-scratch
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mehtank
traffic-scratch
Commits
48e1e61b
Commit
48e1e61b
authored
8 years ago
by
mehtank
Browse files
Options
Downloads
Patches
Plain Diff
Added option for logplot
parent
399cc369
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
idmsweep.py
+14
-7
14 additions, 7 deletions
idmsweep.py
with
14 additions
and
7 deletions
idmsweep.py
+
14
−
7
View file @
48e1e61b
...
@@ -43,22 +43,27 @@ def idmgo(t, a, b, s, v, fmt=None):
...
@@ -43,22 +43,27 @@ def idmgo(t, a, b, s, v, fmt=None):
else
:
else
:
return
res
,
idm
.
os
(),
fmt
return
res
,
idm
.
os
(),
fmt
def
sweep
(
fn
,
rngs
,
axis
=
None
,
separate
=
True
):
def
sweep
(
fn
,
rngs
,
axis
=
None
,
separate
=
True
,
logx
=
False
):
if
logx
:
plot
=
plt
.
semilogx
else
:
plot
=
plt
.
plot
defaults
=
[
x
[
"
default
"
]
for
x
in
rngs
]
defaults
=
[
x
[
"
default
"
]
for
x
in
rngs
]
if
not
separate
:
if
not
separate
:
plt
.
plot
(
*
fn
(
*
defaults
,
fmt
=
'
k
'
))
plot
(
*
fn
(
*
defaults
,
fmt
=
'
k
'
))
for
i
,
r
in
enumerate
(
rngs
):
for
i
,
r
in
enumerate
(
rngs
):
if
"
values
"
in
r
and
r
[
"
values
"
]
is
not
None
:
if
"
values
"
in
r
and
r
[
"
values
"
]
is
not
None
:
if
separate
:
if
separate
:
plt
.
plot
(
*
fn
(
*
defaults
,
fmt
=
'
k
'
))
plot
(
*
fn
(
*
defaults
,
fmt
=
'
k
'
))
print
r
[
"
name
"
],
defaults
[
i
],
r
[
"
values
"
]
print
r
[
"
name
"
],
defaults
[
i
],
r
[
"
values
"
]
args
=
list
(
defaults
)
args
=
list
(
defaults
)
for
dot
,
arg
in
zip
(
r
[
"
dots
"
],
r
[
"
values
"
]):
for
dot
,
arg
in
zip
(
r
[
"
dots
"
],
r
[
"
values
"
]):
args
[
i
]
=
arg
args
[
i
]
=
arg
plt
.
plot
(
*
fn
(
*
args
,
fmt
=
r
[
"
color
"
]
+
dot
))
plot
(
*
fn
(
*
args
,
fmt
=
r
[
"
color
"
]
+
dot
))
if
axis
is
not
None
:
if
axis
is
not
None
:
plt
.
axis
(
axis
)
plt
.
axis
(
axis
)
...
@@ -69,11 +74,10 @@ def sweep(fn, rngs, axis=None, separate=True):
...
@@ -69,11 +74,10 @@ def sweep(fn, rngs, axis=None, separate=True):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
'''
### What happens when you vary a?
### What happens when you vary a?
### ( enhance )
### ( enhance )
avals =
arange(20)/20. + 0.2
avals
=
linspace
(
0.5
,
0.7
,
20
)
dots
=
[
"
-
"
]
*
len
(
avals
)
dots
=
[
"
-
"
]
*
len
(
avals
)
arng
=
{
"
name
"
:
"
a
"
,
"
color
"
:
""
,
"
dots
"
:
dots
,
"
default
"
:
1.0
,
"
values
"
:
avals
}
arng
=
{
"
name
"
:
"
a
"
,
"
color
"
:
""
,
"
dots
"
:
dots
,
"
default
"
:
1.0
,
"
values
"
:
avals
}
...
@@ -85,7 +89,8 @@ if __name__ == "__main__":
...
@@ -85,7 +89,8 @@ if __name__ == "__main__":
rngs
=
[
trng
,
arng
,
brng
,
srng
,
vrng
]
rngs
=
[
trng
,
arng
,
brng
,
srng
,
vrng
]
sweep
(
idmgo
,
rngs
,
axis
=
[
0
,
0.1
,
-
.
05
,.
45
])
sweep
(
idmgo
,
rngs
,
axis
=
[
0
,
0.1
,
-
.
05
,.
45
])
'''
go
=
linfty
(
0.5
,
n
=
50
,
tmax
=
500
)
sweep
(
go
,
rngs
)
'''
'''
### What happens when you vary IDM parameters?
### What happens when you vary IDM parameters?
...
@@ -102,6 +107,7 @@ if __name__ == "__main__":
...
@@ -102,6 +107,7 @@ if __name__ == "__main__":
sweep(idmgo, rngs, axis=[0,1,-.2,.2])
sweep(idmgo, rngs, axis=[0,1,-.2,.2])
'''
'''
'''
### What happens when you vary IDM parameters?
### What happens when you vary IDM parameters?
dots = (
'
:
'
,
'
--
'
,
'
-
'
,
'
.-
'
)
dots = (
'
:
'
,
'
--
'
,
'
-
'
,
'
.-
'
)
...
@@ -115,6 +121,7 @@ if __name__ == "__main__":
...
@@ -115,6 +121,7 @@ if __name__ == "__main__":
go = linfty(0.5, n=50, tmax=500)
go = linfty(0.5, n=50, tmax=500)
sweep(go, rngs)
sweep(go, rngs)
'''
'''
'''
go = linfty(0.05, n=80, tmax=500, timeplot=True)
go = linfty(0.05, n=80, tmax=500, timeplot=True)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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