1.24. convertTemp

Full Name: herschel.hifi.dp.tools.ConvertSpectraTemperatureTask
Alias: convertTemp
Type: Java Task - Java Task
Import: from herschel.hifi.dp.tools import ConvertSpectraTemperatureTask
Category

HIFI/Conversion

Description

Convert Temperature in the SpectrumContainer in Main Beam temperature or in Antenna Temperature.

It works with SpectralSimpleCube, HifiSpectrumDataset, SimpleSpectrum. Other containers are not tested The type of Temperature of the passed SpectrumContainer is retrieved from the parameter "temperatureScale" or from the FluxDescription if that parameter is not present. The parameters beamEff and forward eff

Example

Example 1: convert data in a cube
#retrieve data
obsid=1342235020
obs=getObservation(obsid=obsid, useHsa=True)
cube=obs.level2_5.getProduct("cubesContext").getProduct("cubesContext_WBS-V-USB").getProduct("cube_WBS_V_USB_1")
htp=obs.refs["level2_5"].product.refs["WBS-V-USB"].product.copy()
#convert a cube:
result=convertTemp(cube, forwardEff=0.96, beamEff=0.6)
print result.image[0,0,0],cube.image[0,0,0]#15.6147352918 23.4221029377
#if cube doesn't contains Efficiency Parameters the task add them with the values in the Task  inputs
print result.meta ["beamEff"].value, result.meta ["forwardEff"].value,result.meta ["temperatureScale"].value
#convert a SimpleSpectrum, if data contains beamEff, forwardEff doesn't need input parameter
spectrum=convertSingleHifiSpectrum(htp[1])
result=convertTemp(spectrum)
print result.flux[0],spectrum.flux[0]#32.8178934646 20.4322876989
#passed parameters overwrite MetaData parameters
result=convertTemp(spectrum, beamEff=1,forwardEff=1)
print result.meta ["beamEff"].value, spectrum.meta ["beamEff"].value#1.0 0.597692116105
#convert a HifiSpectrumDataset,
result=convertTemp(htp[1])
print result.getFlux(1)[0],htp[1].getFlux(1)[0]#32.8178934646 20.4322876989
#Input data can be overwritten
convertTemp(cube, forwardEff=0.96, beamEff=0.6, overwrite=1)
print cube.image[0,0,0], cube.meta ["temperatureScale"].value
#Data can be transformed back in AntennaTemperature
convertTemp(cube, to="Ta", overwrite=1)
print cube.image[0,0,0], cube.meta ["temperatureScale"].value

API details

Properties

SpectrumContainer data [INPUT, MANDATORY, default=No default value.]

Provides the SpectrumContainer where the Flux has to be converted from a temperature type (e.g. AntennaTemperature) to another temperature type (e.g Main Beam Temperature)

String to [INPUT, MANDATORY, default="Tmb".]

The target type of Temperature to be converted. E.g "Tmb" or "T_a*". The Task doesn't make distinction between "T_a" and T_a*" and "ta" : i.e it always convert in "T_a*". It doesn't accept the value "T_a'".

Boolean overwrite [INPUT, OPTIONAL, default=False.]

If overwrite=True the data passed will be overwritten. If overwrite=False the data passed will be copied

Double beamEff [INPUT, OPTIONAL, default=None.]

The beam efficiency to be used in the conversion. If the value is not passed the Task try to use the Parameter "beamEff" in the MetaData of the SpectrumContainer. If the value is passed this value is written in the MetaData of the resulting SpectrumContainer.

Double forwardEff [INPUT, OPTIONAL, default=None.]

The forward efficiency to be used in the conversion. If the value is not passed the Task try to use the Parameter "forwardEff" in the MetaData of the SpectrumContainer. If the value is passed this value is written in the MetaData of the resulting SpectrumContainer.

See also