Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
9acf1206
Commit
9acf1206
authored
Dec 02, 2015
by
Daniel Brown
Browse files
updating plotting
parent
939d328e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
bin/test_plot.py
View file @
9acf1206
...
@@ -32,7 +32,7 @@ attr m1 Rc 1
...
@@ -32,7 +32,7 @@ attr m1 Rc 1
kat
=
finesse
.
kat
()
kat
=
finesse
.
kat
()
kat
.
parseCommands
(
code
)
kat
.
parseCommands
(
code
)
kat
.
add
(
xaxis
(
"l
in
"
,
[
0
,
360
],
kat
.
m2
.
phi
,
500
))
kat
.
add
(
xaxis
(
"l
og
"
,
[
1
,
360
],
kat
.
m2
.
phi
,
500
))
kat
.
m1
.
Rcx
=
-
1000.0
kat
.
m1
.
Rcx
=
-
1000.0
kat
.
m1
.
Rcy
=
-
1000.0
kat
.
m1
.
Rcy
=
-
1000.0
...
@@ -42,7 +42,5 @@ kat.m2.Rcy = 1000.0
...
@@ -42,7 +42,5 @@ kat.m2.Rcy = 1000.0
kat
.
maxtem
=
0
kat
.
maxtem
=
0
out
=
kat
.
run
()
out
=
kat
.
run
()
#fig = out.plot(yaxis="log abs:deg")
#fig.savefig("test_plot.pdf")
fig
=
out
.
plot
()
out
.
info
()
\ No newline at end of file
\ No newline at end of file
examples/pykat_plotting.ipynb
View file @
9acf1206
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
pykat/finesse.py
View file @
9acf1206
...
@@ -315,7 +315,7 @@ class katRun(object):
...
@@ -315,7 +315,7 @@ class katRun(object):
_func2
=
lambda
x
:
np
.
rad2deg
(
np
.
angle
(
x
))
_func2
=
lambda
x
:
np
.
rad2deg
(
np
.
angle
(
x
))
plot_cmd1
=
plot_cmd
plot_cmd1
=
plot_cmd
plot_cmd2
=
pyplot
.
plot
plot_cmd2
=
pyplot
.
plot
if
kat
.
xaxis
.
scale
==
"lin"
else
pyplot
.
semilogx
dual_plot
=
True
dual_plot
=
True
elif
"db:deg"
in
kat
.
yaxis
:
elif
"db:deg"
in
kat
.
yaxis
:
...
@@ -323,7 +323,7 @@ class katRun(object):
...
@@ -323,7 +323,7 @@ class katRun(object):
_func2
=
lambda
x
:
np
.
rad2deg
(
np
.
angle
(
x
))
_func2
=
lambda
x
:
np
.
rad2deg
(
np
.
angle
(
x
))
plot_cmd1
=
plot_cmd
plot_cmd1
=
plot_cmd
plot_cmd2
=
pyplot
.
plot
plot_cmd2
=
pyplot
.
plot
if
kat
.
xaxis
.
scale
==
"lin"
else
pyplot
.
semilogx
dual_plot
=
True
dual_plot
=
True
elif
"abs"
in
kat
.
yaxis
:
elif
"abs"
in
kat
.
yaxis
:
...
@@ -352,14 +352,14 @@ class katRun(object):
...
@@ -352,14 +352,14 @@ class katRun(object):
if
not
dual_plot
:
if
not
dual_plot
:
plot_cmd1
(
self
.
x
,
_func1
(
self
[
det
]),
label
=
det
)
plot_cmd1
(
self
.
x
,
_func1
(
self
[
det
]),
label
=
det
)
else
:
else
:
pyplot
.
subplot
(
2
,
1
,
1
)
ax
=
pyplot
.
subplot
(
2
,
1
,
1
)
l
,
=
plot_cmd1
(
self
.
x
,
_func1
(
self
[
det
]),
label
=
det
)
l
,
=
plot_cmd1
(
self
.
x
,
_func1
(
self
[
det
]),
label
=
det
)
pyplot
.
subplot
(
2
,
1
,
2
)
pyplot
.
subplot
(
2
,
1
,
2
)
plot_cmd2
(
self
.
x
,
_func2
(
self
[
det
]),
color
=
l
.
get_color
(),
ls
=
l
.
get_linestyle
(),
label
=
det
)
plot_cmd2
(
self
.
x
,
_func2
(
self
[
det
]),
color
=
l
.
get_color
(),
ls
=
l
.
get_linestyle
(),
label
=
det
)
if
dual_plot
:
if
dual_plot
:
pyplot
.
subplot
(
2
,
1
,
1
)
ax
=
pyplot
.
subplot
(
2
,
1
,
1
)
pyplot
.
xlabel
(
self
.
xlabel
,
fontsize
=
pyplot
.
rcParams
[
"font.size"
])
pyplot
.
xlabel
(
self
.
xlabel
,
fontsize
=
pyplot
.
rcParams
[
"font.size"
])
pyplot
.
xlim
(
self
.
x
.
min
(),
self
.
x
.
max
())
pyplot
.
xlim
(
self
.
x
.
min
(),
self
.
x
.
max
())
if
title
is
not
None
:
pyplot
.
title
(
title
,
fontsize
=
pyplot
.
rcParams
[
"font.size"
]
-
1
)
if
title
is
not
None
:
pyplot
.
title
(
title
,
fontsize
=
pyplot
.
rcParams
[
"font.size"
]
-
1
)
...
...
pykat/plotting.py
View file @
9acf1206
...
@@ -58,6 +58,8 @@ def init_pykat_plotting(mode="display", dpi=100):
...
@@ -58,6 +58,8 @@ def init_pykat_plotting(mode="display", dpi=100):
else
:
else
:
raise
(
BaseException
(
"Plotting mode must be either 'display' or 'paper'."
))
raise
(
BaseException
(
"Plotting mode must be either 'display' or 'paper'."
))
mpl
.
rcParams
[
'axes.color_cycle'
]
=
[
'b'
,
'r'
,
'k'
,
'g'
,
'c'
,
'm'
,
'y'
]
mpl
.
rcParams
[
'lines.linewidth'
]
=
1.2
mpl
.
rcParams
.
update
({
"figure.figsize"
:
(
6
,
3.708
)})
mpl
.
rcParams
.
update
({
"figure.figsize"
:
(
6
,
3.708
)})
mpl
.
rcParams
.
update
({
'font.size'
:
11
})
mpl
.
rcParams
.
update
({
'font.size'
:
11
})
mpl
.
rcParams
.
update
({
'figure.dpi'
:
__DPI__
})
mpl
.
rcParams
.
update
({
'figure.dpi'
:
__DPI__
})
...
@@ -67,7 +69,7 @@ def init_pykat_plotting(mode="display", dpi=100):
...
@@ -67,7 +69,7 @@ def init_pykat_plotting(mode="display", dpi=100):
mpl
.
rcParams
.
update
({
'axes.axisbelow'
:
True
})
mpl
.
rcParams
.
update
({
'axes.axisbelow'
:
True
})
mpl
.
rcParams
.
update
({
'grid.linewidth'
:
0.25
})
mpl
.
rcParams
.
update
({
'grid.linewidth'
:
0.25
})
mpl
.
rcParams
.
update
({
'grid.linestyle'
:
":"
})
mpl
.
rcParams
.
update
({
'grid.linestyle'
:
":"
})
mpl
.
rcParams
.
update
({
'grid.color'
:
(
0.
7
,
0.
7
,
0.
7
,
1
)})
mpl
.
rcParams
.
update
({
'grid.color'
:
(
0.
6
,
0.
6
,
0.
6
,
1
)})
mpl
.
rcParams
.
update
({
'savefig.bbox'
:
"tight"
})
mpl
.
rcParams
.
update
({
'savefig.bbox'
:
"tight"
})
mpl
.
rcParams
.
update
({
'savefig.pad_inches'
:
0.05
})
mpl
.
rcParams
.
update
({
'savefig.pad_inches'
:
0.05
})
mpl
.
rcParams
.
update
({
'xtick.labelsize'
:
"small"
})
mpl
.
rcParams
.
update
({
'xtick.labelsize'
:
"small"
})
...
...
Write
Preview
Supports
Markdown
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