2015-05-04 from Kartik Ayyer:
Regarding my code, I have made a git repo public here: The code is in C. It is a complete mess and is not optimized as I have been tinkering with it. The main file is peakalign.c, and the functions you asked for are calc_phi(), calc_beta() and calc_merge(). My workflow has been Cheetah -> cxi file output -> Align -> Signal and background RZ merge -> Subtract background from signal. I have been posting my results on DESY confluence, which is unfortunately private, but Meng has access to it. |
fraser1.m - matlab code for doing the reciprocal space mapping. |
2015-04-30 Meng's link for the CFEL confluence that has the data analysis summary
Menng's matlab code fraser1.m, fraser2.m for Fraser transformation is implemented in python fraser.py (download).
Assumptions in implemented algorithm:
Example of diffraction and transformed images:
Using Kartik's formulas for angles phi and beta kartik-2-peak-ev-angles.py.txt one can get distributions:
In summary:
Solving equation for tan(theta) we may get functional dependence between x and y peak position for angles phi and theta,
funy(x,phi,beta) |
this function presents a solution of quadratic equation which has two roots. The root is selected depending on sign of theta angle...
This function is catheterized in python script fiber_angles.py and can be plotted for different angles:
Solutions: y1=-B+sqtr(B^2-C) and y2=-B-sqtr(B^2-C):
Similar function is used in data processing to fit peak (x,y) positions in equatorial region and use two angles as a fit parameters.
from scipy.optimize import curve_fit def funcy(x, phi_deg, bet_deg) : # ATTENTION! x is treated as numpy array..., # so function should also return numpy array of the same size <some parameterization> def procEventEqu() : # summary for event if sp.count_equ_pks_sel > 1 : yn = [-line[4] / L for line in sp.lst_equ_evt_peaks] xn = [ line[5] / L for line in sp.lst_equ_evt_peaks] #? yn.append(0) #? xn.append(0) en = np.ones_like(xn) p0 = [-3.1,-5.1] popt, pcov = curve_fit(funcy, xn, yn, p0, en) |
results of the fit to peaks found in each event gives distributions for two angles: