Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get freqmap #756

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Add get freqmap #756

wants to merge 17 commits into from

Conversation

oscarxblanco
Copy link
Contributor

Dear all,
this is a Work-In-Progress branch open to address the limitations on the frequency map analysis found by @TeresiaOlsson and mentioned here #755.

No need to review yet.

@oscarxblanco oscarxblanco added the WIP work in progress label Apr 17, 2024
@oscarxblanco
Copy link
Contributor Author

Dear @TeresiaOlsson ,

here is a script you could use to start the test on the function get_freqmap. Please, try it with a ring you have.
This function runs well on the axes ['x','y']. It also works on ['x','dp'] but I have not checked if the results make sense.

Best regards,
o

''' 
This file is used to test the new function get_freqmap
oblanco 2024apr16
'''
import at
import numpy
from matplotlib import pyplot as plt

print(f'{at.__version__}=')

ring = at.load_mat('testring.mat')
# ring.disable_6d()
print(f'{ring.get_tune()=}')

fmaout = at.get_freqmap(ring,
                     ['x','y'],
                     numpy.array([200,200]),
                     numpy.array([10e-3,10e-3]),
                     bounds=[[-1,1],[0,1]],
                     verbose=True,
                     )

fmadata = fmaout[0][0]

print('Plot')
# plot diffusion map
fig = plt.figure()
sc = plt.scatter(1e3*fmadata[:,0],1e3*fmadata[:,1],c=fmadata[:,6],s=1)
plt.grid()
plt.xlabel(r'x (mm)')
plt.ylabel(r'y (mm)')
plt.xlim(-10,10)
plt.ylim(-5,5)
clb = plt.colorbar(sc)
clb.ax.set_title(r'$\log_{10} \sqrt{(\Delta\nu_x^2 + \Delta\nu_y^2)/turn}$')
plt.savefig('diffussionmap.pdf')


# plot frequency map
fig = plt.figure()
sc = plt.scatter(fmadata[:,2],fmadata[:,3],c=fmadata[:,6],s=1)
plt.grid()
plt.xlim(0,0.5)
plt.ylim(0,0.5)
plt.xlabel(r'$\nu_x$')
plt.ylabel(r'$\nu_y$')
clb = plt.colorbar(sc)
clb.ax.set_title(r'$\log_{10} \sqrt{(\Delta\nu_x^2 + \Delta\nu_y^2)/turn}$')
plt.savefig('fmap.pdf')

@oscarxblanco oscarxblanco added the Python For python AT code label Apr 17, 2024
@oscarxblanco
Copy link
Contributor Author

Dear @TeresiaOlsson ,
I might be back to this request on the following days. Have you tried this function ?
Do you have any suggestion ?

Best regards,
o

@oscarxblanco
Copy link
Contributor Author

Dear @swhite2401 and @lfarv ,
in order to parallelize the frequency map I would need to use a large amount of memory to store the data of the turn by turn tracking. @swhite2401 proposed to track by chunks of particles (#811 (comment) )
At the moment I use psutils to estimate the free memory, and adjust the chunk size accordingly, but, it seems that is not yet used or installed. Could we included ? Or is there another package that could give the free memory information ? Or is there another solution to check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python For python AT code WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants