From 6abae7d25066aeaca943ce1c970278eb72d64fc9 Mon Sep 17 00:00:00 2001 From: "Mike Alexandersen (on Vancouver)" Date: Thu, 5 Oct 2017 15:31:54 +0800 Subject: [PATCH] Use MAGZERO if available, and print MAGZERO at end. --- maphot/maphot.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/maphot/maphot.py b/maphot/maphot.py index c42ca58..694b564 100755 --- a/maphot/maphot.py +++ b/maphot/maphot.py @@ -236,7 +236,10 @@ def findTNO(xzero, yzero): data = han[0].data header = han[0].header EXPTIME = header['EXPTIME'] - MAGZERO = header['MAGZERO'] + try: + MAGZERO = header['MAGZERO'] + except: + MAGZERO = 26.0 try: MJD = header['MJD'] except: @@ -487,12 +490,15 @@ def findTNO(xzero, yzero): outfile.write("\nphot.bg={}".format(phot.bg)) print("\nFINAL RESULT!") -print("\n# x y magnitude dmagnitude") -print(xt, yt, phot.magnitude - lineAperCorr, phot.dmagnitude, "\n") +print("\n#{0:12} {1:13} {2:13} {3:13} {4:13}".format( + ' x ', ' y ', ' magnitude ', ' dmagnitude ', ' magzero ')) +print("{0:13.8f} {1:13.8f} {2:13.10f} {3:13.10f} {4:13.10f}\n".format( + xt, yt, phot.magnitude - lineAperCorr, phot.dmagnitude, MAGZERO)) outfile.write("\nFINAL RESULT!") -outfile.write("\n# x y magnitude dmagnitude") -outfile.write("\n{0:13.8f} {1:13.8f} {2:13.10f} {3:13.10f}\n".format( - xt, yt, phot.magnitude - lineAperCorr, phot.dmagnitude)) +outfile.write("\n#{0:12} {1:13} {2:13} {3:13} {4:13}\n".format( + ' x ', ' y ', ' magnitude ', ' dmagnitude ', ' magzero ')) +outfile.write("{0:13.8f} {1:13.8f} {2:13.10f} {3:13.10f} {4:13.10f}\n".format( + xt, yt, phot.magnitude - lineAperCorr, phot.dmagnitude, MAGZERO)) # You could stop here. # However, to confirm that things are working well,