Completely changed parts of the mlog2db, added new features, fixed some weaknesses - and probably added new ones.

This commit is contained in:
Bastian M. Wojek 2008-09-25 18:28:49 +00:00
parent f3e700b03f
commit 7cdaa0143e

View File

@ -5,29 +5,46 @@ if [ ! -e /usr/bin/awk ]; then
exit 1 exit 1
fi fi
if [ $# -lt 3 ] ; then if [ $# -lt 2 ] ; then
cat <<EOFHELP cat <<EOFHELP
"musrfit-mlog to db converter" "musrfit-mlog to db converter"
USAGE: mlog2db FIRSTRUN# LASTRUN# BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k] USAGE: mlog2db FIRSTRUN# LASTRUN# EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k]
OR OR
mlog2db \[LIST OF RUNS\] BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k] mlog2db \[SPACE SEPARATED LIST OF RUNS\] EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k]
OR
mlog2db RUNLISTFILE EXTENSION [noheader | nosummary | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k]
This small script converts subsequent musrfit output files (mlog) into one db file using bash/awk. This small script converts subsequent musrfit output files (mlog) into one db file using bash/awk.
Example 1: Example 1:
mlog2db 1423 1424 _ZF-LF-TF-supermeasurement mlog2db 1423 1425 _tf_h13
generates the db-file "out.db" (or whatever filename you specified with the -o option) from 1423_ZF-LF-TF-supermeasurement.mlog and 1424_ZF-LF-TF-supermeasurement.mlog . generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from 1423_tf_h13.mlog, 1424_tf_h13.mlog, and 1425_tf_h13.mlog .
Example 2: Example 2:
mlog2db [1423 1425] _ZF-LF-TF-supermeasurement mlog2db [1487 1435] _tf_h13
generates the db-file "out.db" (or whatever filename you specified with the -o option) from 1423_ZF-LF-TF-supermeasurement.mlog and 1425_ZF-LF-TF-supermeasurement.mlog . generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from 1487_tf_h13.mlog and 1435_tf_h13.mlog .
The output files in both examples above also include the db header. Example 3:
mlog2db runs.txt _tf_h13
generates the db-file "out.db" (or whatever filename you additionally specify with the -o option) from all runs listed in the ASCII-file
"runs.txt" in the working directory. In the file it's also possible to include external parameters which should be put in the resulting db-file.
The structure of the "runs.txt" is the following:
RUN VAR1 VAR2 VAR3 ...
2716 200 27.1 46.2 ...
2787 205 27.1 46.3 ...
2260 210 27.2 45.9 ...
...
The first line specifies the db-parameter names and labels and has to be present!
The output files in all examples above also include the db header.
In the case you are dealing with LEM-data AND have locally mounted the /mnt/data/nemu directory some available parameters like the In the case you are dealing with LEM-data AND have locally mounted the /mnt/data/nemu directory some available parameters like the
temperature or transport settings will be taken from the summary files and added to the db-file. temperature or transport settings will be taken from the summary files and added to the db-file.
You can suppress the reading of the summary files with the option "nosummary".
If you want to generate a file without the header information just run the script with the option "noheader". If you want to generate a file without the header information just run the script with the option "noheader".
@ -35,7 +52,7 @@ If you additionally want to fit some data using musrfit specify the option "fit-
In this case either a mlog-outputfile or a msr-inputfile have to be present for the specified template run. In this case either a mlog-outputfile or a msr-inputfile have to be present for the specified template run.
The subsequent inputfiles will be created. The subsequent inputfiles will be created.
Example 3: Example 4:
mlog2db 200 220 _tf_h13 -oABC.db fit-199 mlog2db 200 220 _tf_h13 -oABC.db fit-199
This will fit the runs 200 to 220 using musrfit. The file 199_tf_h13.mlog (or if that is not available: 199_tf_h13.msr) is used as This will fit the runs 200 to 220 using musrfit. The file 199_tf_h13.mlog (or if that is not available: 199_tf_h13.msr) is used as
@ -43,12 +60,19 @@ template for the first musrfit input file. The results of the fits will be writt
For keeping the MINUIT2 output files after calling musrfit, i.e. invoke musrfit with the option "--keep-mn2-output" just pass the option "-k" to mlog2db. If you pass this option to mlog2db but do not fit any data, the option will just be ignored. For keeping the MINUIT2 output files after calling musrfit, i.e. invoke musrfit with the option "--keep-mn2-output" just pass the option "-k" to mlog2db. If you pass this option to mlog2db but do not fit any data, the option will just be ignored.
If your .mlog files do not have an extension as specified above like "200.mlog" you have to call the script as in the following example.
Example 5:
mlog2db 200 220 "" -oABC.db fit-199
CAUTION: CAUTION:
The "indexing number" of the .mlog has to be at the begin of the filename. The "indexing number" of the .mlog has to be at the begin of the filename.
Furthermore the data files that were fitted have to have the name "XXX_RUN#[_YYY]", where XXX,YYY are strings without whitespaces ("/" is OK). Furthermore the data files that were fitted have to have the name "XXX_RUN#[_YYY]", where XXX,YYY are strings without whitespaces ("/" is OK).
If you want to use the fitting feature, musrfit has to be installed either on the PATH or in the working directory. If you want to use the fitting feature, musrfit has to be installed either on the PATH or in the working directory.
Those of you who do not like scripting without functions better do not look at the code. Still it is more or less straight forward.
EOFHELP EOFHELP
else else
@ -66,7 +90,7 @@ if [ "${1:0:1}" == "[" ]; then
RUNARRAY[0]=${RUNARRAY[0]#"["} RUNARRAY[0]=${RUNARRAY[0]#"["}
fi fi
tLen=${#RUNARRAY[@]} tLen=${#RUNARRAY[@]}
for (( i=0; i<${tLen}; i++ )); for (( i=0; i<${tLen}; i++ ))
do do
if [ "$1" == "[" ]; then if [ "$1" == "[" ]; then
RUNARRAY[$i]=${RUNARRAY[ (( i + 1 )) ]} RUNARRAY[$i]=${RUNARRAY[ (( i + 1 )) ]}
@ -74,89 +98,133 @@ if [ "${1:0:1}" == "[" ]; then
if [ "${RUNARRAY[$i]:(-1)}" == "]" ]; then if [ "${RUNARRAY[$i]:(-1)}" == "]" ]; then
if [ "${RUNARRAY[$i]}" == "]" ]; then if [ "${RUNARRAY[$i]}" == "]" ]; then
RUNARRAY[$i]="" RUNARRAY[$i]=""
LASTRUN=$(( i - 1 )) LASTRUN=$(( i - 1 )) # RUNARRAY-index of the last run
EMPTYENTRY=1
else else
RUNARRAY[$i]=${RUNARRAY[$i]%"]"} RUNARRAY[$i]=${RUNARRAY[$i]%"]"}
LASTRUN=$i LASTRUN=$i # RUNARRAY-index of the last run
EMPTYENTRY=0
fi fi
fi fi
# echo ${RUNARRAY[$i]}
done done
EXTENSION=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 1 )) ]} # search for the parameter including the "]"
OPT_PAR_ONE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 2 )) ]} for (( i=0; i<="$#"; i++ ))
OPT_PAR_TWO=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 3 )) ]} do
OPT_PAR_THREE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 4 )) ]} RIGHTBRACKET=$( eval echo \$$i )
OPT_PAR_FOUR=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 5 )) ]} if [ "${RIGHTBRACKET:(-1)}" == "]" ]; then
RIGHTBRACKET=$i
break
fi
done
else # start and end-runs are given EXTENSION=$( eval echo \$$((RIGHTBRACKET + 1)) )
OPT_PAR_ONE=$( eval echo \$$((RIGHTBRACKET + 2)) )
OPT_PAR_TWO=$( eval echo \$$((RIGHTBRACKET + 3)) )
OPT_PAR_THREE=$( eval echo \$$((RIGHTBRACKET + 4)) )
OPT_PAR_FOUR=$( eval echo \$$((RIGHTBRACKET + 5)) )
OPT_PAR_FIVE=$( eval echo \$$((RIGHTBRACKET + 6)) )
RUNLIST_USED=0
NUM_OF_IND_VAR=1 # 1 for the run number
else
ISDIGIT=$( echo $1 | awk '{ if (( $1 + 0 ) == $1 ) {print 1} else {print 0}}' ) # check if the first parameter is a number or not
if [ "$ISDIGIT" -eq 1 ]; then # start and end-runs are given
for (( j=0; j<=$2-$1; j++ )); for (( j=0; j<=$2-$1; j++ ));
do do
RUNARRAY[$j]=$(( $1 + $j )) RUNARRAY[$j]=$(( $1 + $j ))
# echo ${RUNARRAY[$j]}
done done
LASTRUN=$(( $2 - $1 )) LASTRUN=$(( $2 - $1 )) # RUNARRAY-index of the last run
EXTENSION=$3 EXTENSION=$3
OPT_PAR_ONE=$4 OPT_PAR_ONE=$4
OPT_PAR_TWO=$5 OPT_PAR_TWO=$5
OPT_PAR_THREE=$6 OPT_PAR_THREE=$6
OPT_PAR_FOUR=$7 OPT_PAR_FOUR=$7
OPT_PAR_FIVE=$8
RUNLIST_USED=0
NUM_OF_IND_VAR=1 # 1 for the run number
else # assume a runlist-file with "independent variables" is given
if [ ! -e $1 ]; then
echo
echo "The specified runlist file" $1 "is not present... Bye bye!"
echo
exit 1
fi
numberOfReadInLines=0
exec 3< $1 # open file for reading in the runlist-file the first time and get the runnumbers to be processed
while read -u 3 -a runList
do
if [ "$numberOfReadInLines" == "0" ]; then
NUM_OF_IND_VAR=${#runList[@]}
else
RUNARRAY[(( numberOfReadInLines - 1 ))]=${runList[0]}
fi
((numberOfReadInLines++))
done
exec 3<&- # close file
LASTRUN=$(( ${#RUNARRAY[@]} - 1 )) # RUNARRAY-index of the last run
EXTENSION=$2
OPT_PAR_ONE=$3
OPT_PAR_TWO=$4
OPT_PAR_THREE=$5
OPT_PAR_FOUR=$6
OPT_PAR_FIVE=$7
RUNLIST_USED=1
fi
fi fi
# Check if fitting should be done # Check if fitting should be done
if [ "${OPT_PAR_ONE:0:3}" == "fit" ]; then if [ "${OPT_PAR_ONE:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_ONE:4} TEMP=${OPT_PAR_ONE:4}
else if [ "${OPT_PAR_TWO:0:3}" == "fit" ]; then elif [ "${OPT_PAR_TWO:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_TWO:4} TEMP=${OPT_PAR_TWO:4}
else if [ "${OPT_PAR_THREE:0:3}" == "fit" ]; then elif [ "${OPT_PAR_THREE:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_THREE:4} TEMP=${OPT_PAR_THREE:4}
else if [ "${OPT_PAR_FOUR:0:3}" == "fit" ]; then elif [ "${OPT_PAR_FOUR:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_FOUR:4} TEMP=${OPT_PAR_FOUR:4}
fi elif [ "${OPT_PAR_FIVE:0:3}" == "fit" ]; then
fi TEMP=${OPT_PAR_FIVE:4}
fi
fi fi
if [ "$TEMP" != "" ]; then if [ "$TEMP" != "" ]; then # runs should be fitted using musrfit
# Check for musrfit on the PATH and if found continue with searching the fit-template # Check for musrfit on the PATH and if found continue with searching the fit-template
PATHTOMUSRFIT=$(echo `which musrfit`) PATHTOMUSRFIT=$(echo `which musrfit`)
if [ "$PATHTOMUSRFIT" == "" ]; then if [ "$PATHTOMUSRFIT" == "" ]; then
echo echo
echo No musrfit executable was found on the PATH or in the current directory! echo "No musrfit executable was found on the PATH or in the current directory!"
echo Please install musrfit first! echo "Please install musrfit first!"
echo echo
exit 1 exit 1
else else
if [ -e $TEMP$EXTENSION.mlog ]; then if [ -e $TEMP$EXTENSION.mlog ]; then
TEMPLATE=$TEMP$EXTENSION.mlog TEMPLATE=$TEMP$EXTENSION.mlog
else if [ -e $TEMP$3.msr ]; then elif [ -e $TEMP$3.msr ]; then
TEMPLATE=$TEMP$EXTENSION.msr TEMPLATE=$TEMP$EXTENSION.msr
fi fi
fi fi
fi fi
fi
for (( q=0; q<=${LASTRUN}; q++ )); for (( q=0; q<=LASTRUN; q++ )) # loop over all RUNARRAY entries - the actual data-processing
do do
COUNT=${RUNARRAY[$q]} COUNT=${RUNARRAY[$q]}
NEXTCOUNT=${RUNARRAY[ (( q + 1 )) ]} NEXTCOUNT=${RUNARRAY[ (( q + 1 )) ]}
NEXTINPUT=$NEXTCOUNT$EXTENSION.msr NEXTINPUT=$NEXTCOUNT$EXTENSION.msr
FIRSTINPUT=${RUNARRAY[0]}$EXTENSION.msr FIRSTINPUT=${RUNARRAY[0]}$EXTENSION.msr
#echo COUNT: $COUNT, NEXTCOUNT: $NEXTCOUNT, NEXTINPUT: $NEXTINPUT, FIRSTINPUT: $FIRSTINPUT if [ "$TEMP" != "" ]; then # if fitting should be done
if [ "$TEMP" != "" ]; then
if [ "$TEMPLATE" == "" ]; then if [ "$TEMPLATE" == "" ]; then
echo The specified musrfit template files $TEMP$3.mlog and $TEMP$3.msr do not exist! echo
echo "The specified musrfit template files "$TEMP$3".mlog and $TEMP$3.msr do not exist!"
echo
exit 1 exit 1
fi fi
# if it's the first run to be fitted, take the template and substitute the runnumber to match the first run
if [ "$COUNT" == "${RUNARRAY[0]}" ]; then if [ "$COUNT" == "${RUNARRAY[0]}" ]; then
awk -v count=$TEMP -v nextcount=${RUNARRAY[0]} -v nextinput=$FIRSTINPUT '{ awk -v count=$TEMP -v nextcount=${RUNARRAY[0]} -v nextinput=$FIRSTINPUT '{
if(NR==1) print nextcount > nextinput if(NR==1) print nextcount > nextinput
@ -169,13 +237,14 @@ if [ "$TEMP" != "" ]; then
}' $TEMPLATE }' $TEMPLATE
fi fi
if [ "${OPT_PAR_ONE}" == "-k" ] || [ "${OPT_PAR_TWO}" == "-k" ] || [ "${OPT_PAR_THREE}" == "-k" ] || [ "${OPT_PAR_FOUR}" == "-k" ]; then if [ "${OPT_PAR_ONE}" == "-k" ] || [ "${OPT_PAR_TWO}" == "-k" ] || [ "${OPT_PAR_THREE}" == "-k" ] || [ "${OPT_PAR_FOUR}" == "-k" ] \
|| [ "${OPT_PAR_FIVE}" == "-k" ]; then
MUSRFITPARAM="-k" MUSRFITPARAM="-k"
fi fi
musrfit $COUNT$EXTENSION.msr $MUSRFITPARAM musrfit $COUNT$EXTENSION.msr $MUSRFITPARAM # the fit
if [ "$COUNT" != "${RUNARRAY[$LASTRUN]}" ]; then if [ "$COUNT" != "${RUNARRAY[$LASTRUN]}" ]; then # create the next musrfit input file if not the last specified run was fitted already
awk -v count=$COUNT -v nextcount=$NEXTCOUNT -v nextinput=$NEXTINPUT '{ awk -v count=$COUNT -v nextcount=$NEXTCOUNT -v nextinput=$NEXTINPUT '{
if(NR==1) print nextcount > nextinput if(NR==1) print nextcount > nextinput
else if($1 == "RUN") { else if($1 == "RUN") {
@ -189,11 +258,18 @@ if [ "$TEMP" != "" ]; then
fi fi
if [ ! -e $COUNT$EXTENSION.mlog ]; then if [ ! -e $COUNT$EXTENSION.mlog ]; then
echo The specified musrfit output file $COUNT$EXTENSION.mlog does not exist! echo
echo "The specified musrfit output file "$COUNT$EXTENSION".mlog does not exist!"
echo
exit 1 exit 1
fi fi
# if the "nosummary"-option is not set and the summary files are present, get some information from there
if [ "${OPT_PAR_ONE}" != "nosummary" ] && [ "${OPT_PAR_TWO}" != "nosummary" ] && [ "${OPT_PAR_THREE}" != "nosummary" ] \
&& [ "${OPT_PAR_FOUR}" != "nosummary" ] && [ "${OPT_PAR_FIVE}" != "nosummary" ]; then
if [ -d $SUMMDIR ]; then if [ -d $SUMMDIR ]; then
# extract runnumber from mlog-file
RUNNUMBER=$( awk '{ RUNNUMBER=$( awk '{
if(NR==1) X=0 if(NR==1) X=0
if($1 ~ /^RUN/ && X==0) { if($1 ~ /^RUN/ && X==0) {
@ -204,6 +280,7 @@ RUNNUMBER=$( awk '{
} }
}' $COUNT$EXTENSION.mlog ) }' $COUNT$EXTENSION.mlog )
# extract runyear from mlog-file in case of LEM-data
RUNYEAR=$( awk '{ RUNYEAR=$( awk '{
if(NR==1) X=0 if(NR==1) X=0
if($1 ~ /^RUN/ && X==0) { if($1 ~ /^RUN/ && X==0) {
@ -214,33 +291,28 @@ RUNYEAR=$( awk '{
} }
}' $COUNT$EXTENSION.mlog ) }' $COUNT$EXTENSION.mlog )
if [ "$RUNYEAR" != "XX" ]; then if [ "$RUNYEAR" != "XX" ]; then # in case of LEM-data search the summary-file
SUMMFILE=$SUMMDIR/20$RUNYEAR/lem$RUNYEAR\_$RUNNUMBER.summ SUMMFILE=$SUMMDIR/20$RUNYEAR/lem$RUNYEAR\_$RUNNUMBER.summ
TITLE=$( awk '{ if(NR==4) print $0 }' $SUMMFILE ) TITLE=$( awk '{ if(NR==4) print $0 }' $SUMMFILE )
ENERGY=$( awk '{ if($0 ~ /implantation energy/) print $(NF-1)}' $SUMMFILE ) ENERGY=$( awk '{ if($0 ~ /implantation energy/) print $(NF-1)}' $SUMMFILE )
TEMPERATURE=$( awk '{ if($1 == "Sample_CF1") print $(NF-1)}' $SUMMFILE ) TEMPERATURE=$( awk '{ if($1 == "Sample_CF1") print $(NF-1)}' $SUMMFILE )
RALRAR=$( awk '{ if($5 == "RA-L") RAL=$7; if($1 == "RA-R") { RAR=$3; print RAL-RAR; nextfile } }' $SUMMFILE ) RALRAR=$( awk '{ if($5 == "RA-L") RAL=$7; if($1 == "RA-R") { RAR=$3; print RAL-RAR; nextfile } }' $SUMMFILE )
RATRAB=$( awk '{ if($5 == "RA-T") RAT=$7; if($1 == "RA-B") { RAB=$3; print RAT-RAB; nextfile } }' $SUMMFILE ) RATRAB=$( awk '{ if($5 == "RA-T") RAT=$7; if($1 == "RA-B") { RAB=$3; print RAT-RAB; nextfile } }' $SUMMFILE )
TRANSPORT=$( awk '{ if($1 == "Moderator") print $3}' $SUMMFILE ) TRANSPORT=$( awk '{ if($1 == "Moderator") print $3}' $SUMMFILE )
fi
fi
fi fi
fi # put together all data to db-format and write it to the file
awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_THREE -v optPARfour=$OPT_PAR_FOUR \
awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_THREE -v optPARfour=$OPT_PAR_FOUR '{ -v optPARfour=$OPT_PAR_FIVE -v runList=$RUNLIST_USED -v numIndVar=$NUM_OF_IND_VAR '{
outfile="out.db" outfile="out.db"
if(optPARone ~ /^-o/) outfile = substr(optPARone,3) if(optPARone ~ /^-o/) outfile = substr(optPARone,3)
if(optPARtwo ~ /^-o/) outfile = substr(optPARtwo,3) if(optPARtwo ~ /^-o/) outfile = substr(optPARtwo,3)
if(optPARthree ~ /^-o/) outfile = substr(optPARthree,3) if(optPARthree ~ /^-o/) outfile = substr(optPARthree,3)
if(optPARfour ~ /^-o/) outfile = substr(optPARfour,3) if(optPARfour ~ /^-o/) outfile = substr(optPARfour,3)
if(optPARfive ~ /^-o/) outfile = substr(optPARfive,3)
FS = " " FS = " "
OFS = " " OFS = " "
@ -256,7 +328,6 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
negErrArray[i] = (-1.0)*$4 negErrArray[i] = (-1.0)*$4
else else
negErrArray[i] = $4 negErrArray[i] = $4
if($5 ~ /none/) if($5 ~ /none/)
posErrArray[i] = $4 posErrArray[i] = $4
else else
@ -302,12 +373,19 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
posErrArray[i+2] = "" posErrArray[i+2] = ""
posErrArray[i+3] = "" posErrArray[i+3] = ""
# Read in the runlist-variable names
if(runList == 1){
getline line < "'"$1"'"
split(line, indVar, " ")
}
# Output to file in the case, the LEM summary file is accessible # Output to file in the case, the LEM summary file is accessible and the option "nosummary" is not set
if("'"$TEMPERATURE"'" != "") { if("'"$TEMPERATURE"'" != "") {
if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader"){ # Write the db-header
if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader" && optPARfive != "noheader"){
print "TITLE" >> outfile print "TITLE" >> outfile
print ">>>Put your title here<<<\n" >> outfile print ">>>Put your title here<<<\n" >> outfile
print "Abstract" >> outfile print "Abstract" >> outfile
@ -319,6 +397,10 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
print "RAL-RAR [kV]" >> outfile print "RAL-RAR [kV]" >> outfile
print "RAT-RAB [kV]" >> outfile print "RAT-RAB [kV]" >> outfile
if(runList == 1){
for(k=2;k<=numIndVar;k++){print indVar[k] >> outfile}
}
for(k=1;k<i+4;k++){ for(k=1;k<i+4;k++){
print parArray[k] >> outfile print parArray[k] >> outfile
} }
@ -329,13 +411,20 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
$4 = "E" $4 = "E"
$5 = "RALRAR" $5 = "RALRAR"
$6 = "RATRAB" $6 = "RATRAB"
for(k=1;k<i+4;k++){
$(k+6)=parArray[k] for(k=1;k<numIndVar;k++){
$(k+6)=indVar[k+1]
} }
for(k=1;k<i+4;k++){
$(k+6+numIndVar-1)=parArray[k]
}
print "\n" $0 >> outfile print "\n" $0 >> outfile
print "\\-e" >> outfile print "\\-e" >> outfile
} }
# Write the data-block
print "T = " "'"$TEMPERATURE"'" ",,,\\" >> outfile print "T = " "'"$TEMPERATURE"'" ",,,\\" >> outfile
print "Tr = " "'"$TRANSPORT"'" ",,,\\" >> outfile print "Tr = " "'"$TRANSPORT"'" ",,,\\" >> outfile
if ("'"$ENERGY"'" != "") print "E = " "'"$ENERGY"'" ",,,\\" >> outfile if ("'"$ENERGY"'" != "") print "E = " "'"$ENERGY"'" ",,,\\" >> outfile
@ -345,6 +434,16 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
if ("'"$RATRAB"'" != "") print "RATRAB = " "'"$RATRAB"'" ",,,\\" >> outfile if ("'"$RATRAB"'" != "") print "RATRAB = " "'"$RATRAB"'" ",,,\\" >> outfile
else print "RATRAB = -999,,,\\" >> outfile else print "RATRAB = -999,,,\\" >> outfile
if(runList == 1) { # process the "independent variables" from the file
while((getline line < "'"$1"'") > 0){
split(line, indVarValue, " ")
if (indVarValue[1] == "'"$COUNT"'"){
for(k=2;k<=numIndVar;k++){print indVar[k] " = " indVarValue[k] ",,,\\" >> outfile}
break
}
}
}
for(l=1;l<i+3;l++){ for(l=1;l<i+3;l++){
print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile
} }
@ -352,34 +451,49 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
print dataArray[i+3] ",,, " "'"$TITLE"'" >> outfile print dataArray[i+3] ",,, " "'"$TITLE"'" >> outfile
if("'"$COUNT"'" == "'"${RUNARRAY[$LASTRUN]}"'") print "\n" >> outfile if("'"$COUNT"'" == "'"${RUNARRAY[$LASTRUN]}"'") print "\n" >> outfile
} }
# If we do not have the information from the summary file # If we do not have the information from the summary file or "nosummary" is set
else { else {
if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader"){ if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader" && optPARfive != "noheader"){
print "TITLE" >> outfile print "TITLE" >> outfile
print ">>>Put your title here<<<\n" >> outfile print ">>>Put your title here<<<\n" >> outfile
print "Abstract" >> outfile print "Abstract" >> outfile
print ">>>Put your abstract here<<<\n" >> outfile print ">>>Put your abstract here<<<\n" >> outfile
print "LABELS" >> outfile print "LABELS" >> outfile
print "T [K]" >> outfile
if(runList == 1){
for(k=2;k<=numIndVar;k++){print indVar[k] >> outfile}
}
for(k=1;k<i+4;k++){ for(k=1;k<i+4;k++){
print parArray[k] >> outfile print parArray[k] >> outfile
} }
$1 = "Data" $1 = "Data"
$2 = "T"
for(k=1;k<i+4;k++){ for(k=1;k<numIndVar;k++){
$(k+2)=parArray[k] $(k+1)=indVar[k+1]
} }
for(k=1;k<i+4;k++){
$(k+1+numIndVar-1)=parArray[k]
}
print "\n" $0 >> outfile print "\n" $0 >> outfile
print "\\-e" >> outfile print "\\-e" >> outfile
} }
print "T = 000,,,\\" >> outfile if(runList == 1) {
while((getline line < "'"$1"'") > 0){
split(line, indVarValue, " ")
if (indVarValue[1] == "'"$COUNT"'"){
for(k=2;k<=numIndVar;k++){print indVar[k] " = " indVarValue[k] ",,,\\" >> outfile}
break
}
}
}
for(l=1;l<i+3;l++){ for(l=1;l<i+3;l++){
print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile print parArray[l] " = " dataArray[l] ", " posErrArray[l] ", " negErrArray[l] ",\\" >> outfile
@ -387,14 +501,9 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
print dataArray[i+3] ",,, " title >> outfile print dataArray[i+3] ",,, " title >> outfile
if("'"$COUNT"'" == "'"${RUNARRAY[LASTRUN]}"'") print "\n" >> outfile if("'"$COUNT"'" == "'"${RUNARRAY[$LASTRUN]}"'") print "\n" >> outfile
} }
} }
}' $COUNT$EXTENSION.mlog }' $COUNT$EXTENSION.mlog
done done
fi fi