Updated documentation, descriptions for v1.0 release.

This commit is contained in:
yosata committed 2020-06-24 16:47:25 +02:00
1 parent 56051bb6a5
commit 8d50899db6
31 files changed
+17833 -192

No files matched your search

+144 -62
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env Python3
import numpy as np
'''
@ Author: Joost van den Born
@ Contact: born@astron.nl
@@ -17,14 +16,21 @@ def BarrellAndSears(l, T=288.15, p=101325, H=0):
For atmospheric air (i.e. CO2 = 300 ppm)
This equation is applicable for the ranges T=10-30C and p=720-800 mmHg.
Input:
l - Wavelength in microns
T - Temperature in Kelvin
p - Atmospheric pressure in Pa
H - fractional humidity (0=<H=<1)
Parameters
----------
l : float
Wavelength in microns
T : float
Temperature in Kelvin
p : float
Atmospheric pressure in Pascal
H : float
Relative humidity (0=<H=<1)
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
T = K2C(T)
P = hPA2mmHg(p/100)
@@ -39,11 +45,15 @@ def Ciddor(l, CO2=450):
At default conditions only. For more flexibility use
Observatory.n_tph()
Input:
l - Wavelength in microns
Parameters
----------
l : float
Wavelength in microns
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
s = 1 / l
R = 5792105 / (238.0185 - s**2) + 167917 / (57.362 - s**2)
@@ -59,11 +69,15 @@ def Edlen1953(l):
At standard conditions only
Input:
l - Wavelength in microns
Parameters
----------
l : float
Wavelength in microns
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
s = 1 / l
R = 6432.8 + 2949810 / (146 - s**2) + 25540/(41-s**2)
@@ -77,11 +91,15 @@ def Edlen1966(l):
At standard conditions only
Input:
l - Wavelength in microns
Parameters
----------
l : float
Wavelength in microns
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
s = 1 / l
R = 8342.13 + 2406030 / (130 - s**2) + 15997 / (38.9 - s**2)
@@ -95,14 +113,21 @@ def Owens(l, T=288.15, p=101325, H=0):
Note that the pressure P and H are in torricelli (Torr),
however, this is almost precisely 1 Torr = 1 mmHg
Input:
l - wavelength in micron
T - Temperature in Kelvin
p - Atmospheric pressure in Pa
H - Humdity (0<=H<=1)
Parameters
----------
l : float
wavelength in micron
T : float
Temperature in Kelvin
p : float
Atmospheric pressure in Pa
H : float
Humdity (0<=H<=1)
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
P = hPA2mmHg(p/100)
T = K2C(T)
@@ -116,14 +141,21 @@ def BonschPotulski(l, T=288.15, p=101325, CO2=450):
From Bonsch & Potulski, 1998
Equations 6, 7, 8
Input:
l - Wavelength in microns
T - Temperature in Kelvin
p - Atmospheric pressure in Pa
CO2 - Particles per million of CO2
Parameters
----------
l : float
Wavelength in microns
T : float
Temperature in Kelvin
p : float
Atmospheric pressure in Pa
CO2 : float
Particles per million of CO2
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
x = CO2 / 1e6
T = K2C(T)
@@ -143,11 +175,15 @@ def BirchDowns(l):
Only at standard conditions
Input:
l - wavelength in micron
Parameters
----------
l : float
wavelength in micron
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
s = 1 / l
R = 8342.54 + 2406147 / (130 - s**2) + 15998 / (38.9-s**2)
@@ -161,11 +197,15 @@ def PeckReeder(l):
Only at standard conditions
Input:
l - wavelength in micron
Parameters
----------
l : float
wavelength in micron
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
s = 1 / l
R = 8060.51 + 2480990 / (132.274 - s**2) + 17455.7 / (39.32957 - s**2)
@@ -180,18 +220,29 @@ def slalib(l, T=288.15, p=101325, H=0, h=0, lat=-24, tlr=0.0065, eps=1e-10):
They take the B&S refraction formula as a basis.
Requires the pySLALIB package to work.
Input:
l - Wavelength in microns
T - Temperature in Kelvin
p - Atmospheric pressure in Pa
H - fractional humidity (0=<H=<1)
h - Altitude of the observer (default=0 m)
lat - Latitude of the observer (default=-24)
tlr - temperature lapse rate (default=0.0065)
eps - precision at which the calculation is aborted (default=1e-10)
Parameters
----------
l : float
Wavelength in microns
T : float
Temperature in Kelvin
p : float
Atmospheric pressure in Pa
H : float
fractional humidity (0=<H=<1)
h : float
Altitude of the observer (default=0 m)
lat : float
Latitude of the observer (default=-24)
tlr : float
temperature lapse rate (default=0.0065)
eps : float
precision at which the calculation is aborted (default=1e-10)
Returns:
n - Refractive index of atmospheric air at the given conditions
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
try:
from pyslalib import slalib
@@ -215,17 +266,27 @@ def slalib(l, T=288.15, p=101325, H=0, h=0, lat=-24, tlr=0.0065, eps=1e-10):
def Mathar(l, T=288.15, p=101325, H=0):
'''
Refractivity model by Mathar (2007), valid above 1.4 microns
Code taken and modified from:
Code taken from
https://github.com/polyanskiy/refractiveindex.info-scripts/blob/master/scripts/Mathar%202007%20-%20Air%201.3-2.5um.py
(better known from refractiveindex.info). The code was subsequently
minimally modified to make it suitable for this package.
Input:
l - Wavelength in microns
T - Temperature in Kelvin
p - Atmospheric pressure in Pa
H - fractional humidity (0=<H=<1)
Returns:
n - Refractive index of atmospheric air at the given conditions
Parameters
----------
l : float
Wavelength in microns
T : float
Temperature in Kelvin
p : float
Atmospheric pressure in Pa
H : float
fractional humidity (0=<H=<1)
Returns
-------
n : float
Refractive index of atmospheric air at the given conditions
'''
if l < 1.3 or l > 24:
print('Using the Mathar model at this wavelength (l={:.3f}) is not recommended!'.format(l))
@@ -346,11 +407,32 @@ def Mathar(l, T=288.15, p=101325, H=0):
def K2C(K):
'''
Kelvin to Celsius conversion
Parameters
----------
K : float
Temperature in Kelvin
Returns
-------
C : float
Temperature in Celsius
'''
return K - 273.15
def hPA2mmHg(hPa):
'''
hPa to mmHg conversion
Parameters
----------
hPa : float
Atmospheric pressure in hPa (hecto Pascal)
Returns
-------
mmHg : float
Atmospheric pressure in mmHg
'''
return 0.7500616827 * hPa
return 0.7500616827 * hPa