NRAO Home > CASA > CASA Toolkit Reference Manual
ms.putdata - Function

1.3.1 Write new values into the measurement set


This function allows you to write values from casapy variables back into the measurement set table. The main difference between this and directly accessing the table using the table tool is that this function writes data to the selected measurement set.

Unlike the getdata function you can only put items that correspond to actual table columns. You cannot change the data shape either so that the number of correlations, channels and rows (or intereferometers/time slots) must match the values in the selected measurement set. If the values were obtained using the getdata function with ifraxis argument set to True, then any default values added to fill in missing intereferometer/timeslots pairs will be ignored when writing the modified values back using this function.

The measurement set has to be opened for read/write access to be able to use this function.

You need to call selectinit before calling this function. If you haven’t then selectinit will be called for you with default arguments.

Items prefixed with either; corrected, model, residual or obs_residual and the imaging_weight item are not available unless your measurement set has been processed either with the imager or calibrator tools.




Record with items and their new values






"3C273XC1.MS", nomodify=False)  
      rec = ms.getdata(["weight","data"])  
      rec[’weight’][:,:] = 1  
      import Numeric  
      meanrec = Numeric.average(rec[’data’],axis=None)  
      print "Mean data value = ", meanrec  
      rec[’data’][:,:,:] -= meanrec  
    This example selects all the data from the measurement set where  
    the value in the DATA_DESC_ID column is zero. This  
    corresponds to a particular spectral window and polarization  
    setup. Note that the measurement set was opened for writing as  
    well as reading. The third line reads all the weights and the  
    data into the casapy variable rec. The weights are set  
    to one. The more obscure syntax is used as typing  
    rec[’weight’] = 1 will not preserve the shape of the weight  
    array. The data then has its mean subtracted from  
    it. The average function is defined in Numeric module. Finally the data  
    is written back into the measurement set table. (NOTE: normally  
    one should not modify the raw data column.  Such adjustments are more  
    appropriate for the corrected_data column, if it exists.)  


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