本文整理汇总了Python中pyraf.iraf.osfn函数的典型用法代码示例。如果您正苦于以下问题:Python osfn函数的具体用法?Python osfn怎么用?Python osfn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osfn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: advanceprocess
def advanceprocess(instrume, obsdate, propcode, median, function, order, rej_lo, rej_hi, niter, interp, sdbhost, sdbname, sdbuser, sdbpass, logfile, verbose):
"""Advance process the rss data"""
rawpath = instrume+'/raw'
prodpath = instrume+'/advance'
os.mkdir(prodpath)
instrume_name='RSS'
prefix = 'P'
img_list=[]
for img in glob.glob('%s/raw/%s*fits' % (instrume, prefix)):
struct=pyfits.open(img)
if struct[0].header['PROPID'].upper().strip() != 'JUNK':
img_list.append(img)
images=','.join(img_list)
obslog = '%s/%s%sOBSLOG.fits' % (prodpath, prefix, obsdate)
gaindb = iraf.osfn('pysalt$data/%s/%samps.dat' % (instrume, instrume_name))
xtalkfile = iraf.osfn('pysalt$data/%s/%sxtalk.dat' % (instrume, instrume_name))
geomfile = iraf.osfn('pysalt$data/%s/%sgeom.dat' % (instrume, instrume_name))
saltadvance(images, prodpath, obslogfile=obslog, gaindb=gaindb, xtalkfile=xtalkfile,
geomfile=geomfile, subover=True,trim=True,masbias=None,
subbias=False, median=False, function='polynomial', order=5,rej_lo=3,
rej_hi=3, niter=5,interp='linear', sdbhost=sdbhost, sdbname=sdbname,sdbuser=sdbuser, password=sdbpass,
clobber=True, logfile=logfile, verbose=verbose)
return
开发者ID:saltastro,项目名称:pipetools,代码行数:26,代码来源:saltpipe.py
示例2: processdata
def processdata(instrume, obsdate, propcode, median, function, order, rej_lo, rej_hi, niter, interp, logfile, verbose):
"""Clean and process the data"""
#set up instrument specific naming
if instrume=='rss':
instrume_name='RSS'
prefix='P'
elif instrume=='scam':
instrume_name='SALTICAM'
prefix='S'
rawpath = instrume+'/raw'
prodpath = instrume+'/product'
img_list=[]
for img in glob.glob('%s/raw/%s*fits' % (instrume, prefix)):
struct=pyfits.open(img)
if struct[0].header['PROPID'].upper().strip() != 'JUNK':
img_list.append(img)
img_str=','.join(img_list)
obslog = '%s/%s%sOBSLOG.fits' % (prodpath, prefix, obsdate)
gaindb = iraf.osfn('pysalt$data/%s/%samps.dat' % (instrume, instrume_name))
#gaindb = ''
xtalkfile = iraf.osfn('pysalt$data/%s/%sxtalk.dat' % (instrume, instrume_name))
geomfile = iraf.osfn('pysalt$data/%s/%sgeom.dat' % (instrume, instrume_name))
if len(img_list)>0:
saltclean(images=img_str,outpath=prodpath,obslogfile=obslog,gaindb=gaindb,
xtalkfile=xtalkfile,geomfile=geomfile,subover=True,trim=True,
median=median,function=function,order=order,rej_lo=rej_lo,
rej_hi=rej_hi,niter=niter,masbias=True,subbias=False,interp=interp,
clobber=True,logfile=logfile,verbose=verbose)
rawsize = 0.
rawnum = 0
prodsize = 0.
prodnum = 0
if len(img_list)>0:
files = glob.glob('%s/raw/%s*.fits' % (instrume, prefix))
rawnum = len(files)
for file in files:
rawsize += os.stat(file).st_size
files = glob.glob('%s/product/*%s*.fits' % (instrume, prefix))
prodnum = len(files)
for file in files:
prodsize += os.stat(file).st_size
# collate RSS data for individual PIs
outpath = '.'
if len(img_list):
saltobsid(propcode=propcode,obslog=obslog,rawpath=rawpath,prodpath=prodpath, outpath=outpath,clobber=True,logfile=logfile,verbose=verbose)
return rawsize, rawnum, prodsize, prodnum
开发者ID:saltastro,项目名称:pipetools,代码行数:51,代码来源:saltpipe.py
示例3: preprocessdata
def preprocessdata(instrume, prefix, obsdate, keyfile, log, logfile, verbose):
"""Run through all of the processing of the individual data files"""
log.message('Beginning pre-processing of %s data' % instrume.upper())
#set up the input path
inpath=instrume+'/raw/'
#creaate the product directory
prodpath=instrume+'/product/'
saltio.createdir(prodpath)
# convert any slot mode binary data to FITS
convertbin(inpath, iraf.osfn('pysalt$data/%s/%s_fits.config' % (instrume, instrume)), logfile, verbose)
# fix sec keywords for data of unequal binning obtained before 2006 Aug 12
if int(obsdate) < 20060812:
pinfiles = instrume+'/raw/*.fits'
log.message('Fixing SEC keywords in older data')
log.message('SALTFIXSEC -- infiles=' + pinfiles)
pipetools.saltfixsec(infiles=pinfiles)
#fix the key words for the data set
recfile = prodpath+prefix+ obsdate + 'KEYLOG.fits'
img=','.join(glob.glob(inpath+prefix+'*fits'))
if img:
salteditkey(images=img,outimages=img,outpref='',keyfile=keyfile,recfile=recfile,
clobber=True,logfile=logfile,verbose=verbose)
开发者ID:saltastro,项目名称:pipetools,代码行数:29,代码来源:saltpipe.py
示例4: agncalibrate
def agncalibrate(img, outfile, calfile, specformat='lcogt'):
#set up some files that will be needed
logfile='specext.log'
hdu = fits.open(img)
w1 = hdu[0].header['CRVAL1']
p1 = hdu[0].header['CRPIX1']
dw = hdu[0].header['CD1_1']
f = hdu[0].data[0][0]
e = hdu[0].data[3][0]
xarr = np.arange(len(f))
w = (xarr)*dw+w1
cal_spectra=st.readspectrum(calfile, error=False, ftype='ascii')
airmass=hdu[0].header['AIRMASS']
exptime=hdu[0].header['EXPTIME']
extfile=iraf.osfn("pysalt$data/site/suth_extinct.dat")
ext_spectra=st.readspectrum(extfile, error=False, ftype='ascii')
flux_spec=Spectrum.Spectrum(w, f, e, stype='continuum')
flux_spec=calfunc(flux_spec, cal_spectra, ext_spectra, airmass, exptime, True)
hdu[0].data[0][0] = flux_spec.flux
hdu[0].data[3][0] = flux_spec.var
hdu.writeto(outfile, clobber=True)
开发者ID:crawfordsm,项目名称:zSALT,代码行数:27,代码来源:agncalibrate.py
示例5: galextract
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)
开发者ID:astro-Liz-zz,项目名称:zSALT,代码行数:26,代码来源:galextract.py
示例6: specpolfilter
def specpolfilter(filterlist, infilelist):
obss = len(infilelist)
obsdict=obslog(infilelist)
for b in range(obss):
hdul = pyfits.open(infilelist[b])
dwav = float(hdul['SCI'].header['CDELT1'])
wav0 = float(hdul['SCI'].header['CRVAL1'])
wavs = int(hdul['SCI'].header['NAXIS1'])
ctypelist = (hdul['SCI'].header['CTYPE3']).split(',')
stokes_sw = hdul['SCI'].data[:,0,:]
var_sw = hdul['VAR'].data[:,0,:]
pstokess = len(ctypelist)-1
ok_w = (hdul['BPM'].data[:,0,:] == 0).all(axis=0)
wav_w = wav0 + dwav*np.arange(wavs)
print "\n"+infilelist[b]
print ("Filter "+pstokess*"%5s Err ") % tuple(ctypelist[1:])
for filter in filterlist:
if filter in ("U","B","V"):
filterfile = iraf.osfn("pysalt$data/scam/filters/Johnson_"+filter+".txt")
elif filter in ("R","I"):
filterfile = iraf.osfn("pysalt$data/scam/filters/Cousins_"+filter+".txt")
# else:
# (filter file in cwd)
wav_l,feff_l = np.loadtxt(filterfile,dtype=float,unpack=True)
feff_l[feff_l < .0001] = 0.
feff_w = interp1d(wav_l,feff_l,kind='linear',bounds_error=False)(wav_w)
okf_w = (ok_w & (feff_w > .0003))
feff_w[~okf_w] = 0.
if feff_w[okf_w].sum() == 0: continue
stokesfil_s = (feff_w[okf_w]*stokes_sw[:,okf_w]).sum(axis=1)/feff_w[okf_w].sum()
varfil_s = (feff_w[okf_w]**2*var_sw[:,okf_w]).sum(axis=1)/(feff_w[okf_w].sum()**2)
nstokesfil_s = 100.*stokesfil_s/stokesfil_s[0]
nerrfil_s = 100.*np.sqrt(varfil_s[:pstokess+1])/stokesfil_s[0]
print ("%4s "+pstokess*"%9.4f %7.4f ") % \
(tuple(filter)+tuple(np.vstack((nstokesfil_s[1:],nerrfil_s[1:])).T.ravel()))
return()
开发者ID:ilkiewicz,项目名称:polsalt,代码行数:43,代码来源:specpolfilter.py
示例7: init_northsouth
def init_northsouth(fs, topdir, rawpath):
# Get the correct directory for the standard star
base_stddir = 'spec50cal/'
extfile = iraf.osfn('gmisc$lib/onedstds/kpnoextinct.dat')
observatory = 'Gemini-North'
global is_GS
is_GS = pyfits.getval(fs[0], 'DETECTOR') == 'GMOS + Hamamatsu'
if is_GS:
global dooverscan
dooverscan = True
if not os.path.exists(topdir + '/raw_fixhdr'):
os.mkdir(topdir + '/raw_fixhdr')
rawpath = '%s/raw_fixhdr/' % topdir
os.system('gmoss_fix_headers.py --files="%s/raw/*.fits" --destination=%s' % (topdir, rawpath))
base_stddir = 'ctionewcal/'
observatory = 'Gemini-South'
extfile = iraf.osfn('gmisc$lib/onedstds/ctioextinct.dat')
return extfile, observatory, base_stddir, rawpath
开发者ID:svalenti,项目名称:lcogtgemini,代码行数:19,代码来源:reduce.py
示例8: mosred
def mosred(infile_list, slitmask,propcode=None, dy=0, inter=True, guesstype='rss', guessfile='', rstep=100, automethod='Matchlines', preprocess=False):
#set up the files
infiles=','.join(['%s' % x for x in infile_list])
obsdate=os.path.basename(infile_list[0])[7:15]
#set up some files that will be needed
logfile='spec'+obsdate+'.log'
dbfile='spec%s.db' % obsdate
#create the observation log
obs_dict=obslog(infile_list)
#check the value of dy
#apply the mask to the data sets
for i in range(len(infile_list)):
specslit(image=infile_list[i], outimage='', outpref='s', exttype='rsmt', slitfile=slitmask,
outputslitfile='', regprefix='ds_', sections=3, width=25.0, sigma=2.2, thres=6.0, order=1, padding=5, yoffset=dy,
inter=False, clobber=True, logfile=logfile, verbose=True)
for i in range(len(infile_list)):
if obs_dict['OBJECT'][i].upper().strip()=='ARC' and (obs_dict['PROPID'][i].upper().strip()==propcode or propcode is None):
lamp=obs_dict['LAMPID'][i].strip().replace(' ', '')
arcimage='s'+os.path.basename(infile_list[i])
if lamp == 'NONE': lamp='CuAr'
lampfile=iraf.osfn("pysalt$data/linelists/%s.salt" % lamp)
specselfid(arcimage, '', 'a', arcimage, 'middlerow', 3, clobber=True, logfile=logfile, verbose=True)
specidentify('a'+arcimage, lampfile, dbfile, guesstype=guesstype,
guessfile=guessfile, automethod=automethod, function='legendre', order=3,
rstep=rstep, rstart='middlerow', mdiff=20, thresh=3, niter=5, smooth=3,
inter=True, clobber=True, preprocess=True, logfile=logfile, verbose=True)
#specrectify(arcimage, outimages='', outpref='x', solfile=dbfile, caltype='line',
# function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
# blank=0.0, clobber=True, logfile=logfile, verbose=True)
objimages=''
spec_list=[]
for i in range(len(infile_list)):
if obs_dict['CCDTYPE'][i].count('OBJECT') and obs_dict['INSTRUME'][i].count('RSS') and \
(obs_dict['PROPID'][i].upper().strip()==propcode or propcode is None) and \
obs_dict['OBSMODE'][i].count('SPECTROSCOPY'):
img = infile_list[i]
##rectify it
specselfid('s'+img, '', 'a', arcimage, 'middlerow', 3, clobber=True, logfile=logfile, verbose=True)
specrectify('as'+img, outimages='', outpref='x', solfile=dbfile, caltype='line',
function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
blank=0.0, clobber=True, logfile=logfile, verbose=True)
开发者ID:crawfordsm,项目名称:zSALT,代码行数:52,代码来源:mosred.py
示例9: specred
def specred(infile_list, target, propcode, calfile=None, inter=True, automethod='Matchlines'):
#set up the files
infiles=','.join(['%s' % x for x in infile_list])
obsdate=os.path.basename(infile_list[0])[7:15]
#set up some files that will be needed
logfile='spec'+obsdate+'.log'
dbfile='spec%s.db' % obsdate
#create the observation log
obs_dict=obslog(infile_list)
for i in range(len(infile_list)):
if obs_dict['OBJECT'][i].upper().strip()=='ARC' and obs_dict['PROPID'][i].upper().strip()==propcode:
lamp=obs_dict['LAMPID'][i].strip().replace(' ', '')
arcimage=os.path.basename(infile_list[i])
if lamp == 'NONE': lamp='CuAr'
lampfile=iraf.osfn("pysalt$data/linelists/%s.salt" % lamp)
specidentify(arcimage, lampfile, dbfile, guesstype='rss',
guessfile='', automethod=automethod, function='legendre', order=3,
rstep=100, rstart='middlerow', mdiff=20, thresh=3, niter=5, smooth=3,
inter=False, clobber=True, logfile=logfile, verbose=True)
specrectify(arcimage, outimages='', outpref='x', solfile=dbfile, caltype='line',
function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
blank=0.0, clobber=True, logfile=logfile, verbose=True)
objimages=''
spec_list=[]
for i in range(len(infile_list)):
if obs_dict['CCDTYPE'][i].count('OBJECT') and obs_dict['INSTRUME'][i].count('RSS') and obs_dict['PROPID'][i].upper().strip()==propcode:
img = infile_list[i]
##rectify it
specrectify(img, outimages='', outpref='x', solfile=dbfile, caltype='line',
function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
blank=0.0, clobber=True, logfile=logfile, verbose=True)
#extract the spectra
spec_list.append(extract_spectra('x'+img, yc=1030, calfile=calfile, findobject=True, smooth=False, maskzeros=True, clobber=True))
#combine the results
w,f,e = speccombine(spec_list, obsdate)
outfile = "%s_%s.spec" % (target, obsdate)
write_spectra(outfile, w,f,e)
开发者ID:astro-Liz-zz,项目名称:zSALT,代码行数:46,代码来源:specreduce.py
示例10: buildtmc
def buildtmc(tmcname):
from pyraf import iraf
from iraf import stsdas,hst_calib,synphot
out=open('buildtmc.log','w')
f=pyfits.open(tmcname)
flist=f[1].data.field('filename')
iraf.set(crrefer='./') #work locally
for k in range(len(flist)):
oldname=iraf.osfn(flist[k]).split('[')[0]
newname=fincre(oldname)
if os.path.exists(newname):
flist[k]=fincre(flist[k])
else:
out.write("%s: no change necessary\n"%oldname)
f.writeto(tmcname.replace(".fits","_new.fits"))
out.close()
开发者ID:artifex85,项目名称:pysynphot,代码行数:17,代码来源:extrap.py
示例11: makesensfunc
def makesensfunc(scifiles, objname, base_stddir, extfile):
#TODO use individual standard star observations in each setting, not just red and blue
for f in scifiles:
redorblue = getredorblue(f)
# If this is a standard star, run standard
# Standards will have an observation class of either progCal or partnerCal
# Standards will have an observation class of either progCal or partnerCal
obsclass = pyfits.getval(f[:-4] + '.fits', 'OBSCLASS')
if obsclass == 'progCal' or obsclass == 'partnerCal':
# Figure out which directory the stardard star is in
stddir = iraf.osfn('gmisc$lib/onedstds/') + base_stddir
# iraf.gsstandard('est' + f[:-4], 'std' + redorblue,
# 'sens' + redorblue, starname=objname.lower(),
# caldir='gmisc$lib/onedstds/'+stddir, fl_inter=True)
specsens('et' + f[:-4] + '.fits', 'sens' + redorblue + '.fits',
stddir + objname + '.dat' , extfile,
float(pyfits.getval(f[:-4] + '.fits', 'AIRMASS')),
float(pyfits.getval(f[:-4] + '.fits', 'EXPTIME')))
开发者ID:svalenti,项目名称:lcogtgemini,代码行数:20,代码来源:reduce.py
示例12: setglobal
def setglobal(self,fname=None):
if fname is None:
fname=__file__
self.propername=self.id()
base,ext=os.path.splitext(os.path.basename(fname))
main,case,test=self.propername.split('.')
self.name=os.path.join(base,test,case)
self.wavename=self.name+'_wave.fits'
#Make sure the directories exist
dirname=os.path.dirname(self.name)
if not os.path.isdir(dirname):
os.makedirs(dirname)
self.file=self.name
self.thresh=0.01
self.superthresh=0.20
self.sigthresh=0.01
self.discrep=-99
self.tda={'Obsmode':self.obsmode,
'Spectrum':self.spectrum,
'ETCid':None, #placeholder
'Thresh':self.thresh,
'Superthresh':self.superthresh,
'SigThresh':self.sigthresh,
'crrefer':iraf.osfn('crrefer$'),
'pysyn_cdbs':os.environ['PYSYN_CDBS'],
'SkyLines':self.hasSkyLines()}
try:
self.tda['Subset']=self.subset
except AttributeError:
pass
try:
self.tda['ETCid']=self.etcid
except AttributeError:
pass
try:
self.tda['form']=self.form
except AttributeError:
pass
self.tra={}
开发者ID:dhomeier,项目名称:pysynphot,代码行数:41,代码来源:basecase.py
示例13: specred
def specred(infile_list, propcode=None, inter=True, automethod='Matchlines'):
#set up the files
infiles=','.join(['%s' % x for x in infile_list])
obsdate=os.path.basename(infile_list[0])[7:15]
#set up some files that will be needed
logfile='spec'+obsdate+'.log'
dbfile='spec%s.db' % obsdate
#create the observation log
obs_dict=obslog(infile_list)
for i in range(len(infile_list)):
if obs_dict['OBJECT'][i].upper().strip()=='ARC' and obs_dict['PROPID'][i].upper().strip()==propcode:
lamp=obs_dict['LAMPID'][i].strip().replace(' ', '')
arcimage=os.path.basename(infile_list[i])
if lamp == 'NONE': lamp='CuAr'
lampfile=iraf.osfn("pysalt$data/linelists/%s.salt" % lamp)
#lampfile='/Users/crawford/research/kepler/Xe.salt'
specidentify(arcimage, lampfile, dbfile, guesstype='rss',
guessfile='', automethod=automethod, function='legendre', order=3,
rstep=100, rstart='middlerow', mdiff=20, thresh=3, niter=5, smooth=3,
inter=inter, clobber=True, logfile=logfile, verbose=True)
#specrectify(arcimage, outimages='', outpref='x', solfile=dbfile, caltype='line',
# function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
# blank=0.0, clobber=True, logfile=logfile, verbose=True)
objimages=''
spec_list=[]
for i in range(len(infile_list)):
if obs_dict['CCDTYPE'][i].count('OBJECT') and obs_dict['INSTRUME'][i].count('RSS') and obs_dict['PROPID'][i].upper().strip()==propcode:
img = infile_list[i]
##rectify it
specrectify(img, outimages='', outpref='x', solfile=dbfile, caltype='line',
function='legendre', order=3, inttype='interp', w1=None, w2=None, dw=None, nw=None,
blank=0.0, nearest=True, clobber=True, logfile=logfile, verbose=True)
开发者ID:dmnielsen,项目名称:zSALT,代码行数:39,代码来源:specred.py
示例14: createbadpixel
def createbadpixel(inhdu, bphdu, sci_ext, bp_ext):
"""Create the bad pixel hdu from a bad pixel hdu"""
if bphdu is None:
data=inhdu[sci_ext].data*0.0
else:
infile=inhdu._HDUList__file.name
bpfile=bphdu._HDUList__file.name
if not saltkey.compare(inhdu[0], bphdu[0], 'INSTRUME', infile, bpfile):
message = '%s and %s are not the same %s' % (infile,bpfile, 'INSTRUME')
raise SaltError(message)
for k in ['CCDSUM', 'NAXIS1', 'NAXIS2']:
if not saltkey.compare(inhdu[sci_ext], bphdu[sci_ext], k, infile, bpfile):
message = '%s and %s are not the same %s' % (infile,bpfile, k)
raise SaltError(message)
data=bphdu[sci_ext].data.copy()
header=inhdu[sci_ext].header.copy()
header['EXTVER']=bp_ext
header.update('SCIEXT',sci_ext,comment='Extension of science frame')
return pyfits.ImageHDU(data=data, header=header, name='BPM')
# -----------------------------------------------------------
# main code
if not iraf.deftask('saltprepare'):
parfile = iraf.osfn("saltred$saltprepare.par")
t = iraf.IrafTaskFactory(taskname="saltprepare",value=parfile,function=saltprepare, pkgname='saltred')
开发者ID:cmccully,项目名称:pysalt,代码行数:29,代码来源:saltprepare.py
示例15: masktool
from pyraf.iraf import pysalt
import os, string, sys, glob, pyfits, time
from PyQt4 import QtCore, QtGui
from pySlitMask import SlitMaskGui
from saltsafelog import logging, history
from salterror import SaltError
debug=True
# -----------------------------------------------------------
# core routine
def masktool(catalog='', image='', logfile='salt.log', verbose=True):
with logging(logfile,debug) as log:
app = QtGui.QApplication([])
myapp = SlitMaskGui(infile=catalog, inimage=image)
myapp.show()
app.exec_()
# -----------------------------------------------------------
# main code
parfile = iraf.osfn("proptools$masktool.par")
t = iraf.IrafTaskFactory(taskname="masktool",value=parfile,function=masktool, pkgname='proptools')
开发者ID:apodemus,项目名称:pysalt3,代码行数:30,代码来源:masktool.py
示例16:
x1=0
y2=y2
x2=x2
else:
y1=0
x1=x2
x2=x1+x2
elif detector=='hrdet':
y1=0
if i%2==1: x1=0
if i%2==0:
x1=x2
x2=x1+x2
if i>2:
y1=y2
y2=y1+y2
data[y1:y2,x1:x2]=hdu[i].data
ihdu = pyfits.ImageHDU(data)
nhdu = pyfits.HDUList([hdu[0], ihdu])
return nhdu
if not iraf.deftask('hrsstack'):
parfile = iraf.osfn("salthrs$hrsstack.par")
t = iraf.IrafTaskFactory(taskname="hrsstack",value=parfile,function=hrsstack, pkgname='salthrs')
开发者ID:saltastro,项目名称:pysalt,代码行数:29,代码来源:hrsstack.py
示例17: find_real_time
return t_real, t_wrong, t_start, t_arr, ysum_arr
def find_real_time(dt, t_min, t_max):
"""Find the real exposure+dead time
returns float
"""
t_e=np.arange(t_min,t_max,0.0001)
ysum=t_e*0.0
for i in range(len(t_e)):
ysum[i]=ntime_func(dt, t_e[i])
return t_e, ysum
def ntime_func(dt, t_e):
"""Merit function to determine best time
Weighted for the number of objects in each step
return float
"""
y=0
for j in range(len(dt)):
i=dt[j]/t_e
y += abs(i-round(i))
return y
# -----------------------------------------------------------
# main code
parfile = iraf.osfn("slottools$slotutcfix.par")
t = iraf.IrafTaskFactory(taskname="slotutcfix",value=parfile,function=slotutcfix,pkgname='slottools')
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:30,代码来源:slotutcfix.py
示例18: SaltIOError
# update the header values with the image name and extension number
try:
hdue = pyfits.ImageHDU(oarray)
hdue.header=header
hdue.header.update('ONAME',infile,'Original image name')
hdue.header.update('OEXT',hdu,'Original extension number')
except Exception as e:
msg='SALTPHOT--WARNING: Could not update image in newfits file for %s ext %i because %s' \
% (infile, hdu, e)
raise SaltIOError(msg)
hduList.append(hdue)
j +=1
# close FITS file
saltio.closefits(struct)
# close the output fits file:
try:
# write out the file
hduList.flush()
hduList.close()
except Exception as e:
raise SaltIOError('Failed to write %s because %s' % (outfits, e))
# -----------------------------------------------------------
# main code
parfile = iraf.osfn("slottools$slotback.par")
t = iraf.IrafTaskFactory(taskname="slotback",value=parfile,function=slotback,pkgname='slottools')
开发者ID:apodemus,项目名称:pysalt3,代码行数:30,代码来源:slotback.py
示例19: exposure
"of the number of frames per combined exposure (", frames_per_combined,
") so", total_frames % frames_per_combined, "frames from the end of "
"the range will be left off.")
toidx = toidx - (total_frames % frames_per_combined)
total_frames = toidx - fromidx
total_combined_frames = int(total_frames / frames_per_combined)
info("Output data cube will have", total_combined_frames, "total frames of", newexposure, "sec exposure")
info("Processing input data cube frames", fromidx, "to", toidx)
target_dir = tempfile.mkdtemp()
info("Created working directory {0} for intermediate data".format(target_dir))
try:
range_pairs = list((
fromidx + n * frames_per_combined,
fromidx + (n+1) * frames_per_combined - 1
) for n in range(0, total_combined_frames))
frame_paths = combine_cube_frames(cubefile, range_pairs, target_dir)
# frames_to_cube(frame_paths, outfile)
finally:
# Don't leave clutter if the task fails
# shutil.rmtree(target_dir)
info("Removed working directory {0}".format(target_dir))
# def frames_to_cube(frames, outfile):
parfile = iraf.osfn("aotools$aoavgcube.par")
t = iraf.IrafTaskFactory(taskname="aoavgcube", value=parfile, function=aoavgcube)
开发者ID:josePhoenix,项目名称:aotools,代码行数:30,代码来源:aoavgcube.py
示例20: status
# -----------------------------------------------------------
# main
if '--shell' in sys.argv:
import argparse
parser = argparse.ArgumentParser(description='Plot, create or edit custom light curve extraction masks for target pixel files')
parser.add_argument('--shell', action='store_true', help='Are we running from the shell?')
parser.add_argument('infile', help='name of input target pixel FITS file', type=str)
parser.add_argument('maskfile', help='name of ASCII custom aperture definition file', type=str)
parser.add_argument('--plotfile', default='', help='name of output PNG plot file', type=str)
parser.add_argument('--tabrow', default=2177, help='The table row containing the image to plot', type=int)
parser.add_argument('--imin', default=1.5e5, help='minimum of image intensity scale [e-]', type=float)
parser.add_argument('--imax', default=5.0e5, help='maximum of image intensity scale [e-]', type=float)
parser.add_argument('--iscale', default='logarithmic', help='type of image intensity scale',
type=str, choices=['linear','logarithmic','squareroot'])
parser.add_argument('--cmap', default='PuBu', help='image colormap', type=str)
parser.add_argument('--verbose', action='store_true', help='Write to a log file?')
parser.add_argument('--logfile', '-l', help='Name of ascii log file', default='kepcotrend.log', dest='logfile', type=str)
parser.add_argument('--status', '-e', help='Exit status (0=good)', default=0, dest='status', type=int)
args = parser.parse_args()
cmdLine=True
kepmask(args.infile, args.maskfile, args.plotfile, args.tabrow, args.imin, args.imax, args.iscale,
args.cmap, args.verbose, args.logfile, args.status, cmdLine)
else:
from pyraf import iraf
parfile = iraf.osfn("kepler$kepmask.par")
t = iraf.IrafTaskFactory(taskname="kepmask", value=parfile, function=kepmask)
开发者ID:rodluger,项目名称:PyKE,代码行数:30,代码来源:kepmask.py
注:本文中的pyraf.iraf.osfn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论