source: trunk/DataCheck/Tools/fill_catalog.sh@ 19662

Last change on this file since 19662 was 19526, checked in by Daniela Dorner, 5 years ago
improved logging output
  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/bash
2
3
4# TeVCAT
5# list copied on May 27, 2019, from http://tevcat.uchicago.edu/
6tevcat="TeVCAT.txt"
7tevcatdim="TeVCAT.dim"
8
9echo "reading "$tevcat" ..."
10if ! [ -e $tevcatdim ]
11then
12 sources=( `cat $tevcat | sort | grep -v '#' | cut -f1 | sed -e 's/\ /_/g'` )
13 sources2=( `cat $tevcat | sort | grep -v '#' | cut -f2 | sed -e 's/\ /_/g'` )
14 ras2=( `cat $tevcat | sort | grep -v '#' | cut -f3 | sed -e 's/\ /_/g'` )
15 decs2=( `cat $tevcat | sort | grep -v '#' | cut -f4 | sed -e 's/\ /_/g'` )
16 ras=( `cat $tevcat | sort | grep -v '#' | cut -f3 | sort | sed -e 's/\ /\ +\ /1' -e 's/\ /\ \/ 60\ +\ 1\/3600\ *\ /3' | bc -l` )
17 decs=( `cat $tevcat | sort | grep -v '#' | cut -f4 | sed -e 's/\ /\ +\ /1' -e 's/\ /\ \/ 60\ +\ 1\/3600\ *\ /3' | sed -e 's/^/\(\ /m' -e 's/^(\ \-/-\ \(\ /m' -e 's/^(\ +/\(\ /m' -e 's/$/\ \)/m' | bc -l` )
18
19 echo "#"`date` > $tevcatdim
20 echo "#found sources "${#sources[@]}" in "$tevcat >> $tevcatdim
21
22 #echo ${decs[@]}
23 #exit
24
25 for (( i=0 ; i<${#sources[@]} ; i++ ))
26 do
27 #echo $i" "${sources[$i]}" "${ras[$i]}
28 source=`echo ${sources[$i]} | sed -e 's/_/\ /g'`
29 source2=`echo ${sources2[$i]} | sed -e 's/_/\ /g'`
30 #ra=`echo ${ras[$i]}' * 15 ' | bc -l`
31 ra=${ras[$i]}
32 dec=${decs[$i]}
33 #echo $i" "$source" "$ra" "$dec
34 #echo $i" "$source2" "$ra" "$dec
35 echo "SCHEDULER/ADD_SOURCE "$ra" "$dec" "\"$source2\" >> $tevcatdim
36 #dimctrl
37 done
38fi
39echo "go to /home/fact/operation/ , start dimctrl and execute $tevcatdim with .x"
40
41# 2FHL catalog (as used by HAWC for online monitor
42# list downloaded from VizierR (first select catalog, then columns)
43# remark: put # in all lines in header - else sources are associated wrongly
44fhl="2FHL.txt"
45fhldim="2FHL.dim"
46
47echo "reading "$fhl" ..."
48if ! [ -e $fhldim ]
49then
50 # source primary name (doesn not exist for all
51 sources=( `cat $fhl | grep -v '#' | grep -v -E '^$' | cut -d'|' -f4 | sed -e 's/^\ /-/m' | sed -e 's/\ \{1,\}$//m' | sed -e 's/\ /_/g'` )
52 # 2FHL source name
53 sources2=( `cat $fhl | grep -v '#' | grep -v -E '^$' | cut -d'|' -f1 | sed -e 's/\ \{1,\}$//m' | sed -e 's/\ /_/g'` )
54 ras=( `cat $fhl | grep -v '#' | grep -v -E '^$' | cut -d'|' -f2 ` )
55 decs=( `cat $fhl | grep -v '#' | grep -v -E '^$' | cut -d'|' -f3 ` )
56
57 echo "#"`date` > $fhldim
58 echo "#found sources "${#sources[@]}" in "$fhl >> $fhldim
59
60 #echo ${decs[@]}
61 #exit
62
63 for (( i=3 ; i<${#sources[@]} ; i++ ))
64 do
65 #echo $i" "${sources[$i]}" "${ras[$i]}
66 source=`echo ${sources[$i]} | sed -e 's/_/\ /g'`
67 source2="2FHL "`echo ${sources2[$i]} | sed -e 's/_/\ /g'`
68 #ra=${ras[$i]}
69 ra=`echo ${ras[$i]}' / 15 ' | bc -l`
70 dec=${decs[$i]}
71 #echo "_"$source"_ _"$source2"_ "$ra" "$dec
72 echo "_"$source"_ _"$source2"_"
73 if [ "$source" = "-" ]
74 then
75 echo "SCHEDULER/ADD_SOURCE "$ra" "$dec" "\"$source2\" >> $fhldim
76 else
77 echo "SCHEDULER/ADD_SOURCE "$ra" "$dec" "\"$source\" >> $fhldim
78 fi
79 done
80fi
81echo "go to /home/fact/operation/ , start dimctrl and execute $fhldim with .x"
82echo "do not forget to reload source list in drivectrl!!!!"
Note: See TracBrowser for help on using the repository browser.