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

Automatic label generation in plot_scan_sequence from counter or motor position #34

Open
AvonReppert opened this issue Nov 25, 2021 · 2 comments

Comments

@AvonReppert
Copy link

It would be very useful to have the option of an automatic generation of the graph labels from a pre-selected motor position (i.e. "fluence", "theta", "energy") or a selected counter (i.e. "T_sample") instead of passing the plot labels manually as it is done in this example:

scanSequence = [
        # scan list   ,  parameters
        [[491]        , '50 K'], 
        [[505]        , '70 K'],        
        [[518]        , '75 K'],
        [[520]        , '80 K'],
        [[521]        , '110 K'],   
        [[522]        , '130 K'],   
    ]    
plt.figure()

s.plot_scan_sequence(scanSequence,title_text =r"XMCD Dy40   on resonance  1295 eV $8\,\mathrm{\frac{mJ}{\,cm^2}}$",
                     sequence_type = "text", xtext = "t (ps)", ytext ="raw XMCD",
                     xlims=[tMin, tMax], ylims = [0,1])
@AvonReppert
Copy link
Author

AvonReppert commented Nov 25, 2021

The following semi-automatic label creation here works for me as a quick fix:

scanArray       = np.arange(418,435,1)
scanSequence = [ ]

for i, scan in enumerate(scanArray):
        data, meta = spec.get_scan_data(scan)
        t  = float(meta['init_mopo']["Delay"])-t0
        scanSequence.append([[scan], str(int(t)+ r'$\,$ps'])
        
plt.figure()
s.plot_scan_sequence(scanSequence, xtext=r'$q_\mathrm{z} \,\,\left(\AA^{-1}\right)$', fmt='-o',
                    binning=False, title_text="t-series 100 K 2.4mJ/cm² off resonace", grid_on=True,
                   ytext='Intensity',sequence_type = "text")
plt.show()

@dschick
Copy link
Owner

dschick commented Nov 28, 2021

Thanks a lot for the idea and the initial implementation.
You are very welcome to draft a PR.
Otherwise I will try to implement it in one of the future versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants