source: src/param2R.sh @ 1

Last change on this file since 1 was 1, checked in by fairhead, 8 years ago

Initial import of HighTune project files

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