mirror of
https://gitlab.astro-wise.org/micado/atmosphericmodel.git
synced 2026-10-29 20:51:05 +00:00
Improved quick functions
This commit is contained in:
1 parent
3cdf4ccd39
commit
03d583a9cd
3 files changed
+38
-12
No files matched your search
+31
-5
@@ -4,8 +4,9 @@ from .refractionModels import refraction
|
|||||||
from .dispersionModels import dispersion
|
from .dispersionModels import dispersion
|
||||||
from .neoslalib import sla_refro
|
from .neoslalib import sla_refro
|
||||||
from .observatories import observatories
|
from .observatories import observatories
|
||||||
from .refractivityModels import Edlen1953
|
from .refractivityModels import Edlen1953, Mathar
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import warnings
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ Author: Joost van den Born
|
@ Author: Joost van den Born
|
||||||
@@ -102,7 +103,9 @@ def quick_refractive_index(l, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
l : float
|
l : float
|
||||||
Wavelength in microns
|
Wavelength in microns. If the wavelength is above
|
||||||
|
2.5 microns, then the Mathar refractivity model
|
||||||
|
is used.
|
||||||
conditions: string
|
conditions: string
|
||||||
Refers to the standard conditions of the
|
Refers to the standard conditions of the
|
||||||
observatory. See get_conditions() for more info.
|
observatory. See get_conditions() for more info.
|
||||||
@@ -129,11 +132,15 @@ def quick_refractive_index(l, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
if conditions is not None:
|
if conditions is not None:
|
||||||
T, p, RH, xc, lat, h, _ = get_conditions(conditions).values()
|
T, p, RH, xc, lat, h, _ = get_conditions(conditions).values()
|
||||||
|
|
||||||
|
if l <= 2.5:
|
||||||
# Initializing dispersion model
|
# Initializing dispersion model
|
||||||
at = Observatory()
|
at = Observatory()
|
||||||
|
|
||||||
# Calculating indices of refraction for l
|
# Calculating indices of refraction for l
|
||||||
n = at.n_tph(l=l, T=T, p=p, RH=RH, xc=xc)
|
n = at.n_tph(l=l, T=T, p=p, RH=RH, xc=xc)
|
||||||
|
else:
|
||||||
|
# Using the Mathar description for infrared wavelengths
|
||||||
|
n = Mathar(l=l, T=T, p=p, RH=RH)
|
||||||
return n
|
return n
|
||||||
|
|
||||||
|
|
||||||
@@ -147,7 +154,8 @@ def quick_refraction(l, zenith, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
l : float
|
l : float
|
||||||
Wavelength in microns
|
Wavelength in microns. If the wavelength is above 2.5 micron
|
||||||
|
then the Mathar refractivity model is used.
|
||||||
zenith : float
|
zenith : float
|
||||||
Angle of observation in degrees.
|
Angle of observation in degrees.
|
||||||
zenith = 0 means the observation is directly overhead.
|
zenith = 0 means the observation is directly overhead.
|
||||||
@@ -180,8 +188,12 @@ def quick_refraction(l, zenith, conditions='STANDARD', T=288.15, p=101325,
|
|||||||
# Initializing dispersion model
|
# Initializing dispersion model
|
||||||
at = Observatory()
|
at = Observatory()
|
||||||
|
|
||||||
|
if l <= 2.5:
|
||||||
# Calculating indices of refraction for l
|
# Calculating indices of refraction for l
|
||||||
n = at.n_tph(l=l, T=T, p=p, RH=RH, xc=xc)
|
n = at.n_tph(l=l, T=T, p=p, RH=RH, xc=xc)
|
||||||
|
else:
|
||||||
|
# Using the Mathar description for infrared wavelengths
|
||||||
|
n = Mathar(l=l, T=T, p=p, RH=RH)
|
||||||
|
|
||||||
# Density of the atmosphere (following CIPM-81/91 equations)
|
# Density of the atmosphere (following CIPM-81/91 equations)
|
||||||
rho = at.rho(p=p, T=T, RH=RH, xc=xc)
|
rho = at.rho(p=p, T=T, RH=RH, xc=xc)
|
||||||
@@ -202,9 +214,11 @@ def quick_dispersion(l1, l2, zenith, conditions='STANDARD', T=288.15,
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
l1 : float
|
l1 : float
|
||||||
Shortest wavelength of interest in micron.
|
Shortest wavelength of interest in micron. If the wavelength
|
||||||
|
is above 2.5 microns, then the Mathar model is used.
|
||||||
l2 : float
|
l2 : float
|
||||||
Longest wavelength of interest in micron.
|
Longest wavelength of interest in micron. If the wavelength
|
||||||
|
is above 2.5 microns, then the Mathar model is used.
|
||||||
zenith : float
|
zenith : float
|
||||||
Angle of observation in degrees.
|
Angle of observation in degrees.
|
||||||
zenith = 0 means the observation is directly overhead.
|
zenith = 0 means the observation is directly overhead.
|
||||||
@@ -237,9 +251,21 @@ def quick_dispersion(l1, l2, zenith, conditions='STANDARD', T=288.15,
|
|||||||
# Initializing dispersion model
|
# Initializing dispersion model
|
||||||
at = Observatory()
|
at = Observatory()
|
||||||
|
|
||||||
|
if l1 <= 2.5 and l2 <= 2.5:
|
||||||
# Calculating indices of refraction for l1 and l2
|
# Calculating indices of refraction for l1 and l2
|
||||||
n1 = at.n_tph(l=l1, T=T, p=p, RH=RH, xc=xc)
|
n1 = at.n_tph(l=l1, T=T, p=p, RH=RH, xc=xc)
|
||||||
n2 = at.n_tph(l=l2, T=T, p=p, RH=RH, xc=xc)
|
n2 = at.n_tph(l=l2, T=T, p=p, RH=RH, xc=xc)
|
||||||
|
elif l1 > 1.4 and l2 > 1.4:
|
||||||
|
# Using the Mathar description for infrared wavelengths
|
||||||
|
n1 = Mathar(l=l1, T=T, p=p, RH=RH)
|
||||||
|
n2 = Mathar(l=l2, T=T, p=p, RH=RH)
|
||||||
|
else:
|
||||||
|
warnings.warn('Using two refractivity models (Ciddor and Mathar). \
|
||||||
|
Make sure you trust the results!')
|
||||||
|
l1n = np.min([l1, l2])
|
||||||
|
l2n = np.max([l1, l2])
|
||||||
|
n1 = at.n_tph(l=l1n, T=T, p=p, RH=RH, xc=xc)
|
||||||
|
n2 = Mathar(l=l2n, T=T, p=p, RH=RH)
|
||||||
|
|
||||||
# Density of the atmosphere (following CIPM-81/91 equations)
|
# Density of the atmosphere (following CIPM-81/91 equations)
|
||||||
rho = at.rho(p=p, T=T, RH=RH, xc=xc)
|
rho = at.rho(p=p, T=T, RH=RH, xc=xc)
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ def Mathar(l, T=288.15, p=101325, RH=0):
|
|||||||
if l < 1.3 or l > 24:
|
if l < 1.3 or l > 24:
|
||||||
print('Using the Mathar model at this wavelength (l={:.3f}) is not recommended!'.format(l))
|
print('Using the Mathar model at this wavelength (l={:.3f}) is not recommended!'.format(l))
|
||||||
|
|
||||||
if l <= 2.65:
|
elif l <= 2.65:
|
||||||
########################################################################
|
########################################################################
|
||||||
# model parameters for wavelengths between 1.3 and 2.5 microns
|
# model parameters for wavelengths between 1.3 and 2.5 microns
|
||||||
cref = [ 0.200192e-3, 0.113474e-9, -0.424595e-14, 0.100957e-16, -0.293315e-20, 0.307228e-24] # cm^j
|
cref = [ 0.200192e-3, 0.113474e-9, -0.424595e-14, 0.100957e-16, -0.293315e-20, 0.307228e-24] # cm^j
|
||||||
@@ -475,7 +475,7 @@ def Mathar(l, T=288.15, p=101325, RH=0):
|
|||||||
Href = 10 #%, reference humdity in percent
|
Href = 10 #%, reference humdity in percent
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
if l > 2.65 and l <= 4.275:
|
elif l > 2.65 and l <= 4.275:
|
||||||
########################################################################
|
########################################################################
|
||||||
# model parameters for wavelengths between 2.8 and 4.2 microns
|
# model parameters for wavelengths between 2.8 and 4.2 microns
|
||||||
cref = [ 0.200049e-3, 0.145221e-9, 0.250951e-12, -0.745834e-15, -0.161432e-17, 0.352780e-20] # cm^j
|
cref = [ 0.200049e-3, 0.145221e-9, 0.250951e-12, -0.745834e-15, -0.161432e-17, 0.352780e-20] # cm^j
|
||||||
@@ -495,7 +495,7 @@ def Mathar(l, T=288.15, p=101325, RH=0):
|
|||||||
Href = 10 #%, reference humdity in percent
|
Href = 10 #%, reference humdity in percent
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
if l > 4.275 and l <= 6.35:
|
elif l > 4.275 and l <= 6.35:
|
||||||
########################################################################
|
########################################################################
|
||||||
# model parameters for wavelengths between 4.35 and 5.2 microns
|
# model parameters for wavelengths between 4.35 and 5.2 microns
|
||||||
cref = [ 0.200020e-3, 0.275346e-9, 0.325702e-12, -0.693603e-14, 0.285610e-17, 0.338758e-18] # cm^j
|
cref = [ 0.200020e-3, 0.275346e-9, 0.325702e-12, -0.693603e-14, 0.285610e-17, 0.338758e-18] # cm^j
|
||||||
@@ -514,7 +514,7 @@ def Mathar(l, T=288.15, p=101325, RH=0):
|
|||||||
Href = 10 #%, reference humdity in percent
|
Href = 10 #%, reference humdity in percent
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
if l > 6.35 and l <= 15.05:
|
elif l > 6.35 and l <= 15.05:
|
||||||
########################################################################
|
########################################################################
|
||||||
# model parameters for wavelengths between 7.5 and 14.1 microns
|
# model parameters for wavelengths between 7.5 and 14.1 microns
|
||||||
cref = [ 0.199885e-3, 0.344739e-9, -0.273714e-12, 0.393383e-15, -0.569488e-17, 0.164556e-19] # cm^j
|
cref = [ 0.199885e-3, 0.344739e-9, -0.273714e-12, 0.393383e-15, -0.569488e-17, 0.164556e-19] # cm^j
|
||||||
@@ -534,7 +534,7 @@ def Mathar(l, T=288.15, p=101325, RH=0):
|
|||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
if l > 15.05:
|
elif l > 15.05:
|
||||||
########################################################################
|
########################################################################
|
||||||
# model parameters for wavelengths between 16 and 24 microns
|
# model parameters for wavelengths between 16 and 24 microns
|
||||||
cref = [ 0.199436e-3, 0.299123e-8, -0.214862e-10, 0.143338e-12, 0.122398e-14, -0.114628e-16] # cm^j
|
cref = [ 0.199436e-3, 0.299123e-8, -0.214862e-10, 0.143338e-12, 0.122398e-14, -0.114628e-16] # cm^j
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ def setup_package():
|
|||||||
# write_version_py()
|
# write_version_py()
|
||||||
|
|
||||||
setup(name='AstroAtmosphere',
|
setup(name='AstroAtmosphere',
|
||||||
version='1.4',
|
version='1.4.1',
|
||||||
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/atmosphericmodel-v1.4.tar.gz',
|
download_url='https://gitlab.astro-wise.org/micado/atmosphericmodel/-/archive/v1.4.1/atmosphericmodel-v1.4.1.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