Fix bug in plotting multiple rge files.

This commit is contained in:
2023-01-25 10:37:14 +01:00
parent 2f0d2fafa1
commit 6cc2ccf353
+13 -13
View File
@@ -1222,7 +1222,6 @@ function CreateInpFile() {
// Number of elements
let LElem = "L"+i+"Elem";
All[LElem] = Object.keys(LElComp).length;
console.log(LElem,All[LElem]);
// Densities of layers
let Lrho="layer"+i+"rho";
@@ -1405,22 +1404,22 @@ function startSequence() {
// Single run: Start
let eingabe1=CreateInpFile();
if (eingabe1=="ERROR") {return(0);}
let FILENAME=All["workPath"]+"/"+All["fileNamePrefix"]+"_"+ScanName+SValue;
writeAsciiFile(FILENAME+".inp",eingabe1);
let FILENAME=All["fileNamePrefix"]+"_"+ScanName+SValue;
writeAsciiFile(All["workPath"]+"/"+FILENAME+".inp",eingabe1);
if (!webOrApp) {
// Prepare command and execute
cmd = "cd " + All["workPath"];
cmd += ";cp " + FILENAME + ".inp eingabe1.inp";
cmd += ";" + trimBin;
cmd += "; mv -f ausgabe1.rge " + FILENAME + ".rge";
cmd += "; mv -f ausgabe1.out " + FILENAME + ".out";
cmd += "; mv -f ausgabe1.err " + FILENAME + ".err";
//cmd += ";cp " + FILENAME + ".inp eingabe1.inp";
cmd += ";" + trimBin + ' ' + FILENAME;
//cmd += "; mv -f ausgabe1.rge " + FILENAME + ".rge";
//cmd += "; mv -f ausgabe1.out " + FILENAME + ".out";
//cmd += "; mv -f ausgabe1.err " + FILENAME + ".err";
execute(cmd);
}
// Single run: End
// Read stopping profiels
let [cols,data]= readDatFile(FILENAME+".rge");
let [cols,data]= readDatFile(All["workPath"]+"/"+FILENAME+".rge");
// convert depth to nm and normalize stopping profile
let depth=data[0];
let nmuons=data[1];
@@ -1457,7 +1456,8 @@ function startSequence() {
// Remove redundant files and change the name fort.33
if (!webOrApp) {
cmd="cd " + All["workPath"] + ";rm -f eingabe1.inp; mv -f fort.33 " + seq_file;
// cmd="cd " + All["workPath"] + ";rm -f eingabe1.inp; mv -f fort.33 " + seq_file;
cmd="cd " + All["workPath"] + "; mv -f fort.33 " + seq_file;
execute(cmd);
}
Progress=100;
@@ -1504,16 +1504,16 @@ function plotProfiles(filenames) {
var plotDiv=win.document.getElementById("newPlot");
// Extract energies from run files if available
var files= new Object();
//var files= new Object();
var Es = [];
for (let i=0;i<filenames.length;i++) {
Es[i]=Number(filenames[i].substring(filenames[i].indexOf('_')+2,filenames[i].indexOf('.')));
files[Es[i]] = filenames[i];
//files[Es[i]] = filenames[i];
}
// loop on sorted values and plot
for (let i=0;i<Es.length;i++) {
let [cols,data]= readDatFile(files[Es[i]]);
let [cols,data]= readDatFile(filenames[i]);
// convert depth to nm and normalize profile
let depth=data[0];
let nmuons=data[1];