Changeset 1633 for branches/alma/python


Ignore:
Timestamp:
09/16/09 17:11:16 (15 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1422

Ready to Release: Yes

Interface Changes: Yes

What Interface Changed: Defined calibrate() and almacal() in python/asapmath.py

Defined cwcal() in STMath class

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): task_sdaverage

Description: Describe your changes here...

asapmath.py is changed to be able to calibrate data for APEX.
This modification is tentatively considered a calibration of ALMA
single-dish data. However, it must be updated in the future since
I don't know how raw ALMA data are provided and I have to change
code along with read ALMA data.

The calibrate() function takes calibration mode from its argument and
looks antenna name of the input scantable, and calls appropriate calibration
function depending on the calibration mode and antenna name.
If antenna name include 'APEX' or 'ALMA', newly defined calibration function
apexcal() is called. For other antenna name, one of the existing calibration
functions (calps, calnod, calfs, auto_quotient) is called.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/asapmath.py

    r1631 r1633  
    850850    return s
    851851
    852 ## def apexcal( scantab, calmode ):
    853 ##     """
    854 ##     Calibrate APEX data.
     852def calibrate( scantab, scannos=[], calmode='none', verify=None ):
     853    """
     854    Calibrate data.
    855855   
    856 ##     Parameters:
    857 ##         scantab:       scantable
    858 ##         calmode:       calibration mode
    859 ##     """
    860 ##     from asap._asap import stmath
    861 ##     stm = stmath()
    862 ##     if ( calmode == 'ps' ):
    863 ##         asaplog.push( 'APEX position-switch calibration' )
    864 ##         print_log()
    865 ##     elif ( calmode == 'fs' ):
    866 ##         asaplog.push( 'APEX frequency-switch calibration' )
    867 ##         print_log()
    868 ##     elif ( calmode == 'wob' ):
    869 ##         asaplog.push( 'APEX wobbler-switch calibration' )
    870 ##         print_log()
    871 ##     elif ( calmode == 'otf' ):
    872 ##         asaplog.push( 'APEX On-The-Fly calibration' )
    873 ##         print_log()
    874 ##     else:
    875 ##         asaplog.push( '%s: unknown calibration mode' % calmode )
    876 ##         print_log('ERROR')
     856    Parameters:
     857        scantab:       scantable
     858        scannos:       list of scan number
     859        calmode:       calibration mode
     860        verify:        verify calibration     
     861    """
     862    print 'param: %s, %s, %s' %(scannos, calmode, verify)
     863    antname = scantab.get_antennaname()
     864    if ( calmode == 'nod' ):
     865        asaplog.push( 'Calibrating nod data.' )
     866        print_log()
     867        scal = calnod( scantab, scannos=scannos, verify=verify )
     868    elif ( calmode == 'quotient' ):
     869        asaplog.push( 'Calibrating using quotient.' )
     870        print_log()
     871        scal = scantab.auto_quotient( verify=verify )
     872    elif ( calmode == 'ps' ):
     873        asaplog.push( 'Calibrating %s position-switched data.' % antname )
     874        print_log()
     875        if ( antname.find( 'APEX' ) != -1 or antname.find( 'ALMA' ) != -1 ):
     876            scal = almacal( scantab, scannos, calmode, verify )
     877        else:
     878            scal = calps( scantab, scannos=scannos, verify=verify )
     879    elif ( calmode == 'fs' or calmode == 'fsotf' ):
     880        asaplog.push( 'Calibrating %s frequency-switched data.' % antname )
     881        print_log()
     882        if ( antname.find( 'APEX' ) != -1 or antname.find( 'ALMA' ) != -1 ):
     883            scal = almacal( scantab, scannos, calmode, verify )
     884        else:
     885            scal = calfs( scantab, scannos=scannos, verify=verify )
     886    elif ( calmode == 'otf' ):
     887        asaplog.push( 'Calibrating %s On-The-Fly data.' % antname )
     888        print_log()
     889        scal = almacal( scantab, scannos, calmode, verify )
     890    else:
     891        asaplog.push( 'No calibration.' )
     892        scal = scantab.copy()
     893
     894    return scal
     895
     896def almacal( scantab, scannos=[], calmode='none', verify=False ):
     897    """
     898    Calibrate APEX and ALMA data
     899
     900    Parameters:
     901        scantab:       scantable
     902        scannos:       list of scan number
     903        calmode:       calibration mode
     904        verify:        verify calibration     
     905    """
     906    from asap._asap import stmath
     907    stm = stmath()
     908    antname = scantab.get_antennaname()
     909    ssub = scantab.get_scan( scannos )
     910    scal = scantable( stm.cwcal( ssub, calmode, antname ) )
     911    return scal
Note: See TracChangeset for help on using the changeset viewer.