Content

Analysis of cxif5315

Comments and references to code

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.

 

2015-05-04 from Meng:

 

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

 

 

Fraser transformation in python

Assumptions in implemented algorithm:

  • detector plane is transverse to the beam
  • by default image center (sizex/2, sizey/2) coincides with origin for transformation. Non-default center can be set to different point.

 

Example of diffraction and transformed images: 

 

Angles phi and beta using Kartik's code

Using Kartik's formulas for angles phi and beta kartik-2-peak-ev-angles.py.txt one can get distributions:

 

In summary:

  • angle phi is evaluated using two peak positions and sample-to-detector distance
  • angle beta is evaluated using one !!! peak position and angle phi.
  • peak and event selection need to be improved
  • it could be nice to have explanation to this formalism...

Angles phi and beta from fit

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)

(warning) this function presents a solution of quadratic equation which has two roots. The root is selected depending on sign of theta angle...(question)

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:

  • No labels