Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mbtrack2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
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
PA
Collective Effects
mbtrack2
Commits
d756f5a2
Commit
d756f5a2
authored
1 year ago
by
Alexis GAMELIN
Browse files
Options
Downloads
Patches
Plain Diff
[Fix] Bunch.plot_phasespace
Now works correctly for up to date version of seaborn.
parent
f4d6abe9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mbtrack2/tracking/particles.py
+10
-21
10 additions, 21 deletions
mbtrack2/tracking/particles.py
with
10 additions
and
21 deletions
mbtrack2/tracking/particles.py
+
10
−
21
View file @
d756f5a2
...
...
@@ -366,7 +366,7 @@ class Bunch:
ax
=
fig
.
gca
()
ax
.
plot
(
center
,
profile
)
def
plot_phasespace
(
self
,
x_var
=
"
tau
"
,
y_var
=
"
delta
"
,
plot_type
=
"
j
"
):
def
plot_phasespace
(
self
,
x_var
=
"
tau
"
,
y_var
=
"
delta
"
,
kind
=
"
scatter
"
):
"""
Plot phase space.
...
...
@@ -376,9 +376,9 @@ class Bunch:
Dimension to plot on horizontal axis.
y_var : str
Dimension to plot on vertical axis.
plot_type
: str {
"
j
"
,
"
sc
"
}
Type of the plot. The defualt value is
"
j
"
for a joint plot
.
Can be modified to
"
sc
"
for a
scatter
plot
.
kind
: str
,
{
"
scatter
"
,
"
kde
"
,
"
hist
"
,
"
hex
"
,
"
reg
"
,
"
resid
"
}
Kind of plot to draw. See seeborn documentation
.
The defualt value is
"
scatter
"
.
Return
------
...
...
@@ -389,23 +389,12 @@ class Bunch:
label_dict
=
{
"
x
"
:
"
x (mm)
"
,
"
xp
"
:
"
x
'
(mrad)
"
,
"
y
"
:
"
y (mm)
"
,
"
yp
"
:
"
y
'
(mrad)
"
,
"
tau
"
:
"
$
\\
tau$ (ps)
"
,
"
delta
"
:
"
$
\\
delta$
"
}
scale
=
{
"
x
"
:
1e3
,
"
xp
"
:
1e3
,
"
y
"
:
1e3
,
"
yp
"
:
1e3
,
"
tau
"
:
1e12
,
"
delta
"
:
1
}
if
plot_type
==
"
sc
"
:
fig
,
ax
=
plt
.
subplots
()
ax
.
scatter
(
self
.
particles
[
x_var
]
*
scale
[
x_var
],
self
.
particles
[
y_var
]
*
scale
[
y_var
])
ax
.
set_xlabel
(
label_dict
[
x_var
])
ax
.
set_ylabel
(
label_dict
[
y_var
])
elif
plot_type
==
"
j
"
:
fig
=
sns
.
jointplot
(
self
.
particles
[
x_var
]
*
scale
[
x_var
],
self
.
particles
[
y_var
]
*
scale
[
y_var
],
kind
=
"
kde
"
)
plt
.
xlabel
(
label_dict
[
x_var
])
plt
.
ylabel
(
label_dict
[
y_var
])
else
:
raise
ValueError
(
"
Plot type not recognised.
"
)
fig
=
sns
.
jointplot
(
x
=
self
.
particles
[
x_var
]
*
scale
[
x_var
],
y
=
self
.
particles
[
y_var
]
*
scale
[
y_var
],
kind
=
kind
)
plt
.
xlabel
(
label_dict
[
x_var
])
plt
.
ylabel
(
label_dict
[
y_var
])
return
fig
...
...
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