commit a98a715793c8f678e09e22c3db8ff06569f98d49
parent 49b465e6761e2f8c519744d7144fcd72401698fc
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Sat, 30 Jun 2018 16:38:36 +0000
Support a plotfile, that contains the points and their corresponding cluster
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/laundryclustery.d b/src/laundryclustery.d
@@ -153,6 +153,12 @@ import std.file;
int main(string[] args){
File f;
+ import std.getopt;
+ import std.format;
+ string plotfile;
+ auto helpWanted=getopt(args,
+ "plotfile|p", &plotfile,
+ );
if(args.length!=2){
stderr.writeln("Usage: ", args[0], " </path/to/log/file>");
return 1;
@@ -180,6 +186,13 @@ int main(string[] args){
res
.filter!(a=>a.points.length>0)
.each!(a=>writeln(a.points.length, "\t", a.mean, "\t", a.variance));
-
+
+ if(plotfile){
+ File cf=File(plotfile,"w+");
+ scope(exit) cf.close();
+ foreach(i,c;enumerate(res)){
+ c.points.each!(a=>cf.writeln(i,"\t ",a));
+ }
+ }
return 0;
}