# # # HEDIT Mosaic task: A. Zenteno, C. Smith procedure repairhdr (image,field,value) string image {prompt='Image to update header'} string field {prompt='field to be modified'} string value {prompt='Value of the field'} bool add {no,prompt='add rather than edit fields'} bool addonly {no,prompt='add only if field does not exist'} bool delete {no,prompt='delete rather than edit fields'} bool verify {yes,prompt='verify each edit operation'} bool show {yes,prompt='print record of each edit operation'} bool update {no,prompt='update image headers'} #string hdrpath {"home$zlocal/",prompt='Path to header files'} begin string im1, field1, value1, filt, hpath, plane, wcs, cmds int nextn, i real epoch1 bool verb im1 = image field1 = field value1 = value # hpath = hdrpath imgets (im1//"[0]","NEXTEND") nextn = int(imget.value) if (!deftask ("asthedit")) { if (!defpac("noao.astutil")) { noao } astutil } if (!deftask ("mkheader")) { if (!defpac("noao.artdata")) { noao } artdata } for (i=0; i<=nextn; i+=1) { # stick the RA and DEC in the header # this will overwrite any existing values plane = im1//"["//str(i)//"]" print ("Processing ", plane) #create a label hedit(plane,field1,value1,add=add,addonly=addonly,delete=delete,verify=verify,show=show,update=update) # hedit(plane,"RA",ra1,add=add,addonly=addonly,verify=no,show=verb,delete=delete,update=update) # hedit (plane,"DEC",dec1,add=yes,verify=no,show=verb,update=update) # hedit (plane,"RADECEQ",epoch1,add=yes,verify=no,show=verb,update=update) # hedit (plane,"FILTER",filt,add=yes,verify=no,show=verb,update=update) # cmds = hpath//"fixhdr1.cmds" # asthedit (plane,cmds,update=update,verbose=verb) # if (i>0) { # wcs = hpath//"wcs.amp"//i # mkheader (plane, wcs, append=yes) # cmds = hpath//"fixhdr1.crvals" # asthedit (plane,cmds,update=update,verbose=verb) # } } end