def arc(inc, yaw, hubdist, wave, order, dpermm): """Return x and y positions of diffraction arc as a function of wavelength for a given order""" #Set up source ray PT.circularbeam(0., 1) #Transform to grating frame PT.transform(0, 0, 0, pi / 2 + inc, 0, 0) PT.transform(0, 0, 0, 0, 0, yaw) PT.flat() #Apply grating PT.reflect() PT.radgrat(hubdist, dpermm, order, wave) #Go to focus PT.transform(0, 0, 0, 0, 0, -yaw) PT.transform(0, hubdist, 0, 0, 0, 0) PT.transform(0, 0, 0, pi / 2, 0, 0) PT.flat() #Get ray positions return PT.x[0], PT.y[0]
import traces.PyTrace as PT import time tstart = time.time() PT.circularbeam(200., 512 * 512) print time.time() - tstart gpus = PT.transferToGPU() print time.time() - tstart PT.radgratC[512, 512](12.e3, 160. / 12.e3, 1, 1., *gpus[:6]) PT.radgratC[512, 512](12.e3, 160. / 12.e3, 1, 1., *gpus[:6]) PT.radgratC[512, 512](12.e3, 160. / 12.e3, 1, 1., *gpus[:6]) PT.radgratC[512, 512](12.e3, 160. / 12.e3, 1, 1., *gpus[:6]) PT.returnFromGPU(*gpus) print time.time() - tstart ##PT.circularbeam(200.,512*512) ##print time.time()-tstart ##PT.radgrat(12.e3,160./12.e3,1,1.) ##PT.radgrat(12.e3,160./12.e3,1,1.) ##PT.radgrat(12.e3,160./12.e3,1,1.) ##PT.radgrat(12.e3,160./12.e3,1,1.) ##print time.time()-tstart