public static correctionx line_corrections(double sigma, double w_est, double r_est)
	{
		
	correctionx result_corr = new correctionx();
	int   i_we,i_re;
	//boolean   is_valid;
	double a,b;
	int field;
	
	w_est = w_est/sigma;
	if (w_est < 2 || w_est > 6 || r_est < 0 || r_est > 1) 
	{
		result_corr.w = 0;		
		result_corr.h = 0;
		result_corr.correction = 0;
		result_corr.w_strong = 0;
		result_corr.w_weak = 0;
		result_corr.is_valid = true;
	  return result_corr;
	}
	i_we = (int) Math.floor((w_est-2)*10);
	i_re = (int) Math.floor(r_est*20);
	if (i_we == 40)
	 i_we = 39;
	if (i_re == 20)
	 i_re = 19;
	result_corr.is_valid = ctable[i_re][i_we][7]>0 && ctable[i_re][i_we+1][7]>0 &&
	          ctable[i_re+1][i_we][7]>0 && ctable[i_re+1][i_we+1][7]>0;
	
	a = (w_est-2)*10-i_we;
	b = r_est*20-i_re;
	
	field = 2; 
	result_corr.w =
			((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+ 
					   b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
			
			
	field = 3; 		
	result_corr.h =((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+ 
			   b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]));
	field = 4; 	
	result_corr.correction = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+ 
			   b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
	field = 5; 	
	result_corr.w_strong = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+ 
			   b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
	field = 6; 	
	result_corr.w_weak = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+ 
			   b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
	
	result_corr.is_valid = !result_corr.is_valid;
	return result_corr;
}