Commit 9882976b authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

la revolution du readlink

parent 96b040dc
#!/bin/bash
#var=Alens
#N=50
#xmin=0.8
#xmax=1.5
#val array
#for ((i=0;i<N;i++)) ; do
#val[$i]=$(echo | awk -v xmin=$xmin -v xmax=$xmax -v N=$N -v i=$i 'BEGIN{step=(xmax-xmin)/(N-1)} {printf("%f",xmin+(i)*step)}')
#done
var=tau_reio
val=(0.105 0.110 .115)
#val=(0.025 0.035 0.045 0.055 0.065 0.075 0.085 0.095)
#val=(0.01 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.055 0.06 0.065 0.07 0.075 0.08 0.085 0.09 0.095 0.10 0.12)
#N=20
#xmin=0.02
#xmax=0.10
#for ((i=0;i<N;i++)) ; do
#val[$i]=$(echo | awk -v xmin=$xmin -v xmax=$xmax -v N=$N -v i=$i 'BEGIN{step=(xmax-xmin)/(N-1)} {printf("%f",xmin+(i)*step)}')
#done
file=$(readlink -e $1)
parbase=$(basename $file)
dirout=${parbase%".par"}_mprof_"${var}"
if [ -z "${CAMELROOT}" ] ; then
echo "CAMELROOT undefined"
exit
fi
if [ ! -f "$file" ] ; then
echo "mssing $file"
exit
fi
if [ -d "$dirout" ] ; then
echo "directory $dirout exists: still want to run? (o/n)"
read answer
if [ $answer != 'o' ] ; then
echo "exiting"
exit 1
fi
fi
mkdir $dirout
CAMELDIR=${GROUP_DIR}/camel
HERE=$PWD
##########LOOP################################
for i in $(seq 0 $((${#val[@]}-1))) ; do
zeval=${val[$i]}
echo $zeval
OUTDIR=$HERE/$dirout/"$var"_${zeval}
mkdir $OUTDIR
cd $OUTDIR
###################################################
cat > camelrun <<EOBATCH
#!/bin/bash
#$ -N $(basename $(dirname $PWD))_$(basename $PWD)
#$ -l os=sl6
#$ -R y
#$ -j y
#$ -o $PWD
#$ -e $PWD
cd \$TMPDIR
export OMP_NUM_THREADS=8
#for pico
export PYTHONPATH=${PICO_CODE}
# copies localeS
cp $CAMELROOT/$CMTCONFIG/Minimize .
cp $CAMELROOT/$CMTCONFIG/FitClassFromPico .
cp $CAMELROOT/batch/awk/genrand.awk .
cp $CAMELROOT/batch/awk/toPico.awk .
cp $CAMELROOT/batch/python/changepars.py .
#
#input file -> transforme en pico et enleve var
awk -f toPico.awk $file | grep -v "$var" > parfile_in
#compute var
echo "fix $var cosmo $zeval" >> parfile_in
echo "init par:"
cat parfile_in
#================================
#randomize si id ne 1
#================================
echo "***************************************************************"
if [ \${SGE_TASK_ID} -eq 1 ] ; then
cp parfile_in parfile
else
RANDOM=\${SGE_TASK_ID}
awk -v seed=\$RANDOM -f genrand.awk parfile_in > parfile
fi
cp parfile "$OUTDIR"/camelPico\${SGE_TASK_ID}.par
echo "***************************************************************"
#================================
# Camel run
#================================
#PICO RUN
./Minimize parfile bestfit_pico
echo "PICO BESTFIT="
cat bestfit_pico
cp -f bestfit_pico "$OUTDIR"/best_fitPico\${SGE_TASK_ID}
#MODIFY par BESTFIT
grep -v "$var" $file > parfile2
echo "fix $var cosmo $zeval" >> parfile2
python ./changepars.py parfile2 bestfit_pico > parfile3
echo "CLASS PAR(pico improved)"
cat parfile3
cp parfile3 "$OUTDIR"/camelClass\${SGE_TASK_ID}.par
#CLASS RUN
./FitClassFromPico parfile3 bestfit_class
cp -f bestfit_class "$OUTDIR"/best_fitClass\${SGE_TASK_ID}
EOBATCH
#####################################################################################################################################
qsub -P P_planck_prod -t 1-5 -pe openmpi_8 8 -q pa_long camelrun
qsub -P P_planck_prod -t 6-10 -pe multicores 8 -q mc_long camelrun
#####################################################################################################################################
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment