def resscan(*hkles, **kwds): """Calculate and plot resolution at every given point. This is usually used via the `qscan()` and `qcscan()` commands with the plot='res' parameter. """ if not hkles: raise UsageError('use qscan(..., plot="res") to plot scan resolution') cfg, par = _resmat_args(hkles[0], kwds) session.log.info( 'plotting scan resolution in separate window, please wait...') session.clientExec(plot_resscan, (cfg, par, hkles))
def resplot(*args, **kwds): """Calculate and plot resolution at the current or the given Q/E point. Example: >>> resplot() # plot resolution at current Q/E point >>> resplot(1, 1, 0) # plot resolution at the given point >>> resplot(1, 1, 0, 5, kf=2.66) # at the given point with const kf = 2.66 Obviously, several sample and spectrometer parameters must be set correctly for the resolution calculation to work. """ cfg, par = _resmat_args(args, kwds) session.log.info('plotting resolution in separate window, please wait...') session.clientExec(plot_resatpoint, (cfg, par))
def hklplot(**kwds): """Plot a representation of the scattering plane with accessible Q space. Keyword arguments that can be given: * E -- energy transfer to calculate for * ki -- ki for constant-ki mode (default is current spectrometer setup) * kf -- kf for constant-kf mode * hkl -- a (h, k, l) tuple to plot * tauX -- a propagation vector as a (dh, dk, dl) tuple to plot from every nuclear Bragg point Examples: >>> hklplot() # basic plot of reciprocal space and nuclear Bragg peaks # plot the same, but at E = 1 (meV or THz) >>> hklplot(E=1) # plot the same, but at kf = 1.3 and E = 2 >>> hklplot(kf=1.3, E=1) # also plot (1, 0.5, 0) >>> hklplot(hkl=(1, 0.5, 0)) # also plot magnetic satellites tau1 and tau2 from each nuclear Bragg peak >>> hklplot(tau1=(0.28, 0.28, 0), tau2=(0.28, -0.28, 0)) """ cfg, par = _resmat_args((), kwds) tas = session.instrument tasinfo = { 'actpos': tas.read(), 'calpos': tas._last_calpos, 'philim': tas._attached_phi.userlimits, 'psilim': tas._attached_psi.userlimits, 'monolim': tas._attached_mono.userlimits, 'analim': tas._attached_ana.userlimits, 'alphalim': tas._attached_alpha and tas._attached_alpha.userlimits, 'phiname': tas._attached_phi.name, 'psiname': tas._attached_psi.name, } for p in [ 'scanmode', 'scanconstant', 'energytransferunit', 'scatteringsense', 'axiscoupling', 'psi360' ]: tasinfo[p] = getattr(tas, p) for p in ['lattice', 'angles', 'orient1', 'orient2', 'psi0', 'spacegroup']: tasinfo[p] = getattr(tas._attached_cell, p) session.clientExec(plot_hklmap, (cfg, par, tasinfo, kwds))