public void Initialise()
        {
            // Create a new KML Reader
              KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");

              // Read in all call logs
              EventCollection collection = reader.GetCallLogs();
              collection.ForEach(evt => evt.Device = DEVICE);

              // Cluster the call logs
              DBSCAN scan = new DBSCAN(collection);
              scan.Analyse();

              // Initialise the clusters
              Clusters = scan.Clusters;

              // Initialise the analysis
              Analysis = new ProductAnalysis(Clusters, DEVICE);
        }
 public void Initalise()
 {
     // Read in a Sample KML File
       KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");
       // Obtain all the events
       EventCollection collection = reader.GetCallLogs();
       // Cluster the Events
       DBSCAN scan = new DBSCAN(collection);
       scan.Analyse();
       // Get a copy of the Clustered Events
       Clusters = scan.Clusters;
       // Get a copy of the Noise Events
       Noise = scan.Noise;
       // Make a new TEMP dir
       Directory.CreateDirectory(OUTPUT_DIR);
 }
        public void Initialise()
        {
            // Create a new KML Reader
              KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");

              // Read in all call logs
              EventCollection collection = reader.GetCallLogs();

              // Cluster the call logs
              DBSCAN scan = new DBSCAN(collection);
              scan.Analyse();

              // Initialise the clusters
              Clusters = scan.Clusters;

              // Initialise the analysis
              Analysis = new WeekAnalysis(Clusters, WEEK);
        }
 /// <summary>
 /// This is a helper method, to reduce repeating code throughout this Test 
 /// class. The objective of this method is to parse a given KML file, and 
 /// return an EventCollection object.
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 private EventCollection ReadKMLFile(String file)
 {
     // Create a new KML reader object to read the data
       KMLReader reader = new KMLReader(file);
       // Return a collection of events from the KML file
       return reader.GetCallLogs();
 }
Пример #5
0
        /// <summary>
        /// This method will analyse a given kml file. The analysis will produce 
        /// an output KML file and a number of output JSON analysis files, 
        /// depending upon the runtime options supplied.
        /// </summary>
        /// <param name="file">The KML file to analyse</param>
        private static void AnalyseFile(String file)
        {
            // Ensure the file exists
              if (!File.Exists(file))
              {
            throw new FileNotFoundException("File does not exist", file);
              }

              // Read in all the known events from the input file
              KMLReader reader = new KMLReader(file);
              EventCollection collection = reader.GetCallLogs();

              // Perform the analysis
              PerformAnalysis(collection);
        }
Пример #6
0
        /// <summary>
        /// This method will analyse a given directory. It will firstly scan the 
        /// directoy for all kml files. The analysis will produce an output KML 
        /// file and a number of output JSON analysis files, depending upon the 
        /// runtime options supplied.
        /// </summary>
        private static void AnalyseDirectory()
        {
            String directory = InputArguments["source"];

              EventCollection collection = new EventCollection();

              // Only continue if the input directory exists
              if (!Directory.Exists(directory))
              {
            return;
              }

              // Get a list of all the KML file names within the directory
              String[] files = Directory.GetFiles(directory, "*.kml", SearchOption.TopDirectoryOnly);

              // Loop over each of the file and add to the data
              foreach (String file in files)
              {
            // Parse the KML file
            KMLReader reader = new KMLReader(file);
            // Add the data to the known events
            collection.AddRange(reader.GetCallLogs());
              }

              // Perform the analysis
              PerformAnalysis(collection);
        }
        public void Initialise()
        {
            // A dictionary of week-events
              Events = new Dictionary<int, EventCollection>();

              // Read in the Week 32 logs
              KMLReader w32_reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");
              Events[32] = w32_reader.GetCallLogs();

              // Read in the Week 33 logs
              KMLReader w33_reader = new KMLReader(ROOT_DIR + "data\\L_wk33_drops.kml");
              Events[33] = w33_reader.GetCallLogs();

              // Read in the Week 34 logs
              KMLReader w34_reader = new KMLReader(ROOT_DIR + "data\\L_wk34_drops.kml");
              Events[34] = w34_reader.GetCallLogs();

              // Read in the Week 35 logs
              KMLReader w35_reader = new KMLReader(ROOT_DIR + "data\\L_wk35_drops.kml");
              Events[35] = w35_reader.GetCallLogs();

              // Initialise the Multi-Week Analysis Object
              Analysis = new MultiWeekAnalysis();
              Analysis.AddRange(Events[32]);
              Analysis.AddRange(Events[33]);
              Analysis.AddRange(Events[34]);
              Analysis.AddRange(Events[35]);

              // Cluster the data
              Analysis.Cluster(EPS, MIN_POINTS);

              // Analyse all weeks
              Analysis.AnalyseWeeks();
        }
        public void Initialise()
        {
            // A dictionary of week-events
              Events = new EventCollection();

              // Read in the Week 32 logs
              KMLReader w32_reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");
              Events.AddRange(w32_reader.GetCallLogs());

              // Read in the Week 33 logs
              KMLReader w33_reader = new KMLReader(ROOT_DIR + "data\\L_wk33_drops.kml");
              Events.AddRange(w33_reader.GetCallLogs());

              // Read in the Week 34 logs
              KMLReader w34_reader = new KMLReader(ROOT_DIR + "data\\L_wk34_drops.kml");
              Events.AddRange(w34_reader.GetCallLogs());

              // Read in the Week 35 logs
              KMLReader w35_reader = new KMLReader(ROOT_DIR + "data\\L_wk35_drops.kml");
              Events.AddRange(w35_reader.GetCallLogs());

              // Initialise the Multi-Product Analysis Object
              Analysis = new MultiProductAnalysis();
              Analysis.AddRange(Events);

              // Cluster the data
              Analysis.Cluster(EPS, MIN_POINTS);

              // Analyse all weeks
              Analysis.AnalyseProducts();
        }
        public void Initialise()
        {
            // Create a new KML Reader
              KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");

              // Read in all call logs
              EventCollection collection = reader.GetCallLogs();

              // Cluster the call logs
              DBSCAN scan = new DBSCAN(collection);
              scan.Analyse();

              // Initialise the cluster
              Cluster = new EventCollection(scan.Clusters.OrderBy(col => col.Count).Last());

              // Initialise the Cluster analysis
              Analysis = new DropAnalysis(Cluster);
        }