# Retrieve the initial state of the system for plotting purposes rays = rayTracer.systemState[:, :, :3] plotData = np.zeros(rays.shape + (numSteps+1, )) plotData[:, :, :, 0] = rays status = np.empty(camSensorShape + (numSteps+1, )) status[:, :, 0] = 1 # Simulate! t = tInit for step in range(numSteps): # Advance the step t += stepSize eprint(t) # Solve the system rayTracer.rayTrace(t) # Get the data and store it for future plot status[:, :, step + 1] = rayTracer.status plotData[:, :, :, step + 1] = rayTracer.systemState[:, :, :3] # Debug cosas.append(plotData) # Plot the scene plotScene(plotData, status, camera, blackHole) # Plot the image plotImage(plotData, status) # Debug
# Camera position camR = 30 camTheta = 1.511 camPhi = 0 # Camera lens properties camFocalLength = 1.5 camSensorShape = (1000, 1500) # (Rows, Columns) camSensorSize = (2, 3) # (Height, Width) # Create the black hole, the camera and the metric with the constants # above blackHole = BlackHole(spin, innerDiskRadius, outerDiskRadius) camera = Camera(camR, camTheta, camPhi, camFocalLength, camSensorShape, camSensorSize) kerr = KerrMetric(camera, blackHole) # Set camera's speed (it needs the kerr metric constants) camera.setSpeed(kerr, blackHole) # Create the raytracer! rayTracer = RayTracer(camera, kerr, blackHole) rayTracer.rayTrace(-170, kernelCalls=1) # Load the textures disk = mimg.imread('../../Res/Textures/adisk.png')[:, :, :3] sphere = mimg.imread('../../Res/Textures/milkyWay.png')[:, :, :3] # Create the image rayTracer.texturedImage(disk.astype(np.float64), sphere.astype(np.float64))
# Camera lens properties camFocalLength = 3 camSensorShape = (1000, 1000) # (Rows, Columns) camSensorSize = (2, 2) # (Height, Width) # Create the black hole, the camera and the metric with the constants # above blackHole = BlackHole(spin, innerDiskRadius, outerDiskRadius) camera = Camera(camR, camTheta, camPhi, camFocalLength, camSensorShape, camSensorSize) kerr = KerrMetric(camera, blackHole) # Set camera's speed (it needs the kerr metric constants) camera.setSpeed(kerr, blackHole) for _ in range(1): # Create the raytracer! rayTracer = RayTracer(camera, kerr, blackHole) # Draw the image rayTracer.rayTrace(-128, kernelCalls=1) print("Time: ", rayTracer.totalTime) rayTracer.synchronise() # # np.savetxt("data.csv", rayTracer.systemState[20, 20, :]) rayTracer.plotImage() # # Generate the 3D scene # rayTracer.generate3Dscene(-70, 500) # rayTracer.plotScene()