saltsafeio

Module for handling IO in SALT software.

All calls to IO functions should go through this module.

Note this is a replacement for the saltio module.

saltsafeio.abspath(path)

convert relative path to absolute path

saltsafeio.argdefined(argument, value)

has an argument been defined?

saltsafeio.argunpack(argument, value)

For arguments that might be a file or list, unpack to make a single list

saltsafeio.ask(msg)

Ask for a user response

returns the response

saltsafeio.build_exposure_index(files)

Given a list of fits files returns an index of exposures for use with get_indexed_exposure.

saltsafeio.changedir(path)

change working directory

saltsafeio.checkfornone(inval)
saltsafeio.cleanpropcode(pids, propids)

Create the list of appropriate proprosal codes

saltsafeio.closeascii(file)

close ASCII file

saltsafeio.closefits(struct)

close HDU structure

saltsafeio.comparelists(list1, list2, name1, name2)

are two lists the same length?

saltsafeio.copy(file1, file2)

copy file

saltsafeio.copydir(file1, file2)

copy direcotry recursively

saltsafeio.createdir(path)

create a directory

saltsafeio.delete(infile)

delete a file

saltsafeio.deletedir(path)

delete a directory

saltsafeio.email(server, username, password, sender, recipient, bcc, subject, message)

send email

saltsafeio.filedefined(filetype, file)

has a file been defined?

saltsafeio.filedoesnotexist(infile)

check that a file does not exist

saltsafeio.fileexists(infile)

check that a file exists

saltsafeio.filesexist(infiles, path, mode)

check files in list exist

saltsafeio.fitscolumns(columns)

construct FITS table columns

saltsafeio.getSection(section, iraf_format=True)
Given an input string for a section in an image, it will
return the input as a list.
section: An input string given a section in the image
Set to None to return the whole image

iraf_format: It will invert the x and y values

saltsafeio.get_exposure(files, number=1)

Given a list of fits files returns exposure data as numpy array.

By default get_exposure will return the first exposure with data. If number parameter is given it will browse the file list until the requested exposure number is found.

Because of this browing get_exposure is only fast for small exposure number. If the exposure numbers are always big or if you need to access a lot of exposures you should use build_exposure_index and get_indexed_exposure instead.

saltsafeio.get_indexed_exposure(files, index, number=1)

Given a list of fits files and a index generated by build_exposure_index it returns the requested exposure as a numpy array.

By default get_exposure will return the first exposure with data. If number parameter is given it will browse the file list until the requested exposure number is found.

The index consumes a lot of memory. Only use get_indexed_exposure when you need to access a large number of exposures fast, or when the exposure number is always big. Otherwise you should use get_exposure instead.

saltsafeio.listexists(filetype, file)

does a list file exist, i.e. a parameter that begins with the ‘@’ character

saltsafeio.listparse(listtype, inlist, pref, altlist, path)

create a list from a file or parameter

saltsafeio.logname(file)

test the log file exists

saltsafeio.move(file1, file2)

move file

saltsafeio.newfitstable(table, infile=None)

write FITS table

saltsafeio.openascii(file, type)

open ASCII file

saltsafeio.openbinary(file, type)

Open binary file.

saltsafeio.openfits(infile, mode='copyonwrite', memmap=False)

open FITS file

saltsafeio.openupdatefits(infile)

open FITS file for updating

saltsafeio.overwrite(infile, clobber)

clobber if file is to be overwritten

saltsafeio.pathexists(path)

check that a path exists and name ends with a /

saltsafeio.readbinary(content, size, format)

read data from a binary file.

saltsafeio.readccdgeom(geomfile)

read CCD geometry definition file

saltsafeio.readgaindb(gaindb)

read gain database file

saltsafeio.readheader(struct, hdu)

read image from HDU structure

saltsafeio.readimage(struct, hdu)

read image from HDU structure

saltsafeio.readimages(filetype, images)

Read in and parse a list of input images

saltsafeio.readlist(param)

Returns list from epar parameter.

It accepts the following for param A filename prefixed by @, for example:

readlist('@images')

will read names from the file images. A comma separated list of filenames

saltsafeio.readtab(hdu, infile='')

read FITS table HDU

saltsafeio.readxtalkcoeff(xtalkfile)

read crosstalk coefficent file

saltsafeio.removebadpids(pids)

Remove propcodes that you do not want –namely junk, bias, test

saltsafeio.removeengineeringpids(pids)

Removing propcodes that are associated with engineering and calibration proposals

create symbolic link

saltsafeio.tmpfile(path)

create a temporary file name

saltsafeio.updatefits(struct)

update existing FITS file

saltsafeio.writefits(struct, outfile, clobber=True)

write to FITS file

saltsafeio.writeimage(struct, hdu, imagedata)

write image from HDU structure

saltsafeio.yn_ask(msg)

Ask for a [y/n] user response

returns the response

Previous topic

saltprint

Next topic

saltsafelog

This Page