forked from estonshi/spipy
-
Notifications
You must be signed in to change notification settings - Fork 3
analyse
YC.S edited this page Oct 12, 2018
·
25 revisions
+ :numpy.1darray = cal_q (detd:float, lamda:float, det_r:int, pixsize:int)
+ :numpy.ndarray = cal_q_pat (detd:float, lamda:float, pixsize:int, det_size:list, #center:list/None)
+ :numpy.1darray = cal_r (qlist:numpy.1darray, detd:float, lamda:float, det_r:int, pixsize:int)
+ :float = oversamp_rate (sample_size:float, detd:float, lamda:float, det_r:int, pixsize:int)
--
-
cal_q : calculate frequency q values, also known as (k'-k)/2pi, nm-1
- detd : distance between detector and sample, unit=mm
- lamda : wave length, unit=Angstrom
- det_r : the highest resolution (radius on detector) that you want to calculate to, unit=pixels
- pixsize : physical length of a detector pixel, unit=mm
--
-
cal_q_pat : calculate frequency q values of a pattern, also known as (k'-k)/2pi, nm-1
- detd : distance between detector and sample, unit=mm
- lamda : wave length, unit=Angstrom
- pixsize : physical length of a detector pixel, unit=mm
- det_size : (2D or 3D) pattern size, such as [size_x, size_y, size_z], unit=pixels
- #center : (2D or 3D) pattern center, such as [Cx, Cy, Cz], unit=pixels, default is None and det_size/2.0 is used as center
--
-
cal_r : calculate radius list on detector corresponding to a q-list
- qlist : input q list, numpy.ndarray, shape=(Nq,), unit is nm-1
--
-
oversamp_rate : calculate oversampling rate
- sample_size : diameter of your experiment sample, unit=nm
- detd : distance between detector and sample, unit=mm
- det_r : the highest resolution (radius on detector) that you want to calculate to, unit=pixels
- pixsize : physical length of a detector pixel, unit=mm
+ :(numpy.ndarray, ...) = grid (input_patt:numpy.ndarray)
+ :numpy.1darray = friedel_search (pattern:numpy.2darray, estimated_center:(int, int), #mask:numpy.2darray/None, #small_r:int/None, #large_r:int/None)
+ :numpy.1darray = inten_profile_vaccurate (dataset:numpy.3darray, mask:numpy.2darray, *exp_param:[...])
+ :numpy.1darray = inten_profile_vfast (dataset:numpy.3darray, mask:numpy.2darray, *exp_param:[...])
+ :numpy.2darray = cal_saxs (data:numpy.3darray)
+ :[numpy.2darray, numpy.2darray] = centering (pat:numpy.2darray, estimated_center:list or array, #mask:numpy.2darray/None, #small_r:int/None, #large_r:int/None)
+ :[float, numpy.1darray] = particle_size (saxs:numpy.2darray, estimated_center:list or array, #exparam:str/None, #high_filter_cut:float/0.3, #power:float/0.7, #mask:numpy.2darray/None)
+ :numpy.1darray = particle_size_sp (dataset:numpy.3darray, exparam:list or array, fitarea:list or array, badsearchr:int, method:str, #mask:numpy.2darray, #center:list or array, #verbose:bool)
--
-
grid : return x and y indices of a pattern/volume
- input_patt : input pattern or volume. If it is a pattern, then returned value consists two 2d-arrays, one is the x coordinates of every pixels, and the other is y coordinates. If input is a scattering volume, then returned value consists 3 3d-arrays.
--
-
friedel_search : return the center point (zero frequency) of a pattern, numpy.array([Cx,Cy])
- pattern : input pattern. Check there is no nan or inf values.
- estimated_center : an estimated center, (Cx',Cy'), the max deviation between estimated and real center should be less than 2*small_r
- #mask : 0/1 binary pattern, shape=(Nx, Ny), 1 means masked area, 0 means useful area, default=None
- #small_r : int, radius of search area of center allocation candidates, in pixels, default=None and the program will choose a value dynamically (but <20)
- #large_r : int, radius of area for sampling frediel twin points, in pixels, default=None and the program will choose large_r=(pattern.shape/4)
--
-
inten_profile_vaccurate : return the averaged intensity radial profile. shape=(2,Nq), the first colum is q value while the second one is radial intensities. This function processes every image so it is more accurate, but PRETTY SLOW
- dataset : patterns, shape=(Nd,Nx,Ny)
- mask : 0/1 binary pattern, shape=(Nx, Ny), 1 means masked area, 0 means useful area, set None to ignore
- *exp_param : for calculating q value, please give all experiment parameters required in spipy.analyse.q.cal_q
--
-
inten_profile_vfast : fast calculation of intensity profile, RECOMENDED
- [The same parameters with inten_profile_vaccurate]
--
-
cal_saxs : return averging pattern of a pattern set
- data : input pattern set, shape=(Nd,Nx,Ny)
--
-
centering : shift the input pattern to its center, output pattern is a part of original one. The output is a list [newpat : a numpy.2darray with shape=(Nx',Ny'), newmask : output mask with shape=(Nx'Ny')]
- pat : input pattern, shape=(Nx,Ny)
- estimated_center : the estimated center of original pattern, see its requirements in friedel_search function
- #mask : 0/1 binary pattern, shape=(Nx, Ny), 1 means masked area, 0 means useful area, default=None
- #small_r : see 'friedel_search', default=None
- #large_r : see 'friedel_search', default=None
--
-
particle_size : estimate particle size through saxs pattern, this function uses self-correlation transformation method to estimate particle size. Output is a list, [ particle_size (float), auto_correlation_radial_profile (shape=(Np,2)) ]
- saxs : input saxs pattern, 2darray shape=(Nx,Ny)
- estimated_center : estimated center of saxs pattern, list or array (Cx,Cy)
- #exparam : experimental parameters, str, 'detector-sample distance(mm),lambda(A),pixel length(mm)', such as '578,7.9,0.3', default=None
- #high_filter_cut : float between (0,1), which determine the FWHM of high pass filter, larger value means smaller filter width, default=0.3
- #power : positive float 0~1, a power conducted on pattern to enhance the contribution of high q data, default=0.7
- #mask : 0/1 binary pattern, shape=(Nx, Ny), 1 means masked area, 0 means useful area, default=None
- [NOTICE] RECOMMOND to watch auto-correlation radial profile and find the locations of peaks, which are most trustable values of possible particle sizes. auto_correlation_radial_profile is a 2-d array, where the 1st colum is particle size in nm (if exparam is given) and 2nd colum is the auto-correlation value.
- [NOTICE] if your give exparam, the output particle_size is in nanometer; otherwise it is in pixels.
--
-
particle_size_sp : fit the diameter of spherical-like samples by using Iq curve of their SPI patterns, return diameters, shape=(Nd,)
- dataset : patterns, numpy array, shape=(Nd, x, y)
- exparam : the set-up parameters of experiment, a list [detector-distance(mm), lambda(A), pixel-length(mm)]
- fitarea : a list [nr, nR], define an ROI where the radius is between nr and nR, and use it to do the fitting
- badsearchr : int, if there are more than 10 peaks within badsearchr (in fit area), the pattern will be dropped, unit=pixel
- method : fitting method, str, chosen from 'q0' (use the first Iq minimum position to estimate diameter) and 'lsq' (fit theoretical Iq curve to given patterns and estimate diameter), default = 'q0'
- #mask : 0/1 binary pattern, shape=(Nx, Ny), 1 means masked area, 0 means useful area, default=None
- #center : center of diffraction patterns, list/array, default = None and the program will search center automatically for every pattern
- #verbose : bool, whether to display progress bar, default = True
+ :[numpy.2darray, numpy.2darray] = Sphere_randp (algo:str, radius:float, num:int)
+ :[numpy.2darray, numpy.2darray] = proc_Hammer (qlist:numpy.2darray, data:numpy.1darray)
+ :void = draw_Hammer (logi_lati:numpy.2darray, #save_dir:str/None)
+ :void = draw_ori_Df (ori_bin:str, q_level:int)
--
-
Sphere_randp : return random/uniform distributed points on a pherical surface, shape=[np.numpy(Np,3), np.numpy(Np,2)]
- algo : algorithm, string "random" or "uniform-1" or "uniform-2"
- radius : radius of the sphere, unit=pixels
- num : numbers of points you want to generate
- [NOTICE] "uniform-1" is standard Fibonacci spherical mapping, "uniform-2" is modified Fibonacci spherical mapping. There are slightly differences between them. "uniform-2" will be a little barycentric, and the output number of points is not exactly equal to input "num".
--
-
proc_Hammer : transfer quaternions to Aitoff-Hammer projection coordinates, return [ numpy.array( [ logitute[..], latitute[..], value[..] ] ), numpy.array( [ x[..], y[..], value[..] ] ) ]
- qlist : quaternion list, numpy.array( [ w[..], qx[..], qy[..], qz[..] ] ); or xyz coordinates, numpy.array( [ x[..], y[..], z[..] ] ). That is, shape=(Nq, 4) or (Nq,3)
- [Notice] w = cos(the/2) , q? = ? * sin(theta/2). BE CAREFUL of the order!
- data : the corresponding value for every quaternion (orientation), this function do not care what these values really mean. shape=(Nq,1)
--
-
draw_Hammer : draw figure to show distribution of quaternions with corresponding values
- logi_lati : Logitute, latitute and value, shape=(Nq,3) ( The first output of proc_Hammer )
- #save_dir : string, the path if you want to save figure. default is None
--
-
draw_ori_Df : draw figure to show orientation distribution of DragonFly output
- ori_bin : string, path of output 'orientation_xxx.bin' file from spipy.merge.emc
- q_level : the 'num_div' parameter used in spipy.merge.emc
+ :numpy.1darray = sp_hamonics (data:{'volume':numpy.3darray, 'mask':numpy.3darray}, r:float, #L:int/10)
--
-
sp_harmonics : spherical harmonics expansion of a 3D model, return Cl, shape=(L,)
- data : { 'volume' : intensity voxel data, 'mask' : mask voxel data }, if no mask please set 'mask' : None
- r : radius of the shell you want to expand, unit=pixels
- #L : level of hamonics, recommended >=10, default=10
+ :float = r_factor (F_cal:numpy.3darray, F_obs:numpy.3darray)
+ :numpy.1darray = r_factor_shell (F_cal:numpy.3darray, F_obs:numpy.3darray, rlist:list/np.1darray)
+ :numpy.1darray = fsc (F1:numpy.3darray, F2:numpy.3darray, rlist:list or array)
+ :numpy.1darray = r_split (F1:numpy.3darray, F2:numpy.3darray, rlist:list or array)
+ :numpy.1darray = Pearson_cc (exp_d:numpy.ndarray, ref_d:numpy.ndarray, axis:int)
+ :numpy.1darray = PRTF (phased_reciprocal:numpy.3darray or 4darray, center:list or tuple, #mask:numpy.2darray or 3darray/None)
--
-
r_factor : overall r-factor of two models, return a float~[0,1]
- F_cal : voxel models from calculation
- F_obs : voxel models from observation
--
-
r_factor_shell : r-factor of shells with different radius between two models, return an array containing r-factors of all shells
- F_cal : voxel models from calculation
- F_obs : voxel models from observation
- rlist : radius list of shells
--
-
fsc : Fourier Shell Correlation between two models (in frequency space), return an array containing correlations of all shells
- F1 : the first voxel model
- F2 : the second voxel model
- rlist : radius list of shells
--
-
r_split : r-split factors between two models (in frequency space), return r-split ,an numpy array, the same shape with rlist
- F1 : the first voxel model
- F2 : the second voxel model
- rlist : radius list of shells
--
-
Pearson_cc : Pearson correlation coefficient between two arrays, output pearsoncc, a numpy array, dimension=N-1(N is the dimension of input array)
- exp_d : the first (numpy) array, dimension=N
- ref_d : the second (numpy) array, same dimension with exp_d
- #axis : use which axis to calculate cc, default is -1 (the last dimension), if axis!=-1 then use all dimensions
--
-
PRTF : Phase Retrieval Transfer Function of phased dataset (2D/3D), return radial profile of PRTF matrix, shape=(Np,)
- phased_reciprocal : the reciprocal dataset after N times' independent phasing, dtype=numpy.complex128, shape=(N,Npx,Npy) (2d data) or shape=(N,Npx,Npy,Npz) (3d data)
- center : the center of phased dataset (zero frequency)
- #mask : dataset mask, shape=(Npx,Npy) or shape=(Npx,Npy,Npz), NOTE 1 means masked area, default is None
+ :numpy.2darray = eul2rotm (ea:list/np.1darray, order:str)
+ :numpy.3darray = rot_ext (ea:list/nump.1darray, order:str, matrix:numpy.3darray, #ref:numpy.3darray/None)
+ :(float, list, numpy.3darray) = align (fix:numpy.3darray, mov:numpy.3darray, #grid_unit:list/[0.3,0.1], #nproc:int/2, #resize:int/40, #order:str/'zxz')
--
-
eul2rotm : transfer euler angles to rotation matrix in intrinsic order, return 3x3 rotation matrix
- ea : euler angles, intrinsic rotation, unit = rad
- order : rotation order, such as 'zxz', 'zyz' or 'xyz'
--
-
rot_ext : do an extrinsic rotation to a 3D voxel model, return rotated model
- ea : euler angles, extrinsic rotation, unit = rad
- order : rotation order, such as 'zxz', 'zyz', 'xyz'
- matrix : input voxel model in 3d matrix
- #ref : reference model in 3d matrix, if given, program will compare rotated model with reference by ploting their x/y/z slices. default is None
--
-
align : Using grid search (euler angles) to align two models, return (r_factor : overall r-factor between fixed and best aligned mov model , ea : best aligned euler angle , new_mov : mov model after aligned)
- fix : fixed model
- mov : rotated model while aligning
- #grid_unit : grid size (in rad) of alpha,beta,gamma euler angles. This is a list, default=[0.3, 0.1], which means the program will firstly search with grid_size = 0.3 rad, then fine-tune around the euler angles it just gets that best align two models with smaller grid_size (= 0.1 rad). Of course you can use more loops such as [0.3, 0.1, 0.02, ...]
- #nproc : number of processes to run in parallel, NOTE that the program parallels in alpha angles, default=2
- #resize : resize your input models to a smaller size to accelerate, default=40 pixels
- #order : rotation order while aligning, default='zxz'
- [NOTICE] range of three euler angles : alpha [0, 2pi); beta [0, pi); gamma [0, 2pi)
Any questions or bug report please contact [email protected]