# print(mesh.cellList[0].getVertices()) # print(len(mesh.cellList)) # import pyvtk # vtk = pyvtk.VtkData(mesh.getVTKRepresentation()) # vtk.tofile('mesh') x0 = 0 y0 = 0 z0 = 0 h = 1 r_bottom = 1.3 r_top = 1.5 n = 1E6 xs = np.random.uniform(low=x0 - r_top, high=x0 + r_top, size=n) ys = np.random.uniform(low=y0 - r_top, high=y0 + r_top, size=n) zs = np.random.uniform(low=z0, high=z0 + h, size=n) values = np.random.uniform(size=n) print('zip') points = zip(xs, ys, zs) print('zip done') startTime = datetime.now() f2 = convertPointDataToMesh(points, values, f, inplace=True) print('Time it took to find %.0e points:' % n) print(str(datetime.now() - startTime).split('.', 2)[0]) # print(f2.values) # print(f2.values) #############################################
def _tracerProcessEnded(self, lines): # Check if process ended correctly # TODO! raise APIError (temporarily commented out for testing) if "########## Tracing done ################" in lines: logger.info("Tracing successful!") else: for line in lines: logger.debug(line) print(lines) logger.info("Tracing was not successful!") raise APIError.APIError("Tracing was not successful!") # Read absorption data (points, absorb) = vtkS.readAbsorptionData(self._absorptionFilePath) # print(points) # print(absorb) # Get field key = (FieldID.FID_Thermal_absorption_volume, self._curTStep) print(self.fields) f = self.fields[key] # Convert point data to field mesh if self._convertPointData: if meshS.FASTisAvailable(): meshS.convertPointDataToMeshFAST( pointdataVTKfile=self._absorptionFilePath, field=f, inplace=True) else: meshS.convertPointDataToMesh(points, absorb, f, inplace=True) # Read line data (if needed): (TODO: not tested) # (pts, wv, offs) = vtkS.readLineData("ray_paths.vtp") # Read photometric data from overall detector df = ft.loadDetectorData('AllDetector_1_LED.bin') data = dt.convertToSphere(df) # Set data to properties # Spectrum key = (PropertyID.PID_LEDSpectrum, objID.OBJ_LED, self._curTStep) p = self.properties[key] p.value['wavelengths'] = data['wavelengths'] p.value['intensities'] = data['intensities'] # Color x key = (PropertyID.PID_LEDColor_x, objID.OBJ_LED, self._curTStep) p = self.properties[key] p.value = data['color_x'] # Color y key = (PropertyID.PID_LEDColor_y, objID.OBJ_LED, self._curTStep) p = self.properties[key] p.value = data['color_y'] # CCT key = (PropertyID.PID_LEDCCT, objID.OBJ_LED, self._curTStep) p = self.properties[key] p.value = data['CCT'] # RadPower key = (PropertyID.PID_LEDRadiantPower, objID.OBJ_LED, self._curTStep) p = self.properties[key] p.value = data['radPower']