Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Steinlechner
pykat
Commits
c1513d04
Commit
c1513d04
authored
11 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
Added function to plot summed performance data
parent
5d15437e
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
bin/parse.kat
+1
-1
1 addition, 1 deletion
bin/parse.kat
bin/test_parser.py
+6
-7
6 additions, 7 deletions
bin/test_parser.py
pykat/finesse.py
+23
-3
23 additions, 3 deletions
pykat/finesse.py
pykat/profiling.py
+26
-0
26 additions, 0 deletions
pykat/profiling.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
57 additions
and
12 deletions
bin/parse.kat
+
1
−
1
View file @
c1513d04
...
...
@@ -6,4 +6,4 @@ m m2 0.5 0.5 0 n4 dump
pd PD1 n2
xaxis m1 phi lin 0 360
36
0
xaxis m1 phi lin 0 360
1000
0
This diff is collapsed.
Click to expand it.
bin/test_parser.py
+
6
−
7
View file @
c1513d04
...
...
@@ -2,18 +2,17 @@ import sys
sys
.
path
.
append
(
"
../
"
)
from
pykat
import
finesse
import
pykat.profiling
import
numpy
as
np
import
pylab
as
pl
kat
=
finesse
.
kat
()
kat
.
load
(
"
parse.kat
"
)
#kat.load("D:\\finesse\\test\\kat_test\\physics\\mirror_astig_tilt_all_BH.kat")
kat
.
load
(
'
parse.kat
'
)
kat
.
getPerformanceData
=
True
run
=
kat
.
run
(
printout
=
0
,
printerr
=
0
)
[
run
,
perfdata
]
=
kat
.
run
(
printout
=
0
,
printerr
=
0
)
p
l
.
figure
(
)
p
ykat
.
profiling
.
plotReducedPerformanceData
(
perfdata
)
pl
.
plot
(
run
.
x
,
run
.
y
)
pl
.
xlabel
(
run
.
xlabel
)
pl
.
legend
(
run
.
ylabels
)
pl
.
show
()
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
23
−
3
View file @
c1513d04
...
...
@@ -89,6 +89,7 @@ class kat(object):
self
.
__phase
=
None
self
.
__maxtem
=
None
self
.
__noxaxis
=
None
self
.
__time_code
=
None
@property
def
maxtem
(
self
):
return
self
.
__maxtem
...
...
@@ -100,6 +101,11 @@ class kat(object):
@phase.setter
def
phase
(
self
,
value
):
self
.
__phase
=
int
(
value
)
@property
def
getPerformanceData
(
self
):
return
self
.
__time_code
@getPerformanceData.setter
def
getPerformanceData
(
self
,
value
):
self
.
__time_code
=
bool
(
value
)
@property
def
noxaxis
(
self
):
return
self
.
__noxaxis
@noxaxis.setter
...
...
@@ -147,7 +153,12 @@ class kat(object):
katfile
.
writelines
(
r
.
katScript
)
katfile
.
flush
()
kat_exec
=
"
{0} {1}
"
.
format
(
kat_exec
,
katfile
.
name
)
flags
=
""
if
self
.
__time_code
:
flags
=
flags
+
"
--perf-timing
"
kat_exec
=
"
{0} {1} {2}
"
.
format
(
kat_exec
,
flags
,
katfile
.
name
)
p
=
subprocess
.
Popen
(
kat_exec
,
stdout
=
subprocess
.
PIPE
,
...
...
@@ -180,7 +191,6 @@ class kat(object):
r
.
ylabels
=
hdr
[
1
:]
if
save_output
:
newoutfile
=
"
{0}.out
"
.
format
(
base
)
cwd
=
os
.
path
.
os
.
getcwd
()
...
...
@@ -209,7 +219,17 @@ class kat(object):
katfile
.
close
()
perfData
=
[]
if
self
.
__time_code
:
perffile
=
open
(
root
[
0
]
+
"
.perf
"
,
'
r
'
)
for
l
in
perffile
.
readlines
():
vals
=
l
.
strip
().
split
(
'
'
)
perfData
.
append
((
vals
[
0
],
float
(
vals
[
1
]),
float
(
vals
[
2
]),
float
(
vals
[
3
])))
return
[
r
,
perfData
]
else
:
return
r
def
add
(
self
,
obj
)
:
...
...
This diff is collapsed.
Click to expand it.
pykat/profiling.py
0 → 100644
+
26
−
0
View file @
c1513d04
import
numpy
as
np
import
pylab
as
pl
def
plotReducedPerformanceData
(
perfdata
,
ordered
=
False
):
labels
=
[]
times
=
[]
for
pd
in
perfdata
:
if
pd
[
0
]
in
labels
:
times
[
labels
.
index
(
pd
[
0
])]
+=
pd
[
3
]
else
:
labels
.
append
(
pd
[
0
])
times
.
append
(
pd
[
3
])
if
ordered
:
times
,
labels
=
(
list
(
t
)
for
t
in
zip
(
*
sorted
(
zip
(
times
,
labels
))))
ind
=
np
.
arange
(
len
(
labels
))
fig
=
pl
.
figure
()
plt
=
fig
.
add_subplot
(
111
)
plt
.
barh
(
ind
,
times
,
height
=
0.5
,
log
=
True
,
align
=
'
center
'
)
pl
.
yticks
(
ind
,
labels
)
pl
.
show
()
return
labels
,
times
\ No newline at end of file
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
c1513d04
...
...
@@ -9,7 +9,7 @@ from distutils.core import setup
setup
(
name
=
'
PyKat
'
,
version
=
'
0.0.
1
'
,
version
=
'
0.0.
2
'
,
author
=
'
Daniel Brown
'
,
author_email
=
'
ddb@star.sr.bham.ac.uk
'
,
packages
=
[
'
pykat
'
,
'
pykat.gui
'
,
'
pykat.gui.resources
'
],
...
...
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