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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
2fa2657c
Commit
2fa2657c
authored
Dec 18, 2020
by
Gamelin Alexis
Browse files
Options
Downloads
Patches
Plain Diff
Save dipole moment in WakePotential Monitor
parent
fe063632
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tracking/monitors/monitors.py
+17
-1
17 additions, 1 deletion
tracking/monitors/monitors.py
tracking/monitors/plotting.py
+10
-1
10 additions, 1 deletion
tracking/monitors/plotting.py
with
27 additions
and
2 deletions
tracking/monitors/monitors.py
+
17
−
1
View file @
2fa2657c
...
@@ -720,6 +720,9 @@ class WakePotentialMonitor(Monitor):
...
@@ -720,6 +720,9 @@ class WakePotentialMonitor(Monitor):
dict_file.update({
"
profile_
"
+ dim : (self.n_bin, total_size)})
dict_file.update({
"
profile_
"
+ dim : (self.n_bin, total_size)})
dict_buffer.update({dim : (self.n_bin, buffer_size)})
dict_buffer.update({dim : (self.n_bin, buffer_size)})
dict_file.update({dim : (self.n_bin, total_size)})
dict_file.update({dim : (self.n_bin, total_size)})
if dim ==
"
Wxdip
"
or dim ==
"
Wydip
"
:
dict_buffer.update({
"
dipole_
"
+ dim : (self.n_bin, buffer_size)})
dict_file.update({
"
dipole_
"
+ dim : (self.n_bin, total_size)})
self.monitor_init(group_name, save_every, buffer_size, total_size,
self.monitor_init(group_name, save_every, buffer_size, total_size,
dict_buffer, dict_file, file_name, mpi_mode)
dict_buffer, dict_file, file_name, mpi_mode)
...
@@ -741,16 +744,25 @@ class WakePotentialMonitor(Monitor):
...
@@ -741,16 +744,25 @@ class WakePotentialMonitor(Monitor):
tau0 = wp.__getattribute__(
"
tau0_
"
+ dim)
tau0 = wp.__getattribute__(
"
tau0_
"
+ dim)
profile0 = wp.__getattribute__(
"
profile0_
"
+ dim)
profile0 = wp.__getattribute__(
"
profile0_
"
+ dim)
WP0 = wp.__getattribute__(dim)
WP0 = wp.__getattribute__(dim)
if dim ==
"
Wxdip
"
:
dipole0 = wp.__getattribute__(
"
dipole_x
"
)
if dim ==
"
Wydip
"
:
dipole0 = wp.__getattribute__(
"
dipole_y
"
)
tau = np.linspace(tau0[0], tau0[-1], self.n_bin)
tau = np.linspace(tau0[0], tau0[-1], self.n_bin)
f = interp1d(tau0, WP0, fill_value = 0, bounds_error = False)
f = interp1d(tau0, WP0, fill_value = 0, bounds_error = False)
WP = f(tau)
WP = f(tau)
g = interp1d(tau0, profile0, fill_value = 0, bounds_error = False)
g = interp1d(tau0, profile0, fill_value = 0, bounds_error = False)
profile = g(tau)
profile = g(tau)
if dim ==
"
Wxdip
"
or dim ==
"
Wydip
"
:
h = interp1d(tau0, dipole0, fill_value = 0, bounds_error = False)
dipole = h(tau)
self.__getattribute__(
"
tau_
"
+ dim)[:, self.buffer_count] = tau + wp.tau_mean
self.__getattribute__(
"
tau_
"
+ dim)[:, self.buffer_count] = tau + wp.tau_mean
self.__getattribute__(
"
profile_
"
+ dim)[:, self.buffer_count] = profile
self.__getattribute__(
"
profile_
"
+ dim)[:, self.buffer_count] = profile
self.__getattribute__(dim)[:, self.buffer_count] = WP
self.__getattribute__(dim)[:, self.buffer_count] = WP
if dim ==
"
Wxdip
"
or dim ==
"
Wydip
"
:
self.__getattribute__(
"
dipole_
"
+ dim)[:, self.buffer_count] = dipole
self.buffer_count += 1
self.buffer_count += 1
...
@@ -774,6 +786,10 @@ class WakePotentialMonitor(Monitor):
...
@@ -774,6 +786,10 @@ class WakePotentialMonitor(Monitor):
self.file[self.group_name][dim][:,
self.file[self.group_name][dim][:,
self.write_count * self.buffer_size:(self.write_count+1) *
self.write_count * self.buffer_size:(self.write_count+1) *
self.buffer_size] = self.__getattribute__(dim)
self.buffer_size] = self.__getattribute__(dim)
if dim ==
"
Wxdip
"
or dim ==
"
Wydip
"
:
self.file[self.group_name][
"
dipole_
"
+ dim][:,
self.write_count * self.buffer_size:(self.write_count+1) *
self.buffer_size] = self.__getattribute__(
"
dipole_
"
+ dim)
self.file.flush()
self.file.flush()
self.write_count += 1
self.write_count += 1
...
...
This diff is collapsed.
Click to expand it.
tracking/monitors/plotting.py
+
10
−
1
View file @
2fa2657c
...
@@ -376,7 +376,7 @@ def plot_profiledata(filename, bunch_number, dimension="tau", start=0,
...
@@ -376,7 +376,7 @@ def plot_profiledata(filename, bunch_number, dimension="tau", start=0,
def
plot_wakedata
(
filename
,
bunch_number
,
wake_type
=
"
Wlong
"
,
start
=
0
,
def
plot_wakedata
(
filename
,
bunch_number
,
wake_type
=
"
Wlong
"
,
start
=
0
,
stop
=
None
,
step
=
None
,
profile_plot
=
False
,
streak_plot
=
True
,
stop
=
None
,
step
=
None
,
profile_plot
=
False
,
streak_plot
=
True
,
bunch_profile
=
False
):
bunch_profile
=
False
,
dipole
=
False
):
"""
"""
Plot data recorded by WakePotentialMonitor
Plot data recorded by WakePotentialMonitor
...
@@ -403,6 +403,8 @@ def plot_wakedata(filename, bunch_number, wake_type="Wlong", start=0,
...
@@ -403,6 +403,8 @@ def plot_wakedata(filename, bunch_number, wake_type="Wlong", start=0,
If True, strek plot is plotted.
If True, strek plot is plotted.
bunch_profile : bool, optional.
bunch_profile : bool, optional.
If True, the bunch profile is plotted.
If True, the bunch profile is plotted.
dipole : bool, optional
If True, the dipole moment is plotted.
Returns
Returns
-------
-------
...
@@ -445,6 +447,13 @@ def plot_wakedata(filename, bunch_number, wake_type="Wlong", start=0,
...
@@ -445,6 +447,13 @@ def plot_wakedata(filename, bunch_number, wake_type="Wlong", start=0,
scale
=
[
1
]
scale
=
[
1
]
label
=
[
"
$
\\
rho$ (a.u.)
"
]
label
=
[
"
$
\\
rho$ (a.u.)
"
]
if
dipole
==
True
:
tau_name
=
"
tau_
"
+
wake_type
wake_type
=
"
dipole_
"
+
wake_type
dimension_dict
=
{
wake_type
:
0
}
scale
=
[
1
]
label
=
[
"
Dipole moment (m)
"
]
else
:
else
:
tau_name
=
"
tau_
"
+
wake_type
tau_name
=
"
tau_
"
+
wake_type
...
...
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