Scilab Function
Last update : 23/8/2006

zernike_residuals - compute the zernike residual from Shack Hartmann centroid .

Calling Sequence

[znk]=zernike_residuals(rec_in,shc)

Parameters

Description

compute the zernike residual from Shack Hartmann centroid .

Examples

	nsubaps=16;
	areal_threshold=0.5;
	eigenvalue_threshold=1e-6;
	
	lenslet_x_axes=16;lenslet_y_axes=16;
	focal_length = .012246;lenslet_pitch = .000252;
	final_wf_pix_per_lenslet = 32;final_wf_pix_per_xform = 32;
	
    number=256;
	wavelength=1e-6;
	pixscl=.00002;

	WfH=wavefront_header(wavelength,pixscl,number);
	direction=three_vector(0,0,1);
	dwf=pl_wave(WfH,direction);
	
	D = 16*lenslet_pitch;
	AP=circle(D);
	dwf=aperture_transform(dwf,AP);
	
	LA=lnslt_array(lenslet_x_axes,lenslet_y_axes,focal_length,lenslet_pitch,final_wf_pix_per_lenslet,final_wf_pix_per_xform);
	dwf = lnslt_arr_transform(dwf,LA);
	dwf_fits(dwf,"lnslt_trans");
	
	shc=create_shcentroids(dwf,LA);
	shc_fits(shc,"shc");

	pitch = D/nsubaps;
	actuator_velocity = 100;

	dm_AP=circle(2*D);
	act_dim=nsubaps+1;	
	act=actuator_array(act_dim,act_dim,pitch,actuator_velocity);
	dm=ideal_dm(dm_AP,act);

	projection_modes=znk_mod(1);
	projection_modes=set_znk_cos_coef(projection_modes,1,1,1);
	projection_modes=set_znk_sin_coef(projection_modes,1,1,1);

	Reconstructor= reconstructor(AP,dm,LA,projection_modes,areal_threshold,eigenvalue_threshold);
	tt_residuals = zernike_residuals( Reconstructor, shc );
	znk_fits(tt_residuals,"tt_residuals");
 

Author

Chen jingyuan, Gan guangyong (IAPCM, Beijing,China.)

See Also

reconstructor ,   reconstructor_fits ,   zonal_residuals ,   reconstructor ,