Esempio n. 1
0
def galextract(img, yc=None, dy=None, normalize=True, calfile=None, convert=True, specformat='ascii'):

    
    #set up some files that will be needed
    logfile='specext.log'


    #create the spectra text files for all of our objects
    spec_list=[]
    #skynormalize the data
    if normalize:
       specslitnormalize(img, 'n'+img, '', response=None, response_output=None, order=3, conv=1e-2, niter=20,
                     startext=0, clobber=True,logfile='salt.log',verbose=True)

    hdu=pyfits.open('n'+img)
    target=hdu[0].header['OBJECT']
    ofile='%s.%s_%i_%i.ltxt' % (target, extract_date(img), extract_number(img), yc)
    #ofile = img.replace('fits', 'txt')

    extract_spectra(hdu, yc, dy, ofile, smooth=False, grow=10, clobber=True, specformat=specformat, convert=convert)

    if calfile is not None: 
           airmass=hdu[0].header['AIRMASS']
           exptime=hdu[0].header['EXPTIME']
           extfile=iraf.osfn("pysalt$data/site/suth_extinct.dat")
           speccal(ofile, ofile.replace("txt", "spec"), calfile, extfile, airmass, exptime, clobber=True, logfile='salt.log', verbose=True)
Esempio n. 2
0
def galextract(img,
               yc=None,
               dy=None,
               normalize=True,
               calfile=None,
               convert=True,
               specformat='ascii'):

    #set up some files that will be needed
    logfile = 'specext.log'

    #create the spectra text files for all of our objects
    spec_list = []
    #skynormalize the data
    if normalize:
        specslitnormalize(img,
                          'n' + img,
                          '',
                          response=None,
                          response_output=None,
                          order=3,
                          conv=1e-2,
                          niter=20,
                          startext=0,
                          clobber=True,
                          logfile='salt.log',
                          verbose=True)

    hdu = pyfits.open('n' + img)
    target = hdu[0].header['OBJECT']
    ofile = '%s.%s_%i_%i.ltxt' % (target, extract_date(img),
                                  extract_number(img), yc)
    #ofile = img.replace('fits', 'txt')

    extract_spectra(hdu,
                    yc,
                    dy,
                    ofile,
                    smooth=False,
                    grow=10,
                    clobber=True,
                    specformat=specformat,
                    convert=convert)

    if calfile is not None:
        airmass = hdu[0].header['AIRMASS']
        exptime = hdu[0].header['EXPTIME']
        extfile = iraf.osfn("pysalt$data/site/suth_extinct.dat")
        speccal(ofile,
                ofile.replace("txt", "spec"),
                calfile,
                extfile,
                airmass,
                exptime,
                clobber=True,
                logfile='salt.log',
                verbose=True)
Esempio n. 3
0
def galextract(img, yc=None, dy=None, normalize=True, calfile=None, convert=True, specformat='ascii'):

    
    #set up some files that will be needed
    logfile='specext.log'


    #create the spectra text files for all of our objects
    spec_list=[]
    #skynormalize the data
    if normalize:
       specslitnormalize(img, 'n'+img, '', response=None, response_output=None, order=3, conv=1e-2, niter=20,
                     startext=0, clobber=True,logfile='salt.log',verbose=True)

    hdu=pyfits.open('n'+img)
    target=hdu[0].header['OBJECT']
    ofile='%s.%s_%i_%i.ltxt' % (target, extract_date(img), extract_number(img), yc)
    if specformat=='lcogt': ofile=ofile.replace('ltxt', 'fits')
    #ofile = img.replace('fits', 'txt')

    extract_spectra(hdu, yc, dy, ofile, smooth=False, grow=10, clobber=True, specformat=specformat, convert=convert, calfile=calfile)