curf += 1 average_psf = average_psf/total # force psf to be zero (on average) at the boundaries. if 1: edge = numpy.concatenate((average_psf[0,:], average_psf[-1,:], average_psf[:,0], average_psf[:,-1])) average_psf -= numpy.mean(edge) # save PSF (in image form). if 1: import sa_library.daxwriter as daxwriter daxwriter.singleFrameDax("psf.dax", 1000.0*average_psf+100) # save PSF (in numpy form). numpy.save(sys.argv[3],average_psf) # # The MIT License # # Copyright (c) 2012 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is
# save hres results. hr_xo = i * keep_size * scale hr_xf = hr_xo + keep_size * scale hr_yo = j * keep_size * scale hr_yf = hr_yo + keep_size * scale ht_hres[hr_xo:hr_xf, hr_yo:hr_yf] = ht_xvec.reshape( (scale * keep_size, scale * keep_size)) fista_hres[hr_xo:hr_xf, hr_yo:hr_yf] = fista_xvec.reshape( (scale * keep_size, scale * keep_size)) # Save results. ht.printProfilingData() fista.printProfilingData() daxwriter.singleFrameDax("low_hres.dax", low_res) daxwriter.singleFrameDax("ht_hres.dax", ht_hres) daxwriter.singleFrameDax("fista_hres.dax", fista_hres) # # The MIT License # # Copyright (c) 2013 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: #
x = start for i in range(s_size): y = start for j in range(s_size): np_spline[j, i] = xy_spline.f(y, x) y += 1.0 x += 1.0 print("Calculating spline coefficients.") spline = spline2D.Spline2D(np_spline) if 1: import sa_library.daxwriter as daxwriter daxwriter.singleFrameDax("spline.dax", 1000.0 * np_spline + 100) # 3D spline else: print("Generating 3D spline.") s_size = 2 * s_size np_spline = numpy.zeros((s_size, s_size, s_size)) xy_splines = [] print("Generating XY splines.") for i in range(np_psf.shape[0]): xy_splines.append(spline2D.Spline2D(np_psf[i, :, :])) print("Generating fitting spline.") x = start
peaks_used += 1 curf += 1 average_psf = average_psf / total # force psf to be zero (on average) at the boundaries. if 1: edge = numpy.concatenate((average_psf[0, :], average_psf[-1, :], average_psf[:, 0], average_psf[:, -1])) average_psf -= numpy.mean(edge) # save PSF (in image form). if 1: import sa_library.daxwriter as daxwriter daxwriter.singleFrameDax("psf.dax", 1000.0 * average_psf + 100) # save PSF (in numpy form). numpy.save(sys.argv[3], average_psf) # # The MIT License # # Copyright (c) 2012 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
sx = numpy.ones(np) * float(sigma) sy = numpy.ones(np) * float(sigma) objects = numpy.concatenate( (x[:, None], y[:, None], h[:, None], sx[:, None], sy[:, None]), axis=1) image = cDrawGaussians(image, objects, 1) return image if __name__ == "__main__": import sa_library.daxwriter as daxwriter x = 4.0 * numpy.arange(10) + 10 y = 4.0 * numpy.arange(10) + 5 image = drawGaussiansXY([100, 100], x, y, height=100.0) daxwriter.singleFrameDax("dg_test.dax", image) # # The MIT License # # Copyright (c) 2016 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software.
x = numpy.arange(0.0, 2.001, 0.125) y = numpy.array([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]) s = Spline2D(y) surf = numpy.zeros((x.size, x.size)) dx_surf = numpy.zeros((x.size, x.size)) dy_surf = numpy.zeros((x.size, x.size)) for i in range(x.size): for j in range(x.size): surf[i, j] = s.f(x[i], x[j]) dx_surf[i, j] = s.dxf(x[i], x[j]) dy_surf[i, j] = s.dyf(x[i], x[j]) print surf #print dx_surf #print dy_surf if 0: surf = 100.0 + 100.0 * surf dx_surf = 100.0 + 100.0 * dx_surf dy_surf = 100.0 + 100.0 * dy_surf daxwriter.singleFrameDax("surf.dax", surf) daxwriter.singleFrameDax("dx_surf.dax", dx_surf) daxwriter.singleFrameDax("dy_surf.dax", dy_surf) #pw = pyqtgraph.plot() #raw_input("return to continue")
import sa_library.arraytoimage as arraytoimage import sa_library.daxwriter as daxwriter if (len(sys.argv) != 3): print "usage: <in_hres> <out_img>" exit() hres = HResFile(sys.argv[1]) image = hres.sumFrames(verbose=True) ext = os.path.splitext(sys.argv[2])[1] if (ext == ".png"): arraytoimage.singleColorImage(image, sys.argv[2]) elif (ext == ".dax"): daxwriter.singleFrameDax(sys.argv[2], image) else: print "unrecognized extension ", ext # # The MIT License # # Copyright (c) 2012 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: #
# save hres results. hr_xo = i * keep_size * scale hr_xf = hr_xo + keep_size * scale hr_yo = j * keep_size * scale hr_yf = hr_yo + keep_size * scale ht_hres[hr_xo:hr_xf, hr_yo:hr_yf] = ht_xvec.reshape((scale * keep_size, scale * keep_size)) fista_hres[hr_xo:hr_xf, hr_yo:hr_yf] = fista_xvec.reshape((scale * keep_size, scale * keep_size)) # Save results. ht.printProfilingData() fista.printProfilingData() daxwriter.singleFrameDax("low_hres.dax", low_res) daxwriter.singleFrameDax("ht_hres.dax", ht_hres) daxwriter.singleFrameDax("fista_hres.dax", fista_hres) # # The MIT License # # Copyright (c) 2013 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
x = start for i in range(s_size): y = start for j in range(s_size): np_spline[j,i] = xy_spline.f(y,x) y += 1.0 x += 1.0 print "Calculating spline coefficients." spline = spline2D.Spline2D(np_spline) if 1: import sa_library.daxwriter as daxwriter daxwriter.singleFrameDax("spline.dax", 1000.0*np_spline + 100) # 3D spline else: print "Generating 3D spline." s_size = 2*s_size np_spline = numpy.zeros((s_size, s_size, s_size)) xy_splines = [] print "Generating XY splines." for i in range(np_psf.shape[0]): xy_splines.append(spline2D.Spline2D(np_psf[i,:,:])) print "Generating fitting spline."
y[:,None], h[:,None], sx[:,None], sy[:,None]), axis = 1) image = cDrawGaussians(image, objects, 1) return image if __name__ == "__main__": import sa_library.daxwriter as daxwriter x = 4.0*numpy.arange(10) + 10 y = 4.0*numpy.arange(10) + 5 image = drawGaussiansXY([100,100], x, y, height = 100.0) daxwriter.singleFrameDax("dg_test.dax", image) # # The MIT License # # Copyright (c) 2016 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in
[3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]) s = Spline2D(y) surf = numpy.zeros((x.size, x.size)) dx_surf = numpy.zeros((x.size, x.size)) dy_surf = numpy.zeros((x.size, x.size)) for i in range(x.size): for j in range(x.size): surf[i,j] = s.f(x[i],x[j]) dx_surf[i,j] = s.dxf(x[i],x[j]) dy_surf[i,j] = s.dyf(x[i],x[j]) print surf #print dx_surf #print dy_surf if 0: surf = 100.0 + 100.0 * surf dx_surf = 100.0 + 100.0 * dx_surf dy_surf = 100.0 + 100.0 * dy_surf daxwriter.singleFrameDax("surf.dax", surf) daxwriter.singleFrameDax("dx_surf.dax", dx_surf) daxwriter.singleFrameDax("dy_surf.dax", dy_surf) #pw = pyqtgraph.plot() #raw_input("return to continue")
import sa_library.arraytoimage as arraytoimage import sa_library.daxwriter as daxwriter if (len(sys.argv) != 3): print "usage: <in_hres> <out_img>" exit() hres = HResFile(sys.argv[1]) image = hres.sumFrames(verbose = True) ext = os.path.splitext(sys.argv[2])[1] if (ext == ".png"): arraytoimage.singleColorImage(image, sys.argv[2]) elif (ext == ".dax"): daxwriter.singleFrameDax(sys.argv[2], image) else: print "unrecognized extension ", ext # # The MIT License # # Copyright (c) 2012 Zhuang Lab, Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: #