Examples
Note atmosphere tool is instanciated as 'at' tool when CASA is loaded.
Minimum execution
Default atmospheric profile, obtain opacities of wet and dry components in 100GHz.
#In CASA
CASA <1>: out = at.initAtmProfile()
CASA <2>: nchan = at.initSpectralWindow(1, "100GHz", "500kHz", "0Hz")
CASA <3>: at.getDryOpacity(0, 0)
Out[3]: 0.011171237850436442
CASA <4>: at.getWetOpacity(0, 0)
Out[4]: {'unit': 'neper', 'value': array([ 0.01109787])}
Define Atmospheric Profile
Atmospheric profile that represents ALMA site.
#In CASA
CASA <1>: out = at.initAtmProfile(humidity=20.0, temperature="273K", altitude="5059m", pressure="563mbar", atmType=3)
CASA <2>: print(out)
BASIC ATMOSPHERIC PARAMETERS TO GENERATE REFERENCE ATMOSPHERIC PROFILE
Ground temperature T: 273 K
Ground pressure P: 563 mb
Relative humidity rh: 20 %
Scale height h0: 2 km
Pressure step dp: 10 mb
Altitude alti: 5059 m
Attitude top atm profile: 48 km
Pressure step factor: 1.2
Tropospheric lapse rate: -5.6 K/km
Atmospheric type: MIDLATWINTER
User-defined temperature profile: OFF
Built atmospheric profile with 21 layers.
Now, get atmospheric model profile constructed in atmosphere tool.
The method, getProfile, returns the thickness, temperature, mass and number density of H2O, pressure, number dentities of O3, CO, and N2O in each layer of atmosphere model. One can use the return values, e.g., to plot the atmosphere model used to calculate transmission.
#In CASA
CASA <3>: (out, thick, temp, h2o_mass, h2o_num, press, o3, co, n2o) = at.getProfile()
How to construct an atmospheric profile by user defined temperature profile
The method, initAtmProfile, optionally accepts user defined temperature profile of atmosphere to construct an atmospheric profile. Define arrays of the altitude (in unit of meter) and temperature (in Kelvin) to specify temperature profile.
#In CASA
CASA <1>: atm_altitudes = [5100.0, 6000.0, 8000.0, 11000.0, 15000.0] #meter
CASA <2>: atm_temperature = [266.08, 267.02, 256.32, 234.54, 213.34] #Kelvin
CASA <3>: out = at.initAtmProfile(humidity=20.0, temperature="273K", altitude="5059m", pressure="563mbar", atmType=3, layerBoundaries=atm_altitudes, layerTemperature=atm_temperature)
Set Up Spectral Windows
Define the first spectral window (center=100GHz, band width=1.5GHz, channel resolution=15MHz).
#In CASA
CASA <4>: nchan0 = at.initSpectralWindow(1, fCenter="100GHz", fWidth="1.5GHz", fRes="15MHz")
CASA <5>: nchan0
Out[5]: 100
Add another spectral window (center=200GHz, band width=50MHz, channel resolution=10MHz) .
#In CASA
CASA <6>: at.addSpectralWindow(fCenter="200GHz", fWidth="50MHz", fRes="10MHz")
Out[6]: 5
Obtain channel frequencies of the second spectral window (id=1).
#In CASA
CASA <7>: at.getSpectralWindow(1)
Out[7]:
{'unit': 'Hz',
'value': array([ 1.99980000e+11, 1.99990000e+11, 2.00000000e+11,
2.00010000e+11, 2.00020000e+11])}
Get Atmospheric Transmission
Set a user defined PWV (1.7mm) to compute atmospheric transimission.
#In CASA
CASA <8>: at.setUserWH2O("1.7mm")
Obtain the opacities of water vapor and dry species (CO, N2O, NO2, O2, O3, SO2) of the second spectral window (id=1). The methods return channel number of spw and opacity of all channels in the spw.
#In CASA
CASA <9>: at.getDryOpacitySpec(1)
Out[9]: (5, array([ 0.00928229, 0.00928329, 0.00927743, 0.00927898, 0.00928082]))
CASA <10>: at.getWetOpacitySpec(1)
Out[10]:
(5, {'unit': 'mm-1', 'value': array([ 0.08272901, 0.08270427, 0.08267965, 0.08265512, 0.08263071])})
Compute atmospheric transmission of all channels in the first spectral window (id=0) for airmas=1.5.
#In CASA
CASA <11>: dry = at.getDryOpacitySpec(0)[1]
CASA <12>: wet = at.getWetOpacitySpec(0)[1]['value']
CASA <13>: airmass=1.5
CASA <14>: transmission = numpy.exp(-airmass*(dry+wet))