• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python iraf.hedit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyraf.iraf.hedit函数的典型用法代码示例。如果您正苦于以下问题:Python hedit函数的具体用法?Python hedit怎么用?Python hedit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hedit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: ExpNormalize

def ExpNormalize(images, outbase="_n"):
			
	# Build the list of output image names
	out = [os.path.splitext(i) for i in images]	# Split off the extension
	out = [i[0] + outbase + '.fits' for i in out]	# Paste the outbase at the end of the filename 
												# and put the extension back on
	# Get a list of exposure times.
	exp_times = [GetHeaderKeyword(i, 'exptime') for i in images]
	exp_times = [str(e) for e in exp_times]	
	
	# run imarith to do the normalization
	iraf.imarith.unlearn()
	iraf.imarith.op = '/'
	iraf.imarith.mode = 'h'

	for i in range(len(images)):
		iraf.imarith.operand1 = images[i]
		iraf.imarith.operand2 = exp_times[i]
		iraf.imarith.result = out[i]
	
		iraf.imarith()

		# update the exptime keyword		
		iraf.hedit.unlearn()
		iraf.hedit.verify='no'
		iraf.hedit.show='yes'
		iraf.hedit.update='yes'
		iraf.hedit.images=out[i]
		iraf.hedit.fields='exptime'
		iraf.hedit.value=1
		iraf.hedit.mode='h'

		iraf.hedit(Stdout=1)

	return out
开发者ID:ustphysics-demo,项目名称:recipes,代码行数:35,代码来源:PipeLineSupport.py


示例2: cos_clear2

def cos_clear2(filenames):
    outname = 'fake_' + filenames[0]
    if os.path.isfile(outname):
        print outname, 'is already exist'
    else:
        inname = filenames[0] + ',' + filenames[1]
        print 'runing cos_clear2, imcombine...'
        print 'make file', outname
        iraf.imcombine(input = inname
                , output = outname, headers = '', bpmasks = ''
                , rejmasks = '', nrejmasks = '', expmasks = ''
                , sigmas = '', imcmb = '$I', logfile = 'STDOUT'
                , combine = 'average', reject = 'minmax', project = False
                , outtype = 'real', outlimits = 'none', offsets = 'none'
                , masktype = 'none', maskvalue = 0, blank = 0.0
                , scale = 'exposure', zero = 'none', weight = 'none'
                , statsec = '', expname = 'EXPTIME', lthreshold = 'INDEF'
                , hthreshold = 'INDEF', nlow = 0, nhigh = 1
                , nkeep = 1, mclip = True, lsigma = 3.0
                , hsigma = 10.0, rdnoise = 'RDNOISE', gain = 'GAIN'
                , snoise = 0.0, sigscale = 0.1, pclip = -0.5, grow = 0.0)
        iraf.hedit(images = outname
                , fields = 'ncombine', value = '0', add = True
                , addonly = False, delete = False, verify = False
                , show = True, update = True)
        iraf.hedit(images = outname
                , fields = 'EXPTIME', value = '0', add = True
                , addonly = False, delete = False, verify = False
                , show = True, update = True)
    print 'display %s 1' % outname
    iraf.display(image = outname, frame = 1)
    filenames.append(outname)
    return cos_clear3(filenames)
开发者ID:zzxihep,项目名称:spec2015,代码行数:33,代码来源:ext_spec_line.py


示例3: omitPhotcorr

 def omitPhotcorr(self, file):
     """
     This function will change PHOTCORR keyword value to OMIT in the header
     of given file. The file can contain wildcards i.e. multiple files can
     be given on one command..
     """
     I.hedit(file, fields='PHOTCORR', value='omit', verify='no', show='no')
开发者ID:eddienko,项目名称:SamPy,代码行数:7,代码来源:ACSPhotometry.py


示例4: time_calibration

def time_calibration(input_file):
    """
    Obtain the calibration for time (hjd) by pyraf and the airmass for each image. Include in the header all information.
    """
    original_path = os.getcwd()
    save_path = input_file['save_path']
    #change to save data reduction directory
    os.chdir(save_path)
    print '\n Reading the list of images ....\n'
    planet = input_file['exoplanet'] #set exoplanet name
    images = sorted(glob.glob('AB'+planet+'*.fits'))
    print images
    #include de RA,DEC and epoch of the exoplanet
    RA,DEC,epoch = input_file['RA'],input_file['DEC'],input_file['epoch']
    #obtain ST JD using iraf task and introduce in the header
    for i in range(len(images)):
        hdr = fits.getheader(images[i])
        if int(split(hdr['UT'],':')[0]) < int(hdr['timezone']):
            new_date = use.yesterday(hdr['date-obs'])
            #print images[i], new_date
        else:
            new_date = hdr['date-obs']
        year,month,day = split(new_date,'-')
        iraf.asttimes(year=year,month=month,day=day,time=hdr['loctime'],obs=input_file['observatory'])
        JD = iraf.asttimes.jd #obtain julian date
        LMST = iraf.asttimes.lmst #obtain the sideral time
        LMST = use.sexagesimal_format(LMST) #convert sideral time in sexagesimal format
        iraf.hedit(images[i],'ST',LMST,add='yes',verify='no',show='no',update='yes') #create the ST keyword in the header
        iraf.ccdhedit(images[i],'LMST',LMST,type='string') #include the mean sideral time in the header
        iraf.ccdhedit(images[i],'JD',JD,type='string') #include de julian date in the header
        #include RA, and DEC of the object in your header
        iraf.ccdhedit(images[i],"RA",RA,type="string") #include right ascention in the header
        iraf.ccdhedit(images[i],"DEC",DEC,type="string")  #include declination in the header
        iraf.ccdhedit(images[i],"epoch",epoch,type="string") #include epoch in the header
        # use.update_progress((i+1.)/len(images))
    print '\n Setting airmass ....\n'
    for i in range(len(images)):
        print '# ',images[i]
        #iraf.hedit(images[i],'airmass',airmass,add='yes')
        #iraf.hedit(images[i],'HJD',HJD,add='yes')
        iraf.setairmass.observatory = input_file['observatory']
        iraf.setairmass(images[i])
        iraf.setjd.time = 'ut'
        iraf.setjd(images[i])
    print '\n.... done.\n'
    #export information
    hjd, jd, airmass, st = [],[],[],[]
    for i in range(len(images)):
        hdr = fits.getheader(images[i])
        hjd.append(hdr['HJD'])
        jd.append(hdr['JD'])
        airmass.append(hdr['airmass'])
        st.append(hdr['st'])
    #saving the data
    data = DataFrame([list(hjd),list(jd),list(st),list(airmass)]).T
    data.columns = ['HJD','JD','ST','Airmass']
    data.to_csv('results_iraf_calibrations.csv')
    #change to workings directory
    os.chdir(original_path)
    return
开发者ID:waltersmartinsf,项目名称:ExoTRed,代码行数:60,代码来源:__init__.py


示例5: main

def main():
    parser = argparse.ArgumentParser(description='Fixes BITPIX issue with archive data')
    parser.add_argument('filelist',nargs='+',help='Input images to process')

    args = parser.parse_args()

    for image in args.filelist:
        iraf.hedit(images=image,fields='BITPIX',value=32,update=True,show=True,addonly=True)
开发者ID:TravGrah,项目名称:IRMOS-pipeline,代码行数:8,代码来源:IRMOS_bitfix.py


示例6: test_hedit

    def test_hedit(self):
        if os.path.exists('image.real.fits'):
            os.remove('image.real.fits')

        iraf.imarith('dev$pix', '/', '1', 'image.real', pixtype='r')
        iraf.hedit('image.real', 'title', 'm51 real', verify=False,
                   Stdout="/dev/null")
        with fits.open('image.real.fits') as f:
            assert f[0].header['OBJECT'] == 'm51 real'
开发者ID:spacetelescope,项目名称:pyraf,代码行数:9,代码来源:test_basic.py


示例7: append_VHELIO

def append_VHELIO(image_file,v_value): #Note v_value must be string!
    iraf.hedit(
        images = image_file,\
        fields = "VHELIO",\
        value = v_value,\
        add = 1,\
        addonly = 0,\
        delete = 0,\
        verify = 0,\
        show = 1,\
        update = 1)
开发者ID:georgezhou,项目名称:hsfu23,代码行数:11,代码来源:calc_vel_offset.py


示例8: omitPHOTCORR

    def omitPHOTCORR(self):
        """
        Sets PHOTCORR keyword to OMIT to prevent crashing.

        :note: find a proper fix for this.
        :note: Change from iraf to pyfits.
        """
        for raw in glob.glob('*_raw.fits'):
            iraf.hedit(images=raw + '[0]', fields='PHOTCORR', value='OMIT',
                       add=self.no, addonly=self.no, delete=self.no,
                       verify=self.no, show=self.yes, update=self.yes)
开发者ID:eddienko,项目名称:SamPy,代码行数:11,代码来源:reduceACSpol.py


示例9: main

def main():
    print('FLAG 1================')
    checkfilepath = os.path.split(os.path.abspath(__file__))[0] + os.sep + 'objcheck.lst'
    dct = filedict(checkfilepath)
    fitlst = findmarkfit(os.getcwd())
    for fitname in fitlst:
        print(fitname)
    for fitname in fitlst:
        fit = pyfits.open(fitname)
        oldsname = fit[0].header['sname']
        newsname = dct[str(oldsname)]
        iraf.hedit(images = fitname, fields = 'sname',
                value = newsname, add = 'yes', delete = 'no',
                verify = 'no', show = 'yes', update = 'yes')
开发者ID:zzxihep,项目名称:spec2015_1,代码行数:14,代码来源:flushsname.py


示例10: prepare_files

def prepare_files(list_files, resultpath, readoutnoise):
    # copies data to output directory, trim data files and mask files to contain only good exposure parts, normalize masks, normalize images by masks. Yields exposure-normalized, trimmed sky images.
    for datafile in list_files[:]:
	    #prepare directories and copy image to resultpath
	    filename=os.path.basename(datafile)
	    obsid=os.path.basename(os.path.dirname(datafile))
	    imagepath=os.path.join(resultpath,obsid)
	    image=os.path.join(imagepath,filename)
	    if not os.access(imagepath,os.F_OK): os.makedirs(imagepath)
	    print image
	    shutil.copy(datafile,imagepath)
	    os.chdir(imagepath)
	    iraf.cd(imagepath)
	    # add readoutnoise keyword to header:
	    iraf.hedit(images=filename, fields="RDNOISE", value=str(readoutnoise), addonly="yes", verify="no")
开发者ID:YSOVAR,项目名称:PAIRITEL,代码行数:15,代码来源:photometry.py


示例11: wcs_transfer

def wcs_transfer(file1,file2,extensions="1,2,3,4"):

    if type(extensions) is str:
        extensions = [int(x) for x in extensions.split(',')]

    template = "%s[%i]" 

    for ext in extensions:
        for kw in WCS_keywords:
            #print file1,file2,ext,kw,
            iraf.images.imutil.imgets(template % (file1,ext),kw)
            var = iraf.images.imutil.imgets.value
            #print var
            if var != '0':
                iraf.hedit(template % (file2,ext), fields=kw, value=var,
                        add=True, verify=False, update=True, show=True)
开发者ID:keflavich,项目名称:irafscripts,代码行数:16,代码来源:wcs_transfer.py


示例12: checkRN

def checkRN(filename):
  imageHeader = fits.open(filename)[0]
  hasDateObsKey = True
  dateString = ""
  
  try:
    dateString = imageHeader.header['DATE-OBS']
  except KeyError:
    hasDateObsKey = False
      

  year = dateString[:4]
  
  if (hasDateObsKey and year=='2011'):
    iraf.hedit(filename,'RDNOISE',26,add='yes',verify='no')
    print(" ")
开发者ID:rfinn,项目名称:HalphaImaging,代码行数:16,代码来源:checkRN.py


示例13: applywavesolution

def applywavesolution(inputre, calspec):
    ''' apply calibration solution to science spectra '''

    inputlist = glob.glob(inputre)
    inputstring = ', '.join(inputlist)
    outputstring = ', '.join([inp[:-5]+'_spec.fits' for inp in inputlist])

    iraf.hedit.unlearn()
    iraf.dispcor.unlearn()

    iraf.hedit.fields = 'REFSPEC1'
    iraf.hedit.value = calspec
    iraf.hedit.add = True
    iraf.hedit(images=inputstring)

    iraf.dispcor(input=inputstring, output=outputstring)
开发者ID:evandromr,项目名称:scripts_pyraf,代码行数:16,代码来源:lnacoudetasks.py


示例14: edit_header

def edit_header (input1,input2):
    abrir1 = open(input1,'r')
    abrir2 = open(input2,'r')
    for line in abrir1:
        linea = abrir2.readline().split('\n')[0]
        line = line.split('\n')[0]
        iraf.hedit.images = line
        iraf.hedit.fields = 'REFSPEC1'
        iraf.hedit.add  = 'yes'
        iraf.hedit.value = linea
        iraf.hedit.show = 'yes'
        iraf.hedit.ver = 'no'
        iraf.hedit(mode='h')

    abrir1.close()
    abrir2.close()
开发者ID:dafh,项目名称:stuff,代码行数:16,代码来源:SCRIPT.py


示例15: continuumReduce

def continuumReduce(imageName,imageHaName):

  avgScaleFactor = contsubfactor

  print("The scale factor is "+str(avgScaleFactor))
  
  #configure hedit
  iraf.hedit.add='yes'
  iraf.hedit.verify='no'
  
  iraf.imarith(imageName+'.fits',"*",avgScaleFactor,imageName+"_scaled.fits")
  iraf.imarith(imageHaName+'.fits',"-",imageName+"_scaled.fits",imageHaName+"cs.fits")
  iraf.hedit(imageHaName+'cs.fits','Rscale',avgScaleFactor) 
  
  #clear up superfluous images
  for f in (imageName+'_scaled.fits'):
    silentDelete(f)

  print('The continuum subtracted image is '+ imageHaName+'cs.fits')
开发者ID:rfinn,项目名称:HalphaImaging,代码行数:19,代码来源:contSubOnly.py


示例16: AvThAr

def AvThAr(ThAr1,ThAr2,operator,ThArAv1,ThArAv):
	
	# check that the ARCSs are really the right ones before combining
	if pf.open(ThAr1+".fits")[0].header['OBJECT'] != pf.open(ThAr2+".fits")[0].header['OBJECT']:
		return 1
	
	# Do imarith while keeping FITS extensions
	# first make a sum of the two images -> ThArAv1
	# then divide ThArAv1 / 2 to get the average
	iraf.mscred.mscarith(ThAr1,operator,ThAr2,ThArAv1,verbose='yes')
	iraf.mscred.mscarith(ThArAv1,"/",2,ThArAv,verbose='yes')
	
	iraf.hedit(images=ThAr1+"A.fits[0]",fields='THARCOMB',value='xxx',add='yes',verify='no',show='yes')
	iraf.hedit(images=ThAr1+"A.fits[0]",fields='THARCOMB',value='Combined ThAr from (%s+%s)/2' % (ThAr1,ThAr2),add='yes',verify='no',show='yes')
	
	os.system('mv %s.fits uncombinedarcs/' % ThAr1)
	os.system('mv %s.fits uncombinedarcs/' % ThAr2)
	os.system('rm -rf %s.fits' % ThArAv1)
	
	return 0
开发者ID:jmccormac01,项目名称:FIESTool,代码行数:20,代码来源:FIEStoolPrep.py


示例17: cor_airmass

def cor_airmass(lstfile):
    f = open(lstfile)
    l = f.readlines()
    f.close()
    l = [tmp.split('\n')[0] for tmp in l]
    fitlst = ['awftbo' + tmp for tmp in l]
    for fitname in fitlst:
        if os.path.isfile(fitname):
            fit = pyfits.open(fitname)
            objname = fit[0].header['object'].replace('_', ' ').split()[0]
            print(fitname + ' ' + objname)
            objname_new = find_normal_objname(objname)
            if len(objname_new) == 0:
                objname_new = raw_input('please input object name:')
            radec = findradec(objname_new)
            if len(radec) == 0:
                radec = raw_input('please input ra dec of objname:')
                radec = radec.split()
            fitextnum = len(fit)
            fit.close()
            for lay in range(fitextnum):
                airold = iraf.hselect(images = fitname + '[%i]' % lay, fields = 'airmass', expr = 'yes', Stdout = 1)
                airold = float(airold[0])
                print(fitname + ' ' + objname + ' ' + str(lay) + ' airmass old: ' + str(airold))
                fitnamelay = fitname + '[%i]' % lay
                iraf.hedit(images = fitnamelay, fields = 'airold', 
                    value = airold, add = 'yes', addonly = 'yes', delete = 'no', 
                    verify = 'no', show = 'yes', update = 'yes')
                iraf.hedit(images = fitnamelay, fields = 'sname', 
                    value = objname_new, add = 'yes', addonly = 'yes', delete = 'no', 
                    verify = 'no', show = 'yes', update = 'yes')
                iraf.hedit(images = fitnamelay, fields = 'RA', 
                    value = radec[0], add = 'yes', addonly = 'yes', delete = 'no', 
                    verify = 'no', show = 'yes', update = 'yes')
                iraf.hedit(images = fitnamelay, fields = 'DEC', 
                    value = radec[1], add = 'yes', addonly = 'yes', delete = 'no', 
                    verify = 'no', show = 'yes', update = 'yes')
                iraf.twodspec()
                stdpath = os.path.split(os.path.realpath(__file__))[0] + os.sep + 'standarddir' + os.sep
                iraf.longslit(dispaxis = 2, nsum = 1, observatory = 'Lijiang', 
                    extinction = 'onedstds$LJextinct.dat', caldir = stdpath)
                iraf.setairmass(images = fitnamelay,
                    observatory = 'Lijiang', intype = 'beginning', 
                    outtype = 'effective', ra = 'ra', dec = 'dec', 
                    equinox = 'epoch', st = 'lst', ut = 'date-obs', 
                    date = 'date-obs', exposure = 'exptime', airmass = 'airmass', 
                    utmiddle = 'utmiddle', scale = 750.0, show = 'yes', 
                    override = 'yes', update = 'yes')
                print('name airmass_new airmass_old')
                iraf.hselect(fitnamelay, fields = '$I,airmass,airold', 
                             expr = 'yes')
开发者ID:zzxihep,项目名称:spec2015_1,代码行数:51,代码来源:re_corflux.py


示例18: manual_offset

def manual_offset(config, sci, total_sci_ext):

	#any other files not specifically mentioned were within 1 angstrom of 5577 so I didn't give them any changes
	if frame in ('N20011220S155.fits', 'N20011220S158.fits', 'N20011220S159.fits'):
		big_offset = -1.5

	elif frame in ('N20020114S113.fits', 'N20020114S116.fits','N20020114S117.fits'):
		big_offset = -11

	elif frame in ('N20020108S097.fits', 'N20020108S098.fits', 'N20020108S100.fits', 'N20020108S101.fits'):
		big_offset = -7.5

	else:
		big_offset = 0.0


	for i in range(2,total_sci_ext+1):
  		slit_header = pyfits.getheader(sky, i)
   		crval1 = slit_header['CRVAL1']
    		iraf.hedit('%s[%d]' % (sky,i), 'CRVAL1', crval1 + big_offset, update='yes', verify='no')
      		iraf.hedit('%s[%d]' % (sci,i), 'CRVAL1', crval1 + big_offset, update='yes', verify='no')
开发者ID:bmarshallk,项目名称:gmos_scripts,代码行数:21,代码来源:wavelength_correction.py


示例19: header_correction

def header_correction(config, fits, sky, sky_nofits, fits_number, offset_value):

	#getting the MDF information; neccessary for length of second for-loop
	mdf_sky = pyfits.getdata(sky, 'MDF')
	mdf_sci = pyfits.getdata(sci, 'MDF')

	
	#get CRVAL1 from header and add the offset for all extensions in the sky and science frames
	#The range will start where the MEF sci extensions start, 3, and ends 1 before bc the way python loops work
	for i in range(3,len(mdf_sci)-1): #fix this to the offset value - don't hardcode it
		
		#this is loading the mdf for the specific file and then extracting the specific CRVAL1 for each slit
		sky_header = pyfits.getheader(sky, i)
		sci_header = pyfits.getheader(sci, i)
		crval1_sky= sky_header['CRVAL1']
		crval1_sci = sci_header['CRVAL1']
		print '%s %s slit %d' % (config, fits, i)
		print 'Sky CRVAL1: ', crval1_sky
		print 'Science CRVAL1: ', crval1_sci

		#the new CRVAL1 value will be equal to the offset_value (dlambda) plus the original CRVAL1
		iraf.hedit('%s[%d]' % (sky,i), 'CRVAL1', (crval1_sky+offset_value), update='yes', ver='no')
		iraf.hedit('%s[%d]' % (sci,i), 'CRVAL1', (crval1_sci+offset_value), update='yes', ver='no')	
开发者ID:bmarshallk,项目名称:gmos_scripts,代码行数:23,代码来源:wavelength_correction.py


示例20: run_scldark

def run_scldark(input):
    iraf.image(_doprint=0)
    iraf.image.imutil(_doprint=0)
    scl=float(input[1])/float(input[2])
#    print input[1],scl
    iraf.imarith(input[0],"*",scl,input[3],divzero="0.0",hparams="",pixtype="",calctype="",verbose="no",noact="no")
    iraf.hedit(input[3],"EXPTIME",input[1], add="yes", addonly="yes", delete="no", verify="no", show="no", update="yes")
    iraf.hedit(input[3],"DARKTIME",input[1], add="yes", addonly="yes", delete="no", verify="no", show="no", update="yes")
    iraf.hedit(input[3],"EXPOSURE","", add="no", addonly="no", delete="yes", verify="no", show="no", update="yes")
开发者ID:majkelx,项目名称:calib-bialkow,代码行数:9,代码来源:pyraf_imarith_scl_dark.py



注:本文中的pyraf.iraf.hedit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python iraf.images函数代码示例发布时间:2022-05-27
下一篇:
Python iraf.digiphot函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap