View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

scopy creating a new file when asked to cobble and merge

gdrude wrote on Sep 29, 2009

I have been attempting to create a script which trims the edges for each aperture in a multispec fits file. The echelle data I have has incredibly low S/N ratio along the edges. I am attempting to write a script that will go through each aperture and scopy out the region I am interested in and put that aperture into an output file. I will repeat this for each aperture (there are 36 of them) and then move onto the next file.

The problem is that it creates the first file just fine, but when I attempt to copy the second aperture into the previous output, it produces a new file. This has been occuring through the standard cl shell as well as the pyraf script I have written. I have merge, clobber,rebin, and verbose set to yes, while renumber set to no.

#! /usr/bin/env python

import sys
from getfilecontents import *
from pyraf import iraf

def run_scopy(inputfile, outputfile, range):
    iraf.noao(_doprint=0)
    iraf.onedspec(_doprint=0)
    
    iraf.scopy(inputfile,outputfile,w1=range[0],w2=range[1],\
apertures=range[2],apmodulus=0,format='multispec',\
renumber='no',offset=0,clobber='yes',merge='yes',rebin='yes',\
verbose='yes')

def trim_echelle(filelistname,rangefilename):
    filelist = getcontents(filelistname)
    range_app = getsplitcontents(rangefilename)

    for range in range_app:
        for filename in filelist:
            cfilename = filename.strip()
            outputfile = filename[:filename.rfind('.fits')]+'.trimmed.fits'
            run_scopy(cfilename,outputfile, range)



Above is the script I use. It is not pretty yet, I am using this for testing. The range file has 36 lines and three collumns:
starting wavelength ending wavelength aperture

The filelistname is a file containing one file name per line.

Thank you for your help. I am sure there is something obvious I am missing, but no amount of googling is helping.

Best,
Jerry Rude

Mike Fitzpatrick wrote on Sep 29, 2009

Just a guess, but I think you either need to turn the SCOPY 'renumber' parameter on or else turn 'clobber' off. Frank will of course have a more expert opinion.

-Mike

gdrude wrote on Sep 29, 2009

fitz

Just a guess, but I think you either need to turn the SCOPY 'renumber' parameter on or else turn 'clobber' off. Frank will of course have a more expert opinion.

-Mike


Thank you for the reply. I ended up hacking together a script to accomplish the task. It is really ugly however and I am to embarrassed to post it. I will play with turning clobber off and on tomorrow. Thank you again for your time.

Jerry

Last post on Sep 29, 2009