mirror of
https://gitlab.astro-wise.org/micado/atmosphericmodel.git
synced 2026-10-30 05:01:02 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7588bb7fc7 | ||
|
|
c07d42c1fd | ||
|
|
3e5224e8bb | ||
|
|
4ee1ee662e | ||
|
|
f6d13a624f | ||
|
|
3ff1af98e0 | ||
|
|
ee7134da7d | ||
|
|
27abba5f5d |
No files matched your search
@@ -1,3 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
__pychache__/
|
__pychache__/
|
||||||
.ipynb_checkpoints/
|
.ipynb_checkpoints/
|
||||||
|
dist/
|
||||||
|
AstroAtmosphere.egg-info/
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -387,6 +387,73 @@ class dispersion(Observatory):
|
|||||||
return np.degrees(_dispersionError)
|
return np.degrees(_dispersionError)
|
||||||
|
|
||||||
|
|
||||||
|
def independentCassiniError(self, n1, n2, zenith, dn1=0, dn2=0, dz=0,
|
||||||
|
lat=None, h=None):
|
||||||
|
'''
|
||||||
|
Calculates the uncertainty in the atmospheric dispersion,
|
||||||
|
following the Cassini model, without assumptions about the
|
||||||
|
refractivity model.
|
||||||
|
This involves a much shorter use the chain rule.
|
||||||
|
|
||||||
|
Not taken into account is the errror propagation in the scale height
|
||||||
|
of the atmosphere, from my results this should give a small or even
|
||||||
|
negligible difference.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
n1 : float
|
||||||
|
Refractive index at the first wavelength of interest at the
|
||||||
|
observer
|
||||||
|
n2 : float
|
||||||
|
Refractive index at the second wavelength of interest at the
|
||||||
|
observer
|
||||||
|
zenith : float
|
||||||
|
Angle of observation in degrees.
|
||||||
|
zenith = 0 means the observation is directly overhead.
|
||||||
|
dn1 : float
|
||||||
|
Uncertainty in the provided value of the refractive index
|
||||||
|
at the first wavelength
|
||||||
|
dn2 : float
|
||||||
|
Uncertainty in the provided value of the refractive index
|
||||||
|
at the second wavelength
|
||||||
|
dz : float (default: 0)
|
||||||
|
Uncertainty in the zenith angle, in degrees.
|
||||||
|
lat : float (default: None)
|
||||||
|
If entered, overrides the latitude attribute of the class.
|
||||||
|
h : float (default=None)
|
||||||
|
If entered, overrides the altitude attribute of the class.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
dRR : float
|
||||||
|
Uncertainty in the atmospheric dispersion in degrees.
|
||||||
|
'''
|
||||||
|
if lat == None:
|
||||||
|
lat = self.lat
|
||||||
|
else:
|
||||||
|
self.lat = lat
|
||||||
|
if h == None:
|
||||||
|
h = self.h
|
||||||
|
else:
|
||||||
|
self.h = h
|
||||||
|
|
||||||
|
# Some precalculation and variable setting
|
||||||
|
_zenith = np.deg2rad(zenith)
|
||||||
|
_dz = np.deg2rad(dz)
|
||||||
|
_R = self.rc
|
||||||
|
_H = self.H
|
||||||
|
|
||||||
|
# Partial derivatives for derivation to n1, n2, and z
|
||||||
|
_dddn1 = - _R * np.sin(_zenith) / ( (_R + _H) * np.sqrt(1 - (n1 * _R * np.sin(_zenith) / (_R + _H))**2 ) )
|
||||||
|
_dddn2 = _R * np.sin(_zenith) / ( (_R + _H) * np.sqrt(1 - (n2 * _R * np.sin(_zenith) / (_R + _H))**2 ) )
|
||||||
|
_dddz = (_R * np.cos(_zenith)) / (_R + _H) * ( n1 / np.sqrt(1-(n1**2 * _R**2 * np.sin(_zenith)**2)/(_R + _H)**2) - n2 / np.sqrt(1-(n2**2 * _R**2 * np.sin(_zenith)**2)/(_R + _H)**2) )
|
||||||
|
|
||||||
|
# Combining the partial derivatives
|
||||||
|
_dispersionError = np.sqrt( (_dddn1 * dn1)**2 + (_dddn2 * dn2)**2 + (_dddz * dz)**2)
|
||||||
|
|
||||||
|
return np.degrees(_dispersionError)
|
||||||
|
|
||||||
|
|
||||||
def corbard(self, n1, n2, zenith, reduced_height=None):
|
def corbard(self, n1, n2, zenith, reduced_height=None):
|
||||||
'''
|
'''
|
||||||
Corbard et al., 2019, mention an additional formula based on
|
Corbard et al., 2019, mention an additional formula based on
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ def slalib_refraction(l, zenith, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
_phi = np.deg2rad(lat) # From degrees to radians
|
_phi = np.deg2rad(lat) # From degrees to radians
|
||||||
|
|
||||||
R = []
|
R = []
|
||||||
if type(l) == float or type(l) == int:
|
if isinstance(l, float) or isinstance(l, int):
|
||||||
l = [l]
|
l = [l]
|
||||||
if use_pyslalib:
|
if use_pyslalib:
|
||||||
try:
|
try:
|
||||||
@@ -345,13 +345,13 @@ def slalib_refraction(l, zenith, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
print('pySLALIB package not found! Try installing it first.')
|
print('pySLALIB package not found! Try installing it first.')
|
||||||
for wl in l:
|
for wl in l:
|
||||||
# If using original slalib (e.g. PySLALIB)
|
# If using original slalib (e.g. PySLALIB)
|
||||||
Refrac = slalib.sla_refro(_zenith, h, T, _P, RH, wl, phi, tlr, eps)
|
Refrac = slalib.sla_refro(_zenith, h, T, _P, RH, wl, _phi, tlr, eps)
|
||||||
R.append(np.degrees(Refrac))
|
R.append(np.degrees(Refrac))
|
||||||
|
|
||||||
# If using internal slalib port
|
# If using internal slalib port
|
||||||
else:
|
else:
|
||||||
for wl in l:
|
for wl in l:
|
||||||
Refrac = sla_refro(_zenith, h, T, _P, RH, wl, phi, tlr, eps)
|
Refrac = sla_refro(_zenith, h, T, _P, RH, wl, _phi, tlr, eps)
|
||||||
R.append(np.degrees(Refrac))
|
R.append(np.degrees(Refrac))
|
||||||
|
|
||||||
if len(l) == 1:
|
if len(l) == 1:
|
||||||
|
|||||||
@@ -174,9 +174,10 @@ def Edlen1966(l, T=288.15, p=101325, RH=0, CO2=300, f=None):
|
|||||||
def Owens(l, T=288.15, p=101325, RH=0):
|
def Owens(l, T=288.15, p=101325, RH=0):
|
||||||
'''
|
'''
|
||||||
From Owens, 1967
|
From Owens, 1967
|
||||||
Equation 32
|
Equations 29 to 31
|
||||||
Note that the pressure P and H are in torricelli (Torr),
|
|
||||||
however, this is almost precisely 1 Torr = 1 mmHg
|
Code heavily based on ScopeSIM (https://scopesim.readthedocs.io/)
|
||||||
|
and http://www.caha.es/newsletter/news03b/pedraz/newslet.html
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@@ -194,10 +195,27 @@ def Owens(l, T=288.15, p=101325, RH=0):
|
|||||||
n : float
|
n : float
|
||||||
Refractive index of atmospheric air at the given conditions
|
Refractive index of atmospheric air at the given conditions
|
||||||
'''
|
'''
|
||||||
P = hPa2mmHg(p/100)
|
# Calculation from ScopeSIM.effects.atmospheric_refraction()
|
||||||
T = K2C(T)
|
pres = p / 100 # from mbar to Pa
|
||||||
s = 1 / l
|
Ps = -10474. + 116.43 * T - 0.43284 * T**2 + 0.0005384 * T**3
|
||||||
R = 8342.13 + 2406030 / (130 - s**2) + 15997 / (38.9 - s**2) * (P/720.775) * ((1 + P * (0.817 - 0.0133) * 1e-6)/(1 + 0.0036610*T)) - RH * (5.722 - 0.0457*s**2)
|
Pw = Ps * RH / 100.
|
||||||
|
Pa = pres - Pw
|
||||||
|
|
||||||
|
# Wavenumber s
|
||||||
|
s = 1. / l
|
||||||
|
|
||||||
|
# Density factor of dry air, eq. 30
|
||||||
|
Da = (Pa / T) * (1. + Pa * (57.9E-8 - 0.0009325 / T + 0.25844 / T**2))
|
||||||
|
|
||||||
|
# Density factor of moist air, eq. 31
|
||||||
|
Dw = (Pw / T) * (1. + Pw * (1. + 3.7E-4 * Pw) *
|
||||||
|
(-2.37321E-3 + 2.23366 / T - 710.792 / T**2 +
|
||||||
|
77514.1 / T**3))
|
||||||
|
|
||||||
|
# Combining the two into eq. 29
|
||||||
|
na = Da * (2371.34 + 683939.7 / (130. - s**2) + 4547.3 / (38.9 - s**2))
|
||||||
|
nw = Dw * (6487.31 + 58.058 * s**2 - 0.7115 * s**4 + 0.08851 * s**6)
|
||||||
|
R = na + nw
|
||||||
n = R/1e8 + 1
|
n = R/1e8 + 1
|
||||||
return n
|
return n
|
||||||
|
|
||||||
@@ -409,10 +427,10 @@ def slalib(l, T=288.15, p=101325, RH=0, h=0, lat=-24, tlr=0.0065, eps=1e-10):
|
|||||||
conditions.
|
conditions.
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
from pyslalib import slalib
|
from pyslalib import slalib
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print('pySLALIB package not found! Try installing it first.\nReturning n=1.')
|
print('pySLALIB package not found! Try installing it first.\nReturning n=1.')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
zObs = np.deg2rad(45.06563)
|
zObs = np.deg2rad(45.06563)
|
||||||
p = p/100
|
p = p/100
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Input parameters for the spherical atmosphere models (all but the first):
|
|||||||
- xc - CO2 density [ppm]
|
- xc - CO2 density [ppm]
|
||||||
- lat - Latitude [deg]
|
- lat - Latitude [deg]
|
||||||
- h - Height above sea level [m]
|
- h - Height above sea level [m]
|
||||||
- l - Wavelength(s) [um]
|
- l - Wavelength(s) [μm]
|
||||||
- z - Zenith angle [deg]
|
- z - Zenith angle [deg]
|
||||||
|
|
||||||
An example - To calculate the atmospheric refraction we set up a `refraction()` object. This requires the latitude and altitude of the observer. The atmospheric dispersion is calculated similarly, but by exchanging the `refraction()` object by a `dispersion()` object and parsing two refractive indices into the `cassini()` function.
|
An example - To calculate the atmospheric refraction we set up a `refraction()` object. This requires the latitude and altitude of the observer. The atmospheric dispersion is calculated similarly, but by exchanging the `refraction()` object by a `dispersion()` object and parsing two refractive indices into the `cassini()` function.
|
||||||
@@ -195,6 +195,7 @@ Included are
|
|||||||
| Bonsch & Potulski (1998) | `BonschPotulski()` | Allows for any temperature, pressure, humidity and CO2 density. |
|
| Bonsch & Potulski (1998) | `BonschPotulski()` | Allows for any temperature, pressure, humidity and CO2 density. |
|
||||||
| Birch & Downs (1994) | `BirchDowns()` | Only at standard atmosphere. Function requires wavelength only. |
|
| Birch & Downs (1994) | `BirchDowns()` | Only at standard atmosphere. Function requires wavelength only. |
|
||||||
| Peck & Reeder (1972) | `PeckReeder()` | Only at standard atmosphere. Function requires wavelength only. |
|
| Peck & Reeder (1972) | `PeckReeder()` | Only at standard atmosphere. Function requires wavelength only. |
|
||||||
|
| Mathar (2006) | `Mathar()` | Allows for temperature, pressure and humidity specification. Works best at wavelengths above 1.4 μm. |
|
||||||
| Hohenkerk & Sinclair (1985) | `HohenkerkAndSinclair()` | Based on Barrell & Sears equation. Generally, gives slightly larger values.|
|
| Hohenkerk & Sinclair (1985) | `HohenkerkAndSinclair()` | Based on Barrell & Sears equation. Generally, gives slightly larger values.|
|
||||||
| Hohenkerk & Sinclair (1985) | `slalib()` | Uses pySLALIB to retrieve the refractive index at standard atmospheric conditions.|
|
| Hohenkerk & Sinclair (1985) | `slalib()` | Uses pySLALIB to retrieve the refractive index at standard atmospheric conditions.|
|
||||||
|
|
||||||
@@ -226,6 +227,7 @@ Presently, several observatories are known. These can all be found in the `obser
|
|||||||
| Roque de los Muchachos Observatory (La Palma) | `LA_PALMA` | GTC, INT, WHT, NOT, and others. |
|
| Roque de los Muchachos Observatory (La Palma) | `LA_PALMA` | GTC, INT, WHT, NOT, and others. |
|
||||||
| La Silla Observatory | `LA_SILLA` | ESO 3.6m telescope, NTG, BlackGEM and others. |
|
| La Silla Observatory | `LA_SILLA` | ESO 3.6m telescope, NTG, BlackGEM and others. |
|
||||||
| Las Campanas Observatory | `LAS_CAMPANAS` | Site of the future GMT. |
|
| Las Campanas Observatory | `LAS_CAMPANAS` | Site of the future GMT. |
|
||||||
|
| Mauna Kea Observatory (Hawaii) | `MAUNA_KEA` | Location of Keck, Subaru, Gemini North and others.|
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -21,14 +21,14 @@ def setup_package():
|
|||||||
# write_version_py()
|
# write_version_py()
|
||||||
|
|
||||||
setup(name='AstroAtmosphere',
|
setup(name='AstroAtmosphere',
|
||||||
version='1.4.1',
|
version='1.6',
|
||||||
description='Collection of equations for refractive index, refraction and dispersion calculations of atmospheric air.',
|
description='Collection of equations for refractive index, refraction and dispersion calculations of atmospheric air.',
|
||||||
long_description=__readme__,
|
long_description=__readme__,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
author='Joost van den Born',
|
author='Joost van den Born',
|
||||||
author_email='born@astron.nl',
|
author_email='born@astron.nl',
|
||||||
url='https://gitlab.astro-wise.org/micado/atmosphericmodel',
|
url='https://gitlab.astro-wise.org/micado/atmosphericmodel',
|
||||||
download_url='https://gitlab.astro-wise.org/micado/atmosphericmodel/-/archive/v1.4.1/atmosphericmodel-v1.4.1.tar.gz',
|
download_url='https://gitlab.astro-wise.org/micado/atmosphericmodel/-/archive/v1.6/atmosphericmodel-v1.6.tar.gz',
|
||||||
license='GNU General Public License v3',
|
license='GNU General Public License v3',
|
||||||
data_files = [('',['LICENSE.txt'])],
|
data_files = [('',['LICENSE.txt'])],
|
||||||
package_dir={'AstroAtmosphere': 'AstroAtmosphere'},
|
package_dir={'AstroAtmosphere': 'AstroAtmosphere'},
|
||||||
|
|||||||
Reference in new issue
Block a user