-
Notifications
You must be signed in to change notification settings - Fork 0
/
mbias.sh
executable file
·53 lines (44 loc) · 1.83 KB
/
mbias.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# FILE: mbias.sh (an original should reside at $HOME/bash-scripts/pmas_data_red)
# AUTHOR: C. Herenz
# DATE: March 2012
# DESCR.: Creates a master bias from a given list of files + parameter file using
# p3d
# USAGE: mbias.sh <parameter_file>, where <paramter_file>
# sets variables mainpath=, night=, bias=, userparfile=, parfile=,
# inputfiles= and name=
# (for example parameter file see ./mbias.params)
# test if argument is provided is provided and file is existent
if [ -z "${1}" ] || [ ! -f ${1} ]; then
# .. if not, quit gracefully!
echo "Supply parameter file as argument!"
exit 0
fi
# source parameter file:
source ${1}
# =====================================================
# create directories for output files ...
mkdir -p ${mainpath}${night}${bias}/${name}
# ... and log files
mkdir -p ${mainpath}${night}${bias}/${name}/logs/
date=`date +%m-%d-%y`
timestamp=`date +%H%M`
logname=${name}_${date}--${timestamp}
logfile=${mainpath}${night}${bias}/${name}/logs/${logname}.log
# remember where we are coming from...
cwd=`pwd`
# ..going to where nice stuff is going to happen (well.. a master bias is created)
cd ${mainpath}${night}${bias}
# Actual creation of master-bias:
# ${rt} and ${s} variables could be set in the envrionment to '-rt' and '-s', respectively.
# see p3d readme for the meaning of those parameters
${p3d_path}/vm/p3d_cmbias_vm.sh ${rt} ${s} ${inputfiles} ${parfile} userparfile=${userparfile} \
opath=${mainpath}${night}${bias}/${name} detector=0 \
logfile=$logfile loglevel=2 /quiet opfx=$logname
# ... write info about this script to the beginnig of logfile ...
echo "0a
FROM mbias.sh with parameter file ${1}, DATE: ${date}, TIME: ${timestamp:0:2}:${timestamp:2:3}
.
w" | ed ${logfile} 2> /dev/null
# ... and finally go back to where we came from
cd $cwd