NRAO Home > CASA > CASA Toolkit Reference Manual
image.toASCII - Function

1.1.1 Convert the image to an ASCII file


Description

This function converts the image into an ascii file. The format is one image row per line (see fromascii).

The output mask is the combination (logical OR) of the default input pixel mask (if any) and the OTF mask. Because the mask is not transferred to the ascii file, you must specify what data value to use if a pixel is masked. By default, the underlying data value in the image is used. But this could be anything (and often it’s a NaN), so you could set, say, maskvalue=-10000 as a magic value.

Arguments





Inputs

outfile

ASCII file name. Default is input name + ’.ascii’.

allowed:

string

Default:

region

Region selection. See ”help par.region” for details. Default is to use the full image.

allowed:

any

Default:

variant

mask

Mask to use. See help par.mask. Default is none.

allowed:

any

Default:

variant

sep

Separator of data in ascii file. Default is space character.

allowed:

string

Default:

:

format

Format of data in ascii file

allowed:

string

Default:

maskvalue

Value to replace masked pixels by, -999 is no change.

allowed:

double

Default:

-999

overwrite

Overwrite (unprompted) pre-existing output file?

allowed:

bool

Default:

false

stretch

Stretch the mask if necessary and possible? See help par.stretch. Default False

allowed:

bool

Default:

false

Returns
bool

Example

 
 
"""  
#  
print "\t----\t toASCII Ex 1 \t----"  
ia.maketestimage()  
ok = ia.toASCII(’myfile.ascii’, overwrite=true)  
ia.close()  
ia.fromascii(’image.im’,’myfile.ascii’, shape=[113,76], overwrite=true)  
ia.toASCII(’myfile2.ascii’,overwrite=true)  
#!diff myfile.ascii myfile2.ascii  
#  
"""  
 

__________________________________________________________________


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