public void testGetUpstreamPathLength() { XPDFComponentCylinder cap = new XPDFComponentCylinder(); cap.setDistances(0.15, 0.16); cap.setStreamality(true, true); final int xSize = 64, ySize = 64; Dataset pathLengthExp = new DoubleDataset(xSize, ySize); Dataset pathLength = new DoubleDataset(pathLengthExp); Dataset r = new DoubleDataset(pathLengthExp); Dataset xi = new DoubleDataset(pathLengthExp); // Read the data from file String fileDirectory = "/home/rkl37156/ceria_dean_data/"; Dataset[] datasets = {pathLengthExp, r, xi}; String[] files = {"incoming", "sample_r", "sample_xi"}; for (int k = 0; k < 3; k++) { Path filePath = new File(fileDirectory + files[k] + ".txt").toPath(); List<String> filelines = new ArrayList<String>(); try { filelines = Files.readAllLines(filePath); } catch (Exception e) { fail("Error reading " + filePath.toString()); } for (int i = 0; i < ySize; i++) { String[] splitline = filelines.get(i).split(" "); for (int j = 0; j < xSize; j++) { double assignee = Double.parseDouble(splitline[j]); datasets[k].set(assignee, i, j); } } } Dataset x = Maths.multiply(r, Maths.sin(xi)); Dataset z = Maths.multiply(r, Maths.cos(xi)); Dataset y = DoubleDataset.zeros(x); pathLength = cap.getUpstreamPathLength(x, y, z); double rmsError = Math.sqrt((Double) Maths.square(Maths.subtract(pathLength, pathLengthExp)).mean()); assertTrue("Error in upstream path length too large", rmsError < 1e-6); // fail("Not yet implemented"); }