mirror of
https://gitlab.astro-wise.org/micado/atmosphericmodel.git
synced 2026-10-30 05:01:02 +00:00
140 lines
3.6 KiB
Plaintext
140 lines
3.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Example: Calculating atmospheric dispersion for H-band\n",
|
|
"Using atmosphericModel.py is made as simple as importing the python file and calling its functions. Several parameters are needed, such as location, temperature, pressure and relative humidity. Then the dispersion model object is initiated, allowing us to calculate the index of refraction for any set of TPH and CO2 content values."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#!/usr/bin/env Python\n",
|
|
"import numpy as np\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"from atmosphericModel import *\n",
|
|
"\n",
|
|
"\n",
|
|
"# Parameters at Cerro Armazones\n",
|
|
"T = 279.65 # k\n",
|
|
"P = 71200 # Pa\n",
|
|
"H = 0.22\n",
|
|
"xc = 450 # ppm\n",
|
|
"lat = -24.5983 # degrees\n",
|
|
"h = 3064 # m\n",
|
|
"l1 = 1.49 # micron\n",
|
|
"l2 = 1.78 # micron\n",
|
|
"\n",
|
|
"# Initializing dispersion model\n",
|
|
"at = Ciddor1996(p=P, T=T, H=H, xc=xc)\n",
|
|
"\n",
|
|
"# Calculating indices of refraction for l1 and l2\n",
|
|
"n1 = at.n_tph(l=l1, T=T, p=P, RH=H, xc=xc)\n",
|
|
"n2 = at.n_tph(l=l2, T=T, p=P, RH=H, xc=xc)\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"We can also calculate the density of the air, which will be useful when calculating the scale height of the atmosphere, necessary for the refraction calculations."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n",
|
|
"# Density of the atmosphere (following CIPM-81/91 equations)\n",
|
|
"rho = at.rho(p=P, T=T, RH=H, xc=xc)\n",
|
|
"\n",
|
|
"# Initializing refraction model\n",
|
|
"ref = refraction(lat, h, P, rho)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"The refraction for 1.49 um light at a zenith angle of 45 degrees, as calculated by the Cassini model, is found to be:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"The refraction is 40.697 arc seconds\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Calculating refraction for edge FoV\n",
|
|
"zenith_obs = 45\n",
|
|
"refraction_obs = ref.cassini(n1, zenith_obs) * 3.6e3\n",
|
|
"print ('The refraction is %.03f arc seconds' %(refraction_obs))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Dispersion is simply the refraction differential between two wavelengths. This is calculated with this module by"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"The dispersion is 31.019 milli arc seconds\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Initializing dispersion object\n",
|
|
"disp = dispersion(lat, h, P, rho)\n",
|
|
"dispersion_obs = disp.cassini(n1, n2, zenith=zenith_obs)*3.6e6\n",
|
|
"print ('The dispersion is %.03f milli arc seconds' %(dispersion_obs))"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.1"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|