| 1 |
EXTRAP.PY |
| 2 |
|
| 3 |
PURPOSE: |
| 4 |
======= |
| 5 |
This script was written to automatically force the endpoints of a |
| 6 |
synphot throughput file to zero. |
| 7 |
|
| 8 |
- it can safely be run on files that already meet this condition; it |
| 9 |
will detect that the file does not need to be changed. |
| 10 |
|
| 11 |
- it can handle simple files (wavelength/throughput only), |
| 12 |
parameterized files (wavelength + many throughput) with or without |
| 13 |
an error column, and simple files with an error column |
| 14 |
(wave, thru, error). If an error column is |
| 15 |
present, the error value of the extra points is set to 100. |
| 16 |
|
| 17 |
- it automatically updates the version number in the filename and |
| 18 |
writes history into the primary header |
| 19 |
|
| 20 |
FILES: |
| 21 |
===== |
| 22 |
This directory also contains one file of each known type that can be |
| 23 |
used for testing: |
| 24 |
|
| 25 |
hst_ota_007_syn.fits: no change necessary |
| 26 |
acs_hrc_win_005_syn.fits: simple file |
| 27 |
acs_sbc_aper_002_syn.fits: parameterized file |
| 28 |
wfpc2_f814w_006_syn.fits: simple file + error |
| 29 |
|
| 30 |
|
| 31 |
Usage: |
| 32 |
===== |
| 33 |
- From the shell: |
| 34 |
python extrap.py *syn.fits |
| 35 |
|
| 36 |
The script will correctly handle the shell expansion of the |
| 37 |
filenames, and loop over all of them, printing the return value. |
| 38 |
|
| 39 |
- From within python: |
| 40 |
import extrap |
| 41 |
extrap.run(fname,outdir='update') |
| 42 |
|
| 43 |
If run from within the python interpreter, an optional 'outdir' |
| 44 |
keyword can be supplied so that the new files will be written to |
| 45 |
this directory, which will be created if it does not already exist. |
| 46 |
|
| 47 |
Typical use from the shell would include a loop: |
| 48 |
|
| 49 |
import glob |
| 50 |
flist=glob.glob('/some/dir/*_syn.fits') |
| 51 |
for fname in flist: |
| 52 |
extrap.run(fname,outdir='other/dir/') |
| 53 |
|
| 54 |
|
| 55 |
Buildtmc: |
| 56 |
======== |
| 57 |
|
| 58 |
An extra function was added that can be used to construct a new TMC |
| 59 |
file from an existing TMC file and a directory tree containing a |
| 60 |
mixture of updated and non-updated files. It must be run from within |
| 61 |
python and takes the tmcname as an argument. |
| 62 |
|
| 63 |
import extrap |
| 64 |
extrap.buildtmc('uniqname.tmc') |
| 65 |
|