forked from phu91/characterize_clusters
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_cluster_count_V3.tcl
More file actions
58 lines (40 loc) · 1.5 KB
/
Copy path2_cluster_count_V3.tcl
File metadata and controls
58 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set file [read [open "v1_I_simple.dat" r]]
set output [open "v1_simple_I_count.dat" w]
proc sum {args} {
set result 0
foreach n $args {
set result [expr {$result + $n}]
}
return $result
}
set x {}
set y1 {}
set y2 {}
#set AVGCLUSTERSIZE 0.0
puts $output "#FRAME NUMBEROFCLUSTERS SUM AVGCLUSTERSIZE"
for {set frame 1} {$frame <= 500 } {set frame [expr $frame + 1 ]} {
set clusterdat {}
foreach {a b r d} $file {
if {$frame == $a} {
lappend clusterdat $b
#puts "a=$a b=$b"
}
}
#puts "[eval sum $clusterdat]"
#puts "NUMBEROFCLUSTERS [expr [llength $clusterdat]]"
#puts $output "clusterdat $clusterdat"
puts "FRAME $frame NUMBEROFCLUSTERS [expr [llength $clusterdat]] SUM [eval sum $clusterdat] AVGCLUSTERSIZE [expr {[eval sum $clusterdat] / [llength $clusterdat]}]"
puts $output "$frame [expr [llength $clusterdat]] [eval sum $clusterdat] [expr [eval sum $clusterdat] / [llength $clusterdat]]"
#lappend x [expr $frame * 0.95]
#lappend y1 [expr [llength $clusterdat]]
#lappend y2 [expr [eval sum $clusterdat] / [llength $clusterdat]]
#lappend y3 [eval sum $clusterdat]
unset clusterdat
}
#puts "black line is Number of Clusters over Time, blue line is Average Cluster Size over Time, NO red line is Sum of Cluster over Time"
#package require multiplot
#set plot2 [multiplot -x $x -y $y1 -xlabel Time(ns) -ylabel Number_of_Clusters -linecolor black -plot]
#$plot2 add $x $y2 -ylabel AverageClusterSize -linecolor blue -plot
#$plot2 add $x $y3 -ylabel SumClusterSize -fillcolor red -plot
#close $file
close $output