NRAO Home > CASA > CASA Toolkit Reference Manual
table.open - Function

3.2.1 open an existing table


Description

Opens a disk file containing an existing CASA Table.

Most of the time you just need to specify the tablename and perhaps nomodify.

A table can be shared by multiple processes by using the appropriate locking options. The possible options are:
- auto: let the system take care of locking. At regular time intervals these autolocks are released to give other processes the opportunity to access the table.
- autonoread: as auto, but no read locking is needed. This must be used with care, because it means that reading can be done while the table tool is not synchronized with the table file (as is normally done when a lock is acquired). The function resync can be used to explicitly synchronize the table tool
- user: the user takes care by explicit calls to lock and unlock
- usernoread: as user and the no readlocking behaviour of autonoread.
- permanent: use a permanent lock; the constructor fails when the table is already in use in another process
- permanentwait: as above, but wait until the other process releases its lock
- default: this is the default option. If the given table is already open, the locking option in use is not changed. Otherwise it reverts to auto.
When auto locking is used, it is possible to give a record containing the fields option, interval, and/or maxwait. In this way advanced users have full control over the locking options. In practice this is hardly ever needed.

Arguments





Inputs

tablename

allowed:

string

Default:

lockoptions

locking dictionary to be used : dict keys are ’option’, ’interval’, ’maxwait’

allowed:

record

Default:

nomodify

allowed:

bool

Default:

true

Returns
bool

Example

 
 
 
  # First let’s make a table for testing  
  def maketesttable():  
      # Get path to CASA home directory by stipping name from ’$CASAPATH’  
      pathname=os.environ.get("CASAPATH").split()[0]  
      # This is where the 3C273XC1.fits data should be  
      fitsdata=pathname+"/data/demo/3C273XC1.fits"  
      # Remove old table if present  
      !rm -rf 3C273XC1.MS  
      ms.fromfits("3C273XC1.MS",fitsdata)  
      ms.close()  
 
  maketesttable()  
  tb.open("3C273XC1.MS")  
  tb.browse()  
  tb.close()  
 
 
The first line opens an existing table 3C273XC1.MS, the second browses  
it using the browse function.  
 
 
  tb.open("3C273XC1.MS", nomodify=False, lockoptions={’option’:’user’})  
  tb.lock();  
  tb.addrows();  
  tb.unlock();  
 
 
In this example explicit user locking is used. The function lock  
is needed to acquire a (write) lock before the addrows is done.  
Thereafter the lock is released to give other processes the chance  
to operate on the table.  
\\Note that releasing a lock implies flushing the table, so doing  
that very often can be quite expensive.  
 
 
 

__________________________________________________________________


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