The invention relates to a method and apparatus for calculating a laser shot file for use in an excimer laser comprising the steps of providing information with respect to a desired ablation profile, calculating the shot density of the desired ablation profile, using a cost function for placing laser shots of the excimer laser on grid positions wherein a threshold value is determined based on the calculated shot density of the desired ablation profile.