[AstroPy] Refractive index calculations (feedback request)

Derek Homeier derek@astro.physik.uni-goettingen...
Thu Feb 16 12:52:43 CST 2012


Thanks a lot for this contribution, Prasanth!

On 3 Feb 2012, at 11:22, Prasanth wrote:

> I have written a module in Python for calculating refractive index under different environmental conditions, and for converting wavelength of light between air and vacuum.  The code is based on the documentation for the  NIST online refractive index of air calculator.
> 
> It would be great to know how this compares to existing tools used by astronomers in their research level code. The function
> "ref_index._test_idlastro()" includes some comparison with IDLASTRO vac2air and air2vac procedures.
> 
I could only criticize that the test function remains silent when successful, i.e. 
it might perhaps print a short diagnostic message when it found no discrepancies 
between the two formulae.
I did some comparisons of the various equations; interestingly the older IDL astrolib routine, 
which is using Edlén's (1953) original formula

1.e8*(n-1) = 6432.8+2949810/(146-k^2)+25540/(41-k^2)

agrees already with the recommended (and adopted in current astrolib) Ciddor formula for 
standard conditions almost within numerical precision, whereas the later Edlén (1966) equation 
at NIST and in ref_index.edlen shows noticeably larger deviations. 

That said, all versions should probably satisfy typical astronomical requirements, 
especially as the optional parameters are just free bonus (at least I hope no one 
will ever have to observe at 60˚C, 99% rel. humidity or several % CO2-levels ;-).

Only one more suggestion to the code for now: I'd strongly recommend in expressions like 

    ns = 1 + 1e-8 * (A + B / (130.0 - S) + C / (38.9 - S))
    ntp = 1 + p * (ns - 1) * X / D

to cut the +1 from the definition of ns right away to save numerical precision (in edlen_ri()). 

Cheers,
					Derek
--
----------------------------------------------------------------
Derek Homeier          Centre de Recherche Astrophysique de Lyon
ENS Lyon                                      46, Allée d'Italie
69364 Lyon Cedex 07, France                       +33 47272-8894
----------------------------------------------------------------






More information about the AstroPy mailing list