Skip to content

Commit

Permalink
Merge pull request #23 from SixTrack/master
Browse files Browse the repository at this point in the history
Small
  • Loading branch information
giadarol authored Jun 13, 2019
2 parents 215a4c4 + b2a4f03 commit bad595f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
partCO=partCO, Dx_wrt_CO_m=np.array([Dx_m, Dx_m]), Dpx_wrt_CO_rad=Dpx_rad,
Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad,
Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns)
dict_tbt['ST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
dict_tbt['ST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
[x_tbt_ST, px_tbt_ST, y_tbt_ST, py_tbt_ST, sigma_tbt_ST, delta_tbt_ST])}
print('Tracking STlib')
x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl = hp.track_particle_sixtracklib(
line, partCO=partCO, Dx_wrt_CO_m=np.array([Dx_m, Dx_m]), Dpx_wrt_CO_rad=Dpx_rad,
Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad,
Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns)
dict_tbt['STlib'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
dict_tbt['STlib'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
[x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl])}
print('Tracking PyST')
x_tbt_pyST, px_tbt_pyST, y_tbt_pyST, py_tbt_pyST, sigma_tbt_pyST, delta_tbt_pyST = hp.track_particle_pysixtrack(
line, part=part, Dx_wrt_CO_m=Dx_m, Dpx_wrt_CO_rad=Dpx_rad,
Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad,
Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns, verbose=True)
dict_tbt['PyST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
dict_tbt['PyST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(),
[x_tbt_pyST, px_tbt_pyST, y_tbt_pyST, py_tbt_pyST, sigma_tbt_pyST, delta_tbt_pyST])}

plt.close('all')
Expand Down Expand Up @@ -87,7 +87,7 @@
axdelta.plot(delta_tbt_STl[:, 0], label='STl')
axdelta.set_ylabel('$\delta$')
axdelta.set_xlabel('Turn number')
axdelta.legend().draggable()
axdelta.legend()#.draggable()

for ax in [axx, axy, axpx, axpy, axsigma, axdelta]:
ax.ticklabel_format(style='sci', scilimits=(0, 0), axis='y')
Expand All @@ -103,10 +103,10 @@

# Compute errors, choose implementations to comapare

ref = 'ST'
ref = 'ST'
test = 'STlib'

for ax, coord in zip([axerrx, axerry, axerrpx, axerrpy, axerrsigma,
for ax, coord in zip([axerrx, axerry, axerrpx, axerrpy, axerrsigma,
axerrdelta], 'x y px py sigma delta'.split()):
ax.plot(np.abs(dict_tbt[test][coord] - dict_tbt[ref][coord])[:, 0])
ax.set_ylabel(coord)
Expand Down
8 changes: 4 additions & 4 deletions examples/python/test_workflow_footprint/003_footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
track_with = 'PySixtrack'
# track_with = 'Sixtrack'
track_with = 'Sixtracklib'
device_opencl = '0.0'
#device = 'opencl:1.0'
device_opencl = None

n_turns = 100
Expand Down Expand Up @@ -49,12 +49,12 @@
x_tbt, px_tbt, y_tbt, py_tbt, sigma_tbt, delta_tbt = hp.track_particle_sixtracklib(
line=line, partCO=partCO, Dx_wrt_CO_m=0., Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(),
Dy_wrt_CO_m=0., Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(),
Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns, device_opencl=device_opencl)
Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns, device=device)
info = track_with
if device_opencl is None:
if device is None:
info += ' (CPU)'
else:
info += ' (GPU %s)'%device_opencl
info += ' (GPU %s)'%device
else:
raise ValueError('What?!')

Expand Down
6 changes: 3 additions & 3 deletions examples/python/test_workflow_footprint/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def track_particle_sixtracklib(
line, partCO, Dx_wrt_CO_m, Dpx_wrt_CO_rad,
Dy_wrt_CO_m, Dpy_wrt_CO_rad,
Dsigma_wrt_CO_m, Ddelta_wrt_CO, n_turns,
device_opencl=None):
device=None):


Dx_wrt_CO_m, Dpx_wrt_CO_rad,\
Expand Down Expand Up @@ -245,10 +245,10 @@ def track_particle_sixtracklib(

p.from_pysixtrack(part, i_part)

if device_opencl is None:
if device is None:
job = pysixtracklib.TrackJob(elements, ps)
else:
job = pysixtracklib.TrackJob(elements, ps, device=device_opencl)
job = pysixtracklib.TrackJob(elements, ps, device=device)

job.track(n_turns)
job.collect()
Expand Down

0 comments on commit bad595f

Please sign in to comment.