Skip to content

Commit

Permalink
small edits
Browse files Browse the repository at this point in the history
  • Loading branch information
grasingerm committed Feb 1, 2021
1 parent 3947319 commit b642126
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions aggregate_mcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@ using DelimitedFiles;
using Quadmath;
using DecFP;

if length(ARGS) != 3
println("usage: julia aggregate.jl <outfile> <indir> <pattern>");
if length(ARGS) != 4
println("usage: julia aggregate.jl <outfile> <indir> <pattern> <dielectric|polar>");
exit(1);
end

outfile = open(ARGS[1], "w");
indir = ARGS[2];
pattern = Glob.GlobMatch(ARGS[3]);

writedlm(outfile, ["E0" "K1" "K2" "kT" "Fz" "Fx" "n" "b" "r1" "r2" "r3" "lambda1" "lambda2" "lambda3" "r1sq" "r2sq" "r3sq" "rsquared" "p1" "p2" "p3" "p1sq" "p2sq" "p3sq" "psquared" "U" "Usquared" "AR"], ',');
if ARGS[4] == "dielectric"
writedlm(outfile, ["E0" "K1" "K2" "kT" "Fz" "Fx" "n" "b" "r1" "r2" "r3" "lambda1" "lambda2" "lambda3" "r1sq" "r2sq" "r3sq" "rsquared" "p1" "p2" "p3" "p1sq" "p2sq" "p3sq" "psquared" "U" "Usquared" "AR"], ',');
elseif ARGS[4] == "polar"
writedlm(outfile, ["E0" "mu" "kT" "Fz" "Fx" "n" "b" "r1" "r2" "r3" "lambda1" "lambda2" "lambda3" "r1sq" "r2sq" "r3sq" "rsquared" "p1" "p2" "p3" "p1sq" "p2sq" "p3sq" "psquared" "U" "Usquared" "AR"], ',');
else
println("I don't understand the last argument");
exit(1);
end

for infile in readdir(pattern, indir)
writedlm(outfile,
hcat(
transpose(map(pair -> eval(Meta.parse(split(pair, "-")[2]))*1e-3,
split(split(infile, ".")[1], "_"))),
transpose(map(pair -> eval(Meta.parse(split(pair, "-"; limit=2)[2]))*1e-3,
split(split(basename(infile), ".")[1], "_"))),
map(line -> transpose(eval(Meta.parse(split(line, "=")[2]))),
readlines(infile))...
),
Expand Down
2 changes: 1 addition & 1 deletion mean_field.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using ArgParse;
using Plots;

s = ArgParseSettings();
@add_arg_table s begin
@add_arg_table! s begin
"--E0", "-z"
help = "magnitude of electric field"
arg_type = Float64
Expand Down

0 comments on commit b642126

Please sign in to comment.