source: trunk/DataCheck/Tools/check_torque_warning.sh@ 19272

Last change on this file since 19272 was 19040, checked in by Daniela Dorner, 6 years ago
scripts to check for drive problem
  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/bash
2
3
4path=/fact/aux/2017
5files=`grep Torque $path/*/*/*.log | cut -d: -f1 | sort | uniq`
6
7deltat="30./3600."
8echo "Using "$deltat" hours."
9
10for file in $files
11do
12 dir=`dirname $file`
13 date=`basename $file | cut -d. -f1`
14 echo "Night: "$date
15 y=`dirname $file | cut -d/ -f4`
16 m=`dirname $file | cut -d/ -f5`
17 d=`dirname $file | cut -d/ -f6`
18 drivefile=$dir/$date.DRIVE_CONTROL_POINTING_POSITION.fits
19 #echo $drivefile
20
21 warning=`grep Torque $file | sed -e 's/\ //g' | grep -o -E "[012][0-9]:[0-5][0-9]:[0-5][0-9].[0-9]{3}000-DRIVE_CONTROL:IndraDrive[AZ][dz]" `
22 #echo $warning
23 for warning in $warning
24 do
25 timestamp=`echo $warning | grep -o -E [012][0-9]:[0-5][0-9]:[0-5][0-9].[0-9]{3}`
26 indradrive=`echo $warning | grep -o -E [AZ][dz]`
27 datetime=`date -d "$date $timestamp" +"%s"`
28 #echo $datetime
29 h=`echo $timestamp | cut -c 1-2`
30 #echo $h
31 if [ $h -lt 12 ]
32 then
33 start=`echo " $datetime / 86400 + 1 - ($deltat/24.) " | bc -l`
34 stop=`echo " $datetime / 86400 + 1 + ($deltat/24.) " | bc -l`
35 else
36 start=`echo " ( $datetime ) / 86400 - ($deltat/24.) " | bc -l`
37 stop=`echo " ( $datetime ) / 86400 + ($deltat/24.) " | bc -l`
38 fi
39 #echo $start" "$stop
40 stats=`/home/fact/FACT++/fitsdump -s -c Time -c Az -c Zd --filter="[1] > $start && [1] < $stop " $drivefile 2>/dev/null`
41 #echo $stats
42# trackingstats=`$factpath/fitsdump $trackingfile -s -c Time -c Ra -c Dec -c Zd -c Az --filter='[1]<'${tstop}' && [1]>'${tstart} 2>/dev/null`
43 zd=`echo $stats | grep -E -o '\['Zd':0[:]?[0-9]*\]\ Min:\ [-]?[0-9]+[.]?[0-9]*\ Max:\ [-]?[0-9]+[.]?[0-9]*\ Med:\ [-]?[0-9]+[.]?[0-9]*\ Avg:\ [-]?[0-9]+[.]?[0-9]*\ Rms:\ [-]?[0-9]+[.]?[0-9]*[e]?[-]?[0-9]*'`
44 az=`echo $stats | grep -E -o '\['Az':0[:]?[0-9]*\]\ Min:\ [-]?[0-9]+[.]?[0-9]*\ Max:\ [-]?[0-9]+[.]?[0-9]*\ Med:\ [-]?[0-9]+[.]?[0-9]*\ Avg:\ [-]?[0-9]+[.]?[0-9]*\ Rms:\ [-]?[0-9]+[.]?[0-9]*[e]?[-]?[0-9]*'`
45 zdmin=`echo $zd | grep -E -o 'Min:\ [-]?[0-9]+[.]?[0-9]*' | sed -e 's/Min:\ //'`
46 zdmin=`echo "scale=2 ; $zdmin / 1 " | bc -l`
47 zdmax=`echo $zd | grep -E -o 'Max:\ [-]?[0-9]+[.]?[0-9]*' | sed -e 's/Max:\ //'`
48 zdmax=`echo "scale=2 ; $zdmax / 1 " | bc -l`
49 azmin=`echo $az | grep -E -o 'Min:\ [-]?[0-9]+[.]?[0-9]*' | sed -e 's/Min:\ //'`
50 azmin=`echo "scale=2 ; $azmin / 1 " | bc -l`
51 azmax=`echo $az | grep -E -o 'Max:\ [-]?[0-9]+[.]?[0-9]*' | sed -e 's/Max:\ //'`
52 azmax=`echo "scale=2 ; $azmax / 1 " | bc -l`
53 echo " Torque-Warning "$indradrive" @ "$timestamp" zd: "$zdmin" "$zdmax" az: "$azmin" "$azmax
54 #echo "---"
55 done
56
57#exit
58 #/home/fact/FACT++/fitsdump -c Time -c Az -c Zd --limit=1 $drivefile
59done
60
61#./fitsdump -c Time -c Az -c Zd --filter="[1] > 17519.14583 && [1] < 17519.14652 " /fact/aux/2017/12/18/20171218.DRIVE_CONTROL_POINTING_POSITION.fits
62
63exit
64
65drivefile=/fact/aux/2017/12/15/20171215.DRIVE_CONTROL_POINTING_POSITION.fits
66start=17516.28780092592592592593
67stop=17516.28918981481481481481
68/home/fact/FACT++/fitsdump -s -c Time -c Az -c Zd --filter="[1] > $start && [1] < $stop " $drivefile 2>/dev/null
69
70exit
71
Note: See TracBrowser for help on using the repository browser.