source: src/param2R.sh @ 193

Last change on this file since 193 was 193, checked in by htune, 6 years ago

Introducing a env.sh file to allow activating particular environment.
Needed on the jean-zay supercomputer.
Fredho

File size: 2.0 KB
Line 
1#!/bin/bash
2
3. env.sh
4
5\rm -f ModelParam.R
6bad=0
7
8if [ $# != 3 ] ; then
9cat <<eod
10Usage : param2R.sh LHCIZE NLHC parameter_file
11eod
12exit
13fi
14
15LHCSIZE=$1
16NLHC=$2
17PARAM_FILE=$3
18
19if [ ! -f $PARAM_FILE ] ; then echo fichier $PARAM_FILE inexistant ; exit ; fi
20#if [ ! $NLHC -ge 3 ] ; then echo NLHC should be '>=' 3 ; exit ; fi
21
22(( NSCMS = LHCSIZE * NLHC ))
23NPARA=`wc -l $PARAM_FILE |awk ' {print $1 }'`
24
25# A automatiser en regardant combien de LES* sont disponibles
26# sur chaque cas.
27
28echo LHCSIZE=$LHCSIZE >> ModelParam.R
29echo NLHC=$NLHC >> ModelParam.R
30echo NSCMS=$NSCMS >> ModelParam.R
31echo NPARA=$NPARA >> ModelParam.R
32
33names=( names lows highs defaults )
34
35for col in  1 2 3 4 ; do
36    (( ii = $col -1 ))
37    liste='param.'${names[$ii]}='c('
38    for val in `awk ' {print $'$col' } ' $PARAM_FILE` ; do
39       if [ $col == 1 ] ; then       
40         liste=$liste'"'$val'",'
41       else
42         liste="$liste$val,"
43       fi
44    done
45   echo $liste | sed -e 's/,$/)/' >> ModelParam.R
46done
47
48
49liste="which.logs<-c("
50ival=0
51ilog=0
52for val in `awk ' { print $5 } ' $PARAM_FILE` ; do
53   (( ival = $ival + 1 ))
54   if [ "$val" = "log" ] ; then
55         liste="$liste$ival,"
56         ilog=1
57   fi
58done
59if [ $ilog == 0 ]; then 
60        echo $liste | sed -e 's/($/()/' >> ModelParam.R
61else
62        echo $liste | sed -e 's/,$/)/' >> ModelParam.R
63fi
64
65cat <<eod>> ModelParam.R
66  param.defaults <- param.defaults[1:NPARA]
67  param.highs <- param.highs[1:NPARA]
68  param.lows <- param.lows[1:NPARA]
69  param.names <- param.names[1:NPARA]
70eod
71
72cat ModelParam.R
73
74echo '=================================================================='
75echo "Generating $NSCMS samples"
76echo '=================================================================='
77Rscript htune_convertDesign.R
78
79#ls -lrt
80
81# On copie les infos de la wave 1 dans le repertoire WAVE1 (1ere vague de l'history matching)
82
83mkdir WAVE1
84# cf plus haut
85mv ModelParam.R WAVE1/
86# Fichier ASCII simulation id - valeur des parametres
87mv Par1D_Wave1.asc WAVE1/
88# Fichier R contenant les mêmes informations
89mv Wave1.RData WAVE1/
90
Note: See TracBrowser for help on using the repository browser.