Calculating the extinction coefficient