def main(args): usage = "Program usage: %s <file> <ap>" % args[0] data = srw.extractSingle(args[1]) info = data[args[2]] if info is not None: try: plt.plot(info, 'rx') except IndexError: print >> sys.stderr, usage exit(1) plt.title('Lightcurve for aperture %s' % args[2]) plt.xlabel('Frame') plt.ylabel('Counts') plt.show()
def main((options, args)): ap = int(args[0]) if options.lc: lc = srw.extractSingle(options.lc)[ap] if options.nonflat: nf = srw.extractSingle(options.nonflat)[ap] if options.nonflat and options.lc: diff = lc - nf ratio = lc / nf if options.coords: coords = srw.extractSingleCoords(options.coords)[ap] x = coords[0] y = coords[1] if options.error: er = srw.extractSingle(options.error)[ap] if options.sky: sk = srw.extractSingle(options.sky)[ap] if options.zd: zd = np.loadtxt(options.zd) # Plot the data fig = plt.figure() length = np.arange(len(lc)) # list of what to plot and what formatting and label # - data # - format # - label plots = [] # try: # plots.append([residuals, 'rx', r'$f_i - \bar{f}$']) # except UnboundLocalError: # pass try: plots.append([nf, "rx", "Non-flatted lightcurve"]) except UnboundLocalError: pass try: plots.append([diff, "bx", r"$f_{\mathrm{flat}} - f_{\mathrm{nonflat}}"]) except UnboundLocalError: pass try: plots.append([ratio, "bx", r"$f_{\mathrm{flat}} / f_{\mathrm{nonflat}}"]) except UnboundLocalError: pass try: plots.append([sk, "gx", "Sky counts"]) except UnboundLocalError: pass try: plots.append([x, "b.", "X coordinate (pix)"]) except UnboundLocalError: pass try: plots.append([y, "b.", "Y coordinate (pix)"]) except UnboundLocalError: pass try: plots.append([zd, "rx", "Zenith distance"]) except UnboundLocalError: pass no_plots = len(plots) + 2 ax = fig.add_subplot(no_plots, 1, 1) try: ax.errorbar(length, lc, er, fmt="rx") except UnboundLocalError: ax.plot(lc, "rx") ax.set_title("Information for aperture %d" % ap) ax.set_ylabel("Counts") ax = fig.add_subplot(no_plots, 1, 2) try: ax.errorbar(length, lc, er, fmt="rx") except UnboundLocalError: ax.plot(lc, "rx") axes = ax.axis() ax.axis([axes[0], axes[1], 0, axes[3]]) for val in range(3, len(plots) + 3): ax = fig.add_subplot(no_plots, 1, val) ax.plot(plots[val - 3][0], plots[val - 3][1]) ax.set_ylabel(plots[val - 3][2]) # ax = fig.add_subplot(812) # ax.plot(residuals, 'rx') # ax.set_ylabel(r'$f_i - \bar{f}$') # ax = fig.add_subplot(813) # ax.plot(nf, 'bx') # ax.set_ylabel('Non-flatted lightcurve') # ax = fig.add_subplot(814) # ax.plot(diff, 'rx') # ax.set_ylabel(r'$f_{\mathrm{flat}} - f_{\mathrm{nonflat}}') # ax = fig.add_subplot(815) # ax.plot(ratio, 'rx') # ax.set_ylabel(r'$f_{\mathrm{flat}} / f_{\mathrm{nonflat}}') # # ax = fig.add_subplot(816) # ax.plot(sk, 'bx') # ax.set_ylabel('Sky counts') # # ax = fig.add_subplot(817) # ax.plot(x, 'gx') # ax.set_ylabel('X coordinate (pix)') # # ax = fig.add_subplot(818) # ax.plot(y, 'gx') # ax.set_ylabel('Y coordinate (pix)') # ax.set_xlabel('Frame') plt.show()
def main((options, args)): ap = int(args[0]) if options.lc: lc = srw.extractSingle(options.lc)[ap] if options.nonflat: nf = srw.extractSingle(options.nonflat)[ap] if options.nonflat and options.lc: diff = lc - nf ratio = lc / nf if options.coords: coords = srw.extractSingleCoords(options.coords)[ap] x = coords[0] y = coords[1] if options.error: er = srw.extractSingle(options.error)[ap] if options.sky: sk = srw.extractSingle(options.sky)[ap] if options.zd: zd = np.loadtxt(options.zd) # Plot the data fig = plt.figure() length = np.arange(len(lc)) # list of what to plot and what formatting and label # - data # - format # - label plots = [] #try: # plots.append([residuals, 'rx', r'$f_i - \bar{f}$']) #except UnboundLocalError: # pass try: plots.append([nf, 'rx', 'Non-flatted lightcurve']) except UnboundLocalError: pass try: plots.append( [diff, 'bx', r'$f_{\mathrm{flat}} - f_{\mathrm{nonflat}}']) except UnboundLocalError: pass try: plots.append( [ratio, 'bx', r'$f_{\mathrm{flat}} / f_{\mathrm{nonflat}}']) except UnboundLocalError: pass try: plots.append([sk, 'gx', 'Sky counts']) except UnboundLocalError: pass try: plots.append([x, 'b.', 'X coordinate (pix)']) except UnboundLocalError: pass try: plots.append([y, 'b.', 'Y coordinate (pix)']) except UnboundLocalError: pass try: plots.append([zd, 'rx', 'Zenith distance']) except UnboundLocalError: pass no_plots = len(plots) + 2 ax = fig.add_subplot(no_plots, 1, 1) try: ax.errorbar(length, lc, er, fmt='rx') except UnboundLocalError: ax.plot(lc, 'rx') ax.set_title('Information for aperture %d' % ap) ax.set_ylabel('Counts') ax = fig.add_subplot(no_plots, 1, 2) try: ax.errorbar(length, lc, er, fmt='rx') except UnboundLocalError: ax.plot(lc, 'rx') axes = ax.axis() ax.axis([axes[0], axes[1], 0, axes[3]]) for val in range(3, len(plots) + 3): ax = fig.add_subplot(no_plots, 1, val) ax.plot(plots[val - 3][0], plots[val - 3][1]) ax.set_ylabel(plots[val - 3][2]) #ax = fig.add_subplot(812) #ax.plot(residuals, 'rx') #ax.set_ylabel(r'$f_i - \bar{f}$') #ax = fig.add_subplot(813) #ax.plot(nf, 'bx') #ax.set_ylabel('Non-flatted lightcurve') #ax = fig.add_subplot(814) #ax.plot(diff, 'rx') #ax.set_ylabel(r'$f_{\mathrm{flat}} - f_{\mathrm{nonflat}}') #ax = fig.add_subplot(815) #ax.plot(ratio, 'rx') #ax.set_ylabel(r'$f_{\mathrm{flat}} / f_{\mathrm{nonflat}}') # #ax = fig.add_subplot(816) #ax.plot(sk, 'bx') #ax.set_ylabel('Sky counts') # #ax = fig.add_subplot(817) #ax.plot(x, 'gx') #ax.set_ylabel('X coordinate (pix)') # #ax = fig.add_subplot(818) #ax.plot(y, 'gx') #ax.set_ylabel('Y coordinate (pix)') #ax.set_xlabel('Frame') plt.show()