private static double[] readTimeSeries() throws SAXException, IOException { consoleLogger.info("Reading data ..."); double[] series = tp.readTS(TS2GrammarParameters.IN_FILE, 0); consoleLogger.info("read " + series.length + " points from " + TS2GrammarParameters.IN_FILE); return series; } }
/** * Read at least N elements from the one-column file. * * @param dataFileName the file name. * @param loadLimit the load limit. * @return the read data or empty array if nothing to load. * @throws SAXException if error occurs. * @throws IOException if error occurs. */ public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
/** * Read at least N elements from the one-column file. * * @param dataFileName the file name. * @param loadLimit the load limit. * @return the read data or empty array if nothing to load. * @throws SAXException if error occurs. * @throws IOException if error occurs. */ public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
/** * Reads timeseries from a file. Assumes that file has a single double value on every line. * Assigned timestamps are the line numbers. * * @param filename The file to read from. * @param columnIdx The column index. * @param sizeLimit The number of lines to read, 0 == all. * @return data. * @throws IOException if error occurs. * @throws SAXException if error occurs. */ public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
/** * Reads timeseries from a file. Assumes that file has a single double value on every line. * Assigned timestamps are the line numbers. * * @param filename The file to read from. * @param columnIdx The column index. * @param sizeLimit The number of lines to read, 0 == all. * @return data. * @throws IOException if error occurs. * @throws SAXException if error occurs. */ public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
double[] data = tsp.readTS(BitmapParameters.IN_FILE, 0); LOGGER.info("read {} points from {}", +data.length, BitmapParameters.IN_FILE);
double[] data = tsp.readTS(BitmapParameters.IN_FILE, 0); LOGGER.info("read {} points from {}", +data.length, BitmapParameters.IN_FILE);
double[] series = tp.readTS(GrammarVizAnomalyParameters.IN_FILE, 0); LOGGER.info("read " + series.length + " points from " + GrammarVizAnomalyParameters.IN_FILE);