/// <summary> /// exports common sequences for visualisation using Graphviz /// </summary> /// <param name="maximum_temoral_separation_sec"></param> /// <param name="filename"></param> /// <param name="invert"></param> /// <param name="show_durations"></param> public void ExportCommonSequencesAsDot( float maximum_temoral_separation_sec, string filename, bool invert, bool show_durations) { UsageGraph graph = GetCommonSequences(maximum_temoral_separation_sec); graph.ExportAsDot(filename, invert, show_durations); }
public static UsageGraph Load(string filename) { UsageGraph graph = new UsageGraph(); if (File.Exists(filename)) { FileStream fs = File.Open(filename, FileMode.Open); BinaryReader br = new BinaryReader(fs); // read event types int no_of_events = br.ReadInt32(); for (int i = 0; i < no_of_events; i++) { graph.EventID.Add(br.ReadInt32()); graph.EventDescription.Add(br.ReadString()); graph.EventSymbol.Add(br.ReadInt32()); } // load nodes int no_of_nodes = br.ReadInt32(); for (int i = 0; i < no_of_nodes; i++) { graph.Add(UsageNode.Load(br)); } br.Close(); fs.Close(); // link nodes together for (int i = 0; i < graph.Nodes.Count; i++) { UsageNode n = (UsageNode)graph.Nodes[i]; if (n.temp_link_IDs != null) { for (int j = 0; j < n.temp_link_IDs.Count; j++) { graph.LinkByID(n.temp_link_IDs[j], n.ID); UsageLink lnk = (UsageLink)(n.Links[n.Links.Count - 1]); lnk.Load(n.temp_duration[j]); } } } } return(graph); }
/// <summary> /// returns a graph containing events separated by a time less than the given interval /// </summary> /// <param name="maximum_temoral_separation_sec">maximum time between events</param> /// <returns>graph object</returns> public UsageGraph GetCommonSequences(float maximum_temoral_separation_sec) { double maximum_temoral_separation_mS = maximum_temoral_separation_sec * 1000; UsageGraph graph = new UsageGraph(); for (int i = 0; i < Nodes.Count; i++) { UsageNode n = (UsageNode)Nodes[i]; for (int j = 0; j < n.Links.Count; j++) { UsageLink lnk = (UsageLink)n.Links[j]; double duration_mS = lnk.GetAverageDuration(); if (duration_mS < maximum_temoral_separation_mS) { graph.Update(n.Name); graph.Update(lnk.From.Name); graph.Reset(); } } } return(graph); }
/// <summary> /// constructor /// </summary> /// <param name="broadcast_port">port number on which to broadcast stereo feature data to other applications</param> /// <param name="fps">ideal frames per second</param> public BaseVisionStereo( int broadcast_port, float fps) { this.fps = fps; broadcast_port_number = broadcast_port; calibration_survey = new CalibrationSurvey[2]; calibration_map = new int[2][]; calibration_map_inverse = new int[2][,,]; calibration_survey[0] = new CalibrationSurvey(); calibration_survey[1] = new CalibrationSurvey(); rectified = new Bitmap[2]; // delete and previously recorded images string[] victims = Directory.GetFiles(".", "raw*.jpg"); if (victims != null) { for (int v = 0; v < victims.Length; v++) File.Delete(victims[v]); } usage = new UsageGraph(); //usage.log_file = "debug.txt"; if (File.Exists(usage.log_file)) File.Delete(usage.log_file); }
/// <summary> /// returns a graph containing events separated by a time less than the given interval /// </summary> /// <param name="maximum_temoral_separation_sec">maximum time between events</param> /// <returns>graph object</returns> public UsageGraph GetCommonSequences(float maximum_temoral_separation_sec) { double maximum_temoral_separation_mS = maximum_temoral_separation_sec * 1000; UsageGraph graph = new UsageGraph(); for (int i = 0; i < Nodes.Count; i++) { UsageNode n = (UsageNode)Nodes[i]; for (int j = 0; j < n.Links.Count; j++) { UsageLink lnk = (UsageLink)n.Links[j]; double duration_mS = lnk.GetAverageDuration(); if (duration_mS < maximum_temoral_separation_mS) { graph.Update(n.Name); graph.Update(lnk.From.Name); graph.Reset(); } } } return (graph); }
public static UsageGraph Load(string filename) { UsageGraph graph = new UsageGraph(); if (File.Exists(filename)) { FileStream fs = File.Open(filename, FileMode.Open); BinaryReader br = new BinaryReader(fs); // read event types int no_of_events = br.ReadInt32(); for (int i = 0; i < no_of_events; i++) { graph.EventID.Add(br.ReadInt32()); graph.EventDescription.Add(br.ReadString()); graph.EventSymbol.Add(br.ReadInt32()); } // load nodes int no_of_nodes = br.ReadInt32(); for (int i = 0; i < no_of_nodes; i++) graph.Add(UsageNode.Load(br)); br.Close(); fs.Close(); // link nodes together for (int i = 0; i < graph.Nodes.Count; i++) { UsageNode n = (UsageNode)graph.Nodes[i]; if (n.temp_link_IDs != null) { for (int j = 0; j < n.temp_link_IDs.Count; j++) { graph.LinkByID(n.temp_link_IDs[j], n.ID); UsageLink lnk = (UsageLink)(n.Links[n.Links.Count - 1]); lnk.Load(n.temp_duration[j]); } } } } return (graph); }