mirror of
https://gitlab.astro-wise.org/micado/atmosphericmodel.git
synced 2026-10-30 05:01:02 +00:00
Fixed the full integration methods
This commit is contained in:
1 parent
dfa553c455
commit
3468a9159c
1 file changed
+38
-20
+38
-20
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env Python3
|
#!/usr/bin/env Python3
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import integrate
|
from scipy import integrate
|
||||||
|
from pdb import set_trace
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ Author: Joost van den Born
|
@ Author: Joost van den Born
|
||||||
@@ -755,6 +755,7 @@ class dispersion(Observatory):
|
|||||||
different atmosphere layers.
|
different atmosphere layers.
|
||||||
Recommended use with the US Standard Atmosphere from 1976.
|
Recommended use with the US Standard Atmosphere from 1976.
|
||||||
USSA1976 data generated from code supplied by http://www.pdas.com/atmos.html
|
USSA1976 data generated from code supplied by http://www.pdas.com/atmos.html
|
||||||
|
The method described in eq. 3 in Auer & Standish (2000) is used for the calculation.
|
||||||
'''
|
'''
|
||||||
if not R0:
|
if not R0:
|
||||||
R0 = self.rc
|
R0 = self.rc
|
||||||
@@ -770,19 +771,26 @@ class dispersion(Observatory):
|
|||||||
|
|
||||||
# Integration of the refraction integral over the atmosphere layers.
|
# Integration of the refraction integral over the atmosphere layers.
|
||||||
for _n in [n1, n2]:
|
for _n in [n1, n2]:
|
||||||
|
_Dens = np.asarray(_Dens)
|
||||||
|
_h = np.asarray(_h)
|
||||||
|
_R = R0 + _h * 1000
|
||||||
|
|
||||||
_refractionIntegralList = []
|
# Gladstone-Dale relation between refractive index and density
|
||||||
_nList = []
|
_n_h = 1 + (_n - 1) / _Dens[0] * _Dens
|
||||||
|
|
||||||
for _i in range(len(_h)):
|
# Calculation of the zenith angle for given height and refractive index, from the refractive invariant
|
||||||
_R = R0 + _h[_i]*1000
|
_z = np.arcsin( (_n * R0) / (_n_h * _R) * np.sin(z0) )
|
||||||
_n_h = 1 + (_n - 1) / _Dens[0] * _Dens[_i] # Gladstone-Dale relation between refractive index and density
|
|
||||||
_nList.append(_n_h)
|
|
||||||
_refractionIntegralList.append( (_n * R0 * np.sin(z0))/(_n_h*np.sqrt((_n_h*_R)**2 - (_n * R0 * np.sin(z0))**2 )) )
|
|
||||||
_dn = (_nList[0] - _nList[-1]) / ((len(_h)-1))
|
|
||||||
|
|
||||||
_rList.append(np.sum(np.degrees(np.asarray(_refractionIntegralList) * _dn)))
|
# Calculation of log space derivative of n and r
|
||||||
|
_lnn = np.log(_n_h)
|
||||||
|
_lnr = np.log(_R)
|
||||||
|
_dlnn = np.asarray([_lnn[i+1] - _lnn[i] for i in range(len(_lnn)-1)])
|
||||||
|
_dlnr = np.asarray([_lnr[i+1] - _lnr[i] for i in range(len(_lnr)-1)])
|
||||||
|
_dz = np.asarray([(_z[i] - _z[i+1]) for i in range(len(_z)-1)])
|
||||||
|
|
||||||
|
# Calculation of the integrand in eq. 3 in Auer & Standish
|
||||||
|
_Integrand = -1*(_dlnn/_dlnr) / (1 + _dlnn/_dlnr) * _dz
|
||||||
|
_rList.append(np.degrees(np.sum(_Integrand)))
|
||||||
return _rList[0] - _rList[1]
|
return _rList[0] - _rList[1]
|
||||||
|
|
||||||
|
|
||||||
@@ -1182,19 +1190,29 @@ class refraction(Observatory):
|
|||||||
_Dens = rhoData
|
_Dens = rhoData
|
||||||
_h = heightData
|
_h = heightData
|
||||||
|
|
||||||
_refractionIntegralList = []
|
|
||||||
_nList = []
|
|
||||||
z0 = np.deg2rad(z0)
|
z0 = np.deg2rad(z0)
|
||||||
|
_Dens = np.asarray(_Dens)
|
||||||
|
_h = np.asarray(_h)
|
||||||
|
_R = R0 + _h * 1000
|
||||||
|
|
||||||
# Integration of the refraction integral over the atmosphere layers.
|
# Gladstone-Dale relation between refractive index and density
|
||||||
for _i in range(len(_h)):
|
_n_h = 1 + (n0 - 1) / _Dens[0] * _Dens
|
||||||
_R = R0 + _h[_i]*1000
|
|
||||||
_n_h = 1 + (n0 - 1) / _Dens[0] * _Dens[_i] # Gladstone-Dale relation between refractive index and density
|
|
||||||
_nList.append(_n_h)
|
|
||||||
_refractionIntegralList.append( (n0 * R0 * np.sin(z0))/(_n_h*np.sqrt((_n_h*_R)**2 - (n0 * R0 * np.sin(z0))**2 )) )
|
|
||||||
_dn = (_nList[0] - _nList[-1]) / ((len(_h)-1))
|
|
||||||
|
|
||||||
return np.sum(np.degrees(np.asarray(_refractionIntegralList) * _dn))
|
# Calculation of the zenith angle for given height and refractive index, from the refractive invariant
|
||||||
|
_z = np.arcsin( (n0 * R0) / (_n_h * _R) * np.sin(z0) )
|
||||||
|
|
||||||
|
# Calculation of log space derivative of n and r
|
||||||
|
_lnn = np.log(_n_h)
|
||||||
|
_lnr = np.log(_R)
|
||||||
|
_dlnn = np.asarray([_lnn[i+1] - _lnn[i] for i in range(len(_lnn)-1)])
|
||||||
|
_dlnr = np.asarray([_lnr[i+1] - _lnr[i] for i in range(len(_lnr)-1)])
|
||||||
|
_dz = np.asarray([(_z[i] - _z[i+1]) for i in range(len(_z)-1)])
|
||||||
|
|
||||||
|
# Calculation of the integrand in eq. 3 in Auer & Standish
|
||||||
|
_Integrand = -1*(_dlnn/_dlnr) / (1 + _dlnn/_dlnr) * _dz
|
||||||
|
|
||||||
|
|
||||||
|
return np.degrees(np.sum(_Integrand))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user