NRAO Home > CASA > CASA Toolkit Reference Manual
msmetadata.fieldsforscans - Function

1.3.2 Get an array or dictionary of the unique fields for the specified scan numbers, observationID, and array ID.


Description

Get an array or dictionary of the unique fields for the specified scan numbers, observation ID, and array ID. If asnames=True, the values returned will be the field names, if False, they will be field IDs. If asmap=True, the structure returned will be a dictionary which maps scan number (as a string) to fields. In this case, both obsid and arrayid must be nonnegative. If asmap=False, a single array of fields is returned that matches the query. In this case, if obsid and/or arrayid are negative, then it indicates that all fields matching any obsid and/or arrayid should be returned. An empty array specified for scans means that all scans for the selected obsid and arrayid should be included.

Arguments





Inputs

scans

Scan numbers for which to return the fields.

allowed:

intArray

Default:

asnames

If true, return the field names. If false, return the zero-based field IDs.

allowed:

bool

Default:

false

obsid

Observation ID. A negative value means use all observation IDs.

allowed:

int

Default:

-1

arrayid

Array ID. A negative value means use all array IDs.

allowed:

int

Default:

-1

asmap

Return a dictionary mapping scan numbers to fields?

allowed:

bool

Default:

false

Returns
any

Example

 
    msmd.open("my.ms")  
    # get the field names for scan numbers 5 and 10 (all obsids, all arrayids)  
    field_names = msmd.fieldsforscan([5, 10], True)  
    # get the field IDs for scan numbers 5 and 10 (all obsids, all arrayids)  
    field_IDs = msmd.fieldsforscan([5, 10], False)  
    # get mapping of scans to fields for arrayid=2 and obsid=4  
    scans_to_fields = msmd.fieldsforscan(obsid=4, arrayid=2, asmap=True)  
    msmd.done()  

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search