# python/Obit script to relabel the headers in VLSS images to J2000 # Arguments: # 1) Name of Image to be updated # 2) name of text file to copy to history import sys, Obit, Image, History, OSystem, OErr # Init Obit err=OErr.OErr() ObitSys=OSystem.OSystem ("Copyright", 1, 100, 0, [], 1, ["."], 1, 0, err) OErr.printErrMsg(err, "Error with Obit startup") inFile = sys.argv[1] # Get file name to update textFile = sys.argv[2] # Get file name of new text inImage = Image.newPFImage("Input image", inFile, 0, True, err) OErr.printErr(err) # Out with the old inImage.Open(Image.READWRITE, err) inHistory = History.History("inhistory", inImage.List, err) inHistory.Open(History.READWRITE, err) #inHistory.Stalin (1,10000,err) inHistory.Zap (err) #inHistory.Close(err) inImage.Close(err) # in with the new inHistory = History.History("inhistory", inImage.List, err) OErr.printErr(err) inHistory.Open(History.READWRITE, err) inHistory.TimeStamp(" Start Obit "+ObitSys.pgmName,err) # Open text file fd = open(textFile,"r") recno = -1; line = fd.readline().replace('\n',' ') while line: #print line inHistory.WriteRec (recno, line, err) line = fd.readline().replace('\n',' ') inHistory.Close(err) fd.close() outHistory = History.History("inhistory", inImage.List, err) History. PCopy2Header (inHistory, outHistory, err)