parser.add_argument("--version",action="version",version="%(prog)s 0.1") args = parser.parse_args() if args.fits == None: print "\nError! Must specify a FITS file! Bailing!\n" exit(-1) else: hdulist = fits.open(args.fits) print hdulist[0].header.tostring scidata = hdulist[0].data for i in range(len(scidata)): for j in range(len(scidata[0])): scidata[i][j] = int(tr.truncr(scidata[i][j],args.truncr)) print scidata fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(scidata, interpolation = "none", origin = "lower", cmap = 'gray') cb = fig.colorbar(im) cb.set_clim(tr.truncr(scidata.min(),args.truncr),tr.truncr(scidata.max(),args.truncr)) X = np.array(scidata) numrows, numcols = X.shape def format_coord(x, y): col = int(x+0.5) row = int(y+0.5) if col>=0 and col<numcols and row>=0 and row<numrows:
for filename in fits_list: filename = filename[:-1] if args.verbose: print '-----------------------------------------------------------' print filename hdulist = fits.open(filename) debug_cnt = 0 scidata = hdulist[0].data scidatatr = [[0 for x in range(len(scidata[0]))] for x in range(len(scidata))] usbdata = [[0 for x in range(len(scidata[0]))] for x in range(len(scidata))] cnt = 0 for i in range(len(scidata)): for j in range(len(scidata[0])): scidatatr[i][j] = int(tr.truncr(scidata[i][j],args.truncr)) usbdata[i][j] = ((i==0 and j==0)<<15) | (cnt << 12) | (0x0FFF & int(scidatatr[i][j])) if args.countdebug: # Mon Jan 25 14:20:03 EST 2016 # TBA_NOTE: This was added as a debug for Ted # TBA_DEBUG usbdata[i][j] = ((i==0 and j==0)<<15) | (cnt << 12) | (0x0FFF & debug_cnt) debug_cnt += 1 #END TBA_DEBUG usbdata[i][j] = int('{:016b}'.format(usbdata[i][j])[::-1], 2) cnt=(cnt+1)%8 if(args.verbose): print 'scidata[%d][%d] = %s, scidatatr[%d][%d] = %s, usbdata[%d][%d] = %s' % (i,j,hex(scidata[i][j]).zfill(2),i,j,hex(scidatatr[i][j]).zfill(2),i,j,hex(usbdata[i][j]).zfill(2)) if not args.dryrun: # # This version will send 512 bytes at a time