1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # ---------------------------------------------------------------- #
|
---|
4 | # README README README README README README README README README #
|
---|
5 | # ---------------------------------------------------------------- #
|
---|
6 | # #
|
---|
7 | # To use this script, you need #
|
---|
8 | # - a computer with access to the FACT database in La Palma #
|
---|
9 | # - a file with the password of a valid mysql-user #
|
---|
10 | # - to define the setup below for #
|
---|
11 | # a) the DB access #
|
---|
12 | # b) the data you want to have #
|
---|
13 | # #
|
---|
14 | # To define the setup, search for SETUP in this script and #
|
---|
15 | # read the details there #
|
---|
16 | # #
|
---|
17 | # Per data request, you get up to 3 files: #
|
---|
18 | # *_internal.dat #
|
---|
19 | # *_collaborators.dat #
|
---|
20 | # *_external.dat (only if binning is 20min or nightly) #
|
---|
21 | # #
|
---|
22 | # Please have in mind that this started as a tool for myself, then #
|
---|
23 | # others started using it. Also the script is not yet finalized. #
|
---|
24 | # In case you find problems and/or have a feature request, please #
|
---|
25 | # send and email to dorner@astro.uni-wuerzburg.de #
|
---|
26 | # #
|
---|
27 | # ---------------------------------------------------------------- #
|
---|
28 | # README README README README README README README README README #
|
---|
29 | # ---------------------------------------------------------------- #
|
---|
30 |
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | # ToDo (notes DD):
|
---|
36 | # ----------------
|
---|
37 | # - use get_data.sh for download*.php instead of Send_Data*.sh
|
---|
38 | # -> add policy
|
---|
39 | # - update function for correction
|
---|
40 | # - update CU for QLA
|
---|
41 | # - add CU for ISDC analysis
|
---|
42 | # - add < 20121212 data for QLA
|
---|
43 | # - check crab flux
|
---|
44 | # - add E2dNdE?
|
---|
45 | # - functionality to determine start time for seaon-binning
|
---|
46 |
|
---|
47 | #
|
---|
48 | # content of files (wish list):
|
---|
49 | # -----------------------------
|
---|
50 | # REMARK: keep order of columns to allow for reading with TGraph directly from file: X Y EX EY
|
---|
51 | #
|
---|
52 | # internal
|
---|
53 | # --------
|
---|
54 | # time: time, delta time, start, stop, ontime
|
---|
55 | # flux: excrate, excerr, corrate, corerr, CU CUerr, flux, fluxerr,
|
---|
56 | # other info on flux: signif, cu-factor, num exc, num sig, num bg
|
---|
57 | # other info: zd th R750cor R750ref
|
---|
58 | #
|
---|
59 | # external (allow only 20min and nightly binning)
|
---|
60 | # --------
|
---|
61 | # time: time, delta time, start, stop
|
---|
62 | # flux: excrate, excerr
|
---|
63 | #
|
---|
64 | # collaborators
|
---|
65 | # -------------
|
---|
66 | # time: time, delta time, start, stop, ontime
|
---|
67 | # flux: excrate, excerr, corrate, corerr, flux, flux-err, significance
|
---|
68 | #
|
---|
69 | # additional information to put:
|
---|
70 | # ------------------------------
|
---|
71 | # timestamp of creation
|
---|
72 | # query (for debugging / answering questions)
|
---|
73 | # policy (adapted for internal/collaborators/external) [define in files to be used also by Send_Data*.sh
|
---|
74 | #
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | function get_results()
|
---|
79 | {
|
---|
80 | # some query parts
|
---|
81 |
|
---|
82 | # some numbers for flux calculation
|
---|
83 | crabflux="3.37e-11"
|
---|
84 | fluxprec=13
|
---|
85 | crabflux="3.37"
|
---|
86 | fluxprec=2
|
---|
87 |
|
---|
88 | # some names and definitions needed several times below
|
---|
89 | # ontime
|
---|
90 | ontime1=" TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn "
|
---|
91 | ontime2=" fOnTimeAfterCuts "
|
---|
92 | ontimeif=" IF(ISNULL(fEffectiveOn), "$ontime2", "$ontime1") "
|
---|
93 | # zd and threshold
|
---|
94 | zenith="fZenithDistance"
|
---|
95 | thresh="IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)"
|
---|
96 | # correction factor for excess rate (formula by TB)
|
---|
97 | correvts=" fNumExcEvts*(pow(cos("$zenith"Mean*PI()/180),3)+14.8/21.9*pow(sin(2*"$zenith"Mean*PI()/180),5))/((1-0.00124/1.21*("$thresh"-500)*("$thresh">=500))) "
|
---|
98 | # conversion to CU (determined by DD for QLA)
|
---|
99 | # https://www.fact-project.org/logbook/showthread.php?tid=4927
|
---|
100 | cufactor="CUQLA(fNight)" # missing: ISDC analysis
|
---|
101 | # some calculations
|
---|
102 | excerr="ExcErr(Sum(fNumSigEvts), SUM(fNumBgEvts))"
|
---|
103 | CU="SUM("$correvts"/"$cufactor")/SUM("$ontimeif")*3600"
|
---|
104 | CUerr=$excerr"/SUM("$ontimeif")*3600*SUM("$correvts"/"$cufactor")/SUM(fNumExcEvts)"
|
---|
105 | excerr2="ExcErr(SUM(o.sigevts),SUM(o.bgevts))"
|
---|
106 | CU2="SUM(o.corevts/o.cufactor)/SUM(o.ot)*3600"
|
---|
107 | CUerr2=$excerr2"/SUM(o.ot)*3600*SUM(o.corevts/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))"
|
---|
108 |
|
---|
109 | # columns to be selected
|
---|
110 | # for night-binning
|
---|
111 | ontime=" ROUND(SUM("$ontimeif")/60., 1) AS ontime"
|
---|
112 | excrate=" ROUND(SUM(fNumExcEvts)/SUM("$ontimeif")*3600, 1) AS excrate"
|
---|
113 | significance="ROUND(LiMa(Sum(fNumSigEvts), SUM(fNumBgEvts)), 1) AS significance"
|
---|
114 | numexc="Sum(fNumExcEvts) AS numexc"
|
---|
115 | numsig="Sum(fNumSigEvts) AS numsig"
|
---|
116 | numbg="Sum(fNumBgEvts) AS numbg"
|
---|
117 | excrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600, 1) AS excrateerr"
|
---|
118 | correxcrate=" ROUND(SUM("$correvts")/SUM("$ontimeif")*3600, 1) AS correxcrate"
|
---|
119 | correxcrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600*SUM("$correvts")/SUM(fNumExcEvts), 1) AS correxcrateerr"
|
---|
120 | cu=" ROUND("$CU", 2) AS cu"
|
---|
121 | cuerr=" ROUND("$CUerr", 2) AS cuerr"
|
---|
122 | flux="ROUND("$CU" * "$crabflux", 2) AS flux"
|
---|
123 | fluxerr="ROUND("$CUerr" * "$crabflux", 2) AS fluxerr"
|
---|
124 | # for minute binning
|
---|
125 | ontime2=" ROUND(SUM(o.ot)/60., 1) AS ontime"
|
---|
126 | excrate2=" ROUND((SUM(o.sigevts)-SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrate"
|
---|
127 | significance2=" ROUND(LiMa(SUM(o.sigevts),SUM(o.bgevts)), 1) AS significance"
|
---|
128 | numexc2="Sum(o.sigevts-o.bgevts) AS numexc"
|
---|
129 | numsig2="Sum(o.sigevts) AS numsig"
|
---|
130 | numbg2="Sum(o.bgevts) AS numbg"
|
---|
131 | excrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600, 1) AS excrateerr"
|
---|
132 | correxcrate2=" ROUND(SUM(o.corevts)/SUM(o.ot)*3600, 1) AS correxcrate"
|
---|
133 | correxcrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600*SUM(o.corevts)/(SUM(o.sigevts)-SUM(o.bgevts)), 1) AS correxcrateerr"
|
---|
134 | cu2=" ROUND("$CU2", 2) AS cu"
|
---|
135 | cuerr2=" ROUND("$CUerr2", 2) AS cuerr"
|
---|
136 | flux2="ROUND("$CU2" * "$crabflux", "$fluxprec") AS flux"
|
---|
137 | fluxerr2="ROUND("$CUerr2" *"$crabflux", "$fluxprec") AS fluxerr"
|
---|
138 |
|
---|
139 | case $timeunit in
|
---|
140 | mjd) delta="(Mjd(MAX(fRunStop))-Mjd(MIN(fRunStart)))/2"
|
---|
141 | start=" Mjd(MIN(fRunStart)) AS start"
|
---|
142 | stop=" Mjd(MAX(fRunStop)) AS stop"
|
---|
143 | deltat=$delta" AS deltat"
|
---|
144 | time=" Mjd(MIN(fRunStart))+"$delta" AS time"
|
---|
145 | delta2="(Mjd(MAX(o.stop))-Mjd(MIN(o.start)))/2"
|
---|
146 | start2=" Mjd(MIN(o.start)) AS start"
|
---|
147 | stop2=" Mjd(MAX(o.stop)) AS stop"
|
---|
148 | deltat2=$delta2" AS deltat"
|
---|
149 | time2=" Mjd(MIN(o.start))+"$delta2" AS time"
|
---|
150 | ;;
|
---|
151 | unix) delta="(Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')))/2"
|
---|
152 | start="Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')) AS start"
|
---|
153 | stop="Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) AS stop"
|
---|
154 | deltat=$delta" AS deltat"
|
---|
155 | time=" Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM'))+"$delta" AS time"
|
---|
156 | delta2="(Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')))/2"
|
---|
157 | startstop2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')) AS start"
|
---|
158 | startstop2=$starstop2" Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) AS stop"
|
---|
159 | deltat2=$delta2" AS deltat"
|
---|
160 | time2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM'))+"$delta2" AS time"
|
---|
161 | ;;
|
---|
162 | *) delta="sec_to_time(time_to_sec(timediff(MAX(fRunStop), MIN(fRunStart)))/2)"
|
---|
163 | start=" MIN(fRunStart) AS start"
|
---|
164 | stop=" MAX(fRunStop) AS stop"
|
---|
165 | deltat=$delta" AS deltat"
|
---|
166 | time=" addtime(MIN(fRunStart), "$delta") AS time"
|
---|
167 | delta2="sec_to_time(time_to_sec(timediff(MAX(o.stop), MIN(o.start)))/2)"
|
---|
168 | start2=" MIN(o.start) AS start"
|
---|
169 | stop2=" MAX(o.stop) AS stop"
|
---|
170 | deltat2=$delta" AS deltat"
|
---|
171 | time2=" addtime(MIN(o.start), "$delta2") AS time"
|
---|
172 | ;;
|
---|
173 | esac
|
---|
174 |
|
---|
175 | # from and join of query
|
---|
176 | from=" FROM RunInfo LEFT JOIN "$table" USING (fNight, fRunID) "
|
---|
177 |
|
---|
178 | # data check based on artificial trigger rate
|
---|
179 | # details see https://www.fact-project.org/logbook/showthread.php?tid=5790
|
---|
180 | #dch=" AND fR750Cor/fR750Ref >0.93 "
|
---|
181 | dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
|
---|
182 |
|
---|
183 | # put together where-clause of query
|
---|
184 | # time range and source
|
---|
185 | where=" WHERE fSourceKey="$source" AND fNight BETWEEN "$nightmin" AND "$nightmax
|
---|
186 | where=$where" AND NOT ISNULL(fNumExcEvts) "
|
---|
187 | # some sanity checks
|
---|
188 | where=$where" AND fRunTypeKey=1 "
|
---|
189 | # zd cut
|
---|
190 | where=$where" AND fZenithDistanceMax < "$zdmax
|
---|
191 | # th cut
|
---|
192 | where=$where" AND fThresholdMedian < "$thmax
|
---|
193 | where=$where" "$dch
|
---|
194 |
|
---|
195 | if [ $bin -le 0 ]
|
---|
196 | then
|
---|
197 | num="#bin"
|
---|
198 | # first part of the query
|
---|
199 | querystart="SELECT "
|
---|
200 | if [ $bin -eq 0 ]
|
---|
201 | then
|
---|
202 | querystart=$querystart" fPeriod AS num, "
|
---|
203 | else
|
---|
204 | querystart=$querystart" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) AS num, "
|
---|
205 | fi
|
---|
206 | querystart=$querystart" "$time", "$start", "$stop", "
|
---|
207 |
|
---|
208 | # final part of the query
|
---|
209 | querybase=$from$where
|
---|
210 | querybase=$querybase" GROUP BY num "
|
---|
211 | if [ "$ontimelimit" = "" ]
|
---|
212 | then
|
---|
213 | querybase=$querybase" HAVING SUM("$ontimeif")>1200 ORDER BY num " # 20 min
|
---|
214 | else
|
---|
215 | querybase=$querybase" HAVING SUM("$ontimeif")>"$ontimelimit" ORDER BY num "
|
---|
216 | fi
|
---|
217 |
|
---|
218 | # internal
|
---|
219 | queryint=$querystart
|
---|
220 | queryint=$queryint" "$excrate", "$correxcrate", "$cu", "$flux", "
|
---|
221 | queryint=$queryint" "$deltat", "$ontime", "
|
---|
222 | queryint=$queryint" "$excrateerr", "$correxcrateerr", "$cuerr", "$fluxerr", "
|
---|
223 | queryint=$queryint" "$significance", "
|
---|
224 | queryint=$queryint" MIN(fNight) AS nightmin, MAX(fNight) AS nightmax, "
|
---|
225 | queryint=$queryint" "$numexc", "$numsig", "$numbg", "
|
---|
226 | queryint=$queryint" MIN("$zenith"Min) AS zdmin, MAX("$zenith"Max) AS zdmax, "
|
---|
227 | queryint=$queryint" MIN("$thresh") AS thmin, MAX("$thresh") AS thmax, "
|
---|
228 | queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG(fR750Cor), 2) AS R750cor, ROUND(AVG(fR750Ref), 2) AS R750ref "
|
---|
229 | queryint=$queryint" "$querybase
|
---|
230 |
|
---|
231 | # for collaborators
|
---|
232 | querycol=$querystart
|
---|
233 | querycol=$querycol" "$excrate", "$correxcrate", "$cu", "$flux", "
|
---|
234 | querycol=$querycol" "$deltat", "$ontime", "
|
---|
235 | querycol=$querycol" "$excrateerr", "$correxcrateerr", "$cuerr", "$fluxerr", "
|
---|
236 | querycol=$querycol" "$significance
|
---|
237 | querycol=$querycol" "$querybase
|
---|
238 |
|
---|
239 | # external
|
---|
240 | queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase
|
---|
241 |
|
---|
242 | else
|
---|
243 | num=
|
---|
244 | # first part of the query
|
---|
245 | querystart="SELECT "
|
---|
246 | querystart=$querystart" "$time2", "$start2", "$stop2", "
|
---|
247 |
|
---|
248 | # final part of the query
|
---|
249 | querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, "
|
---|
250 | querybase=$querybase" fR750Cor as R750cor, fR750Ref as R750ref, "$cufactor" AS cufactor, "
|
---|
251 | querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, "
|
---|
252 | querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, "
|
---|
253 | querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, "
|
---|
254 | querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night "
|
---|
255 | querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS "
|
---|
256 | querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'"
|
---|
257 |
|
---|
258 | # internal
|
---|
259 | queryint=$querystart
|
---|
260 | queryint=$queryint" "$excrate2", "$correxcrate2", "$cu2", "$flux2", "
|
---|
261 | queryint=$queryint" "$deltat2", "$ontime2", "
|
---|
262 | queryint=$queryint" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxerr2", "
|
---|
263 | queryint=$queryint" "$significance2", "
|
---|
264 | queryint=$queryint" avg(o.night) AS night, "
|
---|
265 | queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", "
|
---|
266 | queryint=$queryint" MIN(o.zdmin) AS zdmin, MAX(o.zdmax) AS zdmax, MIN(o.th) AS thmin, MAX(o.th) AS thmax, "
|
---|
267 | queryint=$queryint" ROUND(AVG(o.cufactor), 1) AS cufactor, ROUND(AVG(o.R750cor), 2) AS R750cor, ROUND(AVG(o.R750ref), 2) AS R750ref "
|
---|
268 | queryint=$queryint" "$querybase
|
---|
269 |
|
---|
270 | # for collaborators
|
---|
271 | querycol=$querystart
|
---|
272 | querycol=$querycol" "$excrate2", "$correxcrate2", "$cu2", "$flux2", "
|
---|
273 | querycol=$querycol" "$deltat2", "$ontime2", "
|
---|
274 | querycol=$querycol" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxerr2", "
|
---|
275 | querycol=$querycol" "$significance2
|
---|
276 | querycol=$querycol" "$querybase
|
---|
277 |
|
---|
278 | # external
|
---|
279 | queryext=$querystart" "$excrate2", "$deltat2", "$ontime2", "$excrateerr2" "$querybase
|
---|
280 |
|
---|
281 | fi
|
---|
282 |
|
---|
283 |
|
---|
284 | fileint=$datapath"/FACT_preliminary_"$name"_internal.dat"
|
---|
285 | if [ "$overwrite" = "yes" ]
|
---|
286 | then
|
---|
287 | echo "creating "$fileint" ..."
|
---|
288 | echo "# This file was created at "`date` > $fileint
|
---|
289 | # add query and policy here
|
---|
290 | fi
|
---|
291 | headerint="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] corr.excrate[evts/h] flux[CU] flux[e-11/cm2/s] delta_time["$timeunit"] ontime[min]"
|
---|
292 | headerint=$headerint" excrate_err[evts/h] corr.excrate_err[evts/h] flux_err[CU] flux_err[e-11/cm2/s] significance night num_exc num_sig num_bg "
|
---|
293 | headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(R750cor) avg(R750ref) "
|
---|
294 | echo $headerint >> $fileint
|
---|
295 | #echo "$queryint"
|
---|
296 | mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryint" >> $fileint
|
---|
297 | #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint"
|
---|
298 |
|
---|
299 | filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"
|
---|
300 | if [ "$overwrite" = "yes" ]
|
---|
301 | then
|
---|
302 | echo "creating "$filecol" ..."
|
---|
303 | echo "# This file was created at "`date` > $filecol
|
---|
304 | # add query and policy here
|
---|
305 | fi
|
---|
306 | headercol="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] corr.excrate[evts/h] flux[CU] flux[e-11/cm2/s] delta_time["$timeunit"] ontime[min]"
|
---|
307 | headercol=$headercol" excrate_err[evts/h] corr.excrate_err[evts/h] flux_err[CU] flux_err[e-11/cm2/s] significance "
|
---|
308 | echo $headercol >> $filecol
|
---|
309 | #echo "$querycol"
|
---|
310 | mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol
|
---|
311 | #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol
|
---|
312 |
|
---|
313 | # write file for externals only for allowed binnings
|
---|
314 | if [ $bin -eq 20 ] || [ $bin -eq -1 ]
|
---|
315 | then
|
---|
316 | fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
|
---|
317 | if [ "$overwrite" = "yes" ]
|
---|
318 | then
|
---|
319 | echo "creating "$fileext" ..."
|
---|
320 | echo "# This file was created at "`date` > $fileext
|
---|
321 | # add query and policy here
|
---|
322 | fi
|
---|
323 | headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "
|
---|
324 | echo $headerext >> $fileext
|
---|
325 | #echo "$queryext"
|
---|
326 | mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext
|
---|
327 | #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"
|
---|
328 | fi
|
---|
329 | }
|
---|
330 |
|
---|
331 | # -------------------------------------------------------------------------------------- #
|
---|
332 | # SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP #
|
---|
333 | # -------------------------------------------------------------------------------------- #
|
---|
334 | # #
|
---|
335 | # The lines below define the basic setup for the database and give examples and #
|
---|
336 | # explanations for the various options available. #
|
---|
337 | # The request of the data itself is done with a smaller setup further down. #
|
---|
338 | # #
|
---|
339 | # -------------------------------------------------------------------------------------- #
|
---|
340 | #
|
---|
341 | # ----------
|
---|
342 | # DB SETUP
|
---|
343 | # ----------
|
---|
344 | # path to file with mysql password
|
---|
345 | sqlpw=/home/$USER/.mysql.pw
|
---|
346 | # host of mysql server with FACT DB
|
---|
347 | #host=lp-fact # ISDC
|
---|
348 | host=10.0.100.21 # LP or LP via vpn
|
---|
349 | #host=localhost # your local machine in case you have a copy of DB
|
---|
350 | # name of database
|
---|
351 | dbname=factdata
|
---|
352 | #
|
---|
353 | # -------------
|
---|
354 | # BASIC SETUP
|
---|
355 | # -------------
|
---|
356 | # output path
|
---|
357 | path=`dirname $0`
|
---|
358 | datapath=$path"/data"
|
---|
359 | # create directory for data files
|
---|
360 | if ! [ -e $datapath ]
|
---|
361 | then
|
---|
362 | mkdir $datapath
|
---|
363 | fi
|
---|
364 | # time unit
|
---|
365 | #timeunit=timestamp # default
|
---|
366 | #timeunit=unix
|
---|
367 | timeunit=mjd
|
---|
368 | # time binning
|
---|
369 | # positive values: minutes
|
---|
370 | # negative values: days
|
---|
371 | # special case 0: period
|
---|
372 | # for season binning choose -365 and according start date
|
---|
373 | #bin=20 # minutes
|
---|
374 | #bin=0 # period
|
---|
375 | bin=-1 # nightly
|
---|
376 | #bin=-365 # yearly
|
---|
377 | # choose analysis
|
---|
378 | #table="AnalysisResultsAllQLA" # N/A
|
---|
379 | table="AnalysisResultsRunLP" # QLA
|
---|
380 | #table="AnalysisResultsRunISDC" # ISDC
|
---|
381 | # time range
|
---|
382 | nightmin=20111115
|
---|
383 | nightmax=20201231
|
---|
384 | # defaults for zd and threshold
|
---|
385 | zdmax=90 # all data
|
---|
386 | thmax=1500 # all data
|
---|
387 | # overwrite dataset file?
|
---|
388 | # (useful to combine different binnings in one file -> set to "no")
|
---|
389 | overwrite="yes"
|
---|
390 | # optional: require minimal ontime per bin (default 20 min)
|
---|
391 | #ontimelimit=30 # 30 min
|
---|
392 | ontimelimit= # default 20 min
|
---|
393 |
|
---|
394 | # -------------------------------------------------------------------------------------- #
|
---|
395 | # SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE #
|
---|
396 | # -------------------------------------------------------------------------------------- #
|
---|
397 | # #
|
---|
398 | # Adapt the lines below to your needs. #
|
---|
399 | # Overwrite default settings above. #
|
---|
400 | # The data-request is sent with the line 'get_results.' #
|
---|
401 | # Minumum setup: Define source key and name for file. #
|
---|
402 | # The list of source keys can be found at #
|
---|
403 | # https://fact-project.org/run_db/db/printtable.php?fTable=Source&fSortBy=fSourceKEY+ #
|
---|
404 | # More examples can be found further down. #
|
---|
405 | # #
|
---|
406 | # REMARKS: #
|
---|
407 | # - correction of effect of zd and threshold not yet finalized and only valid for QLA #
|
---|
408 | # - no CU-conversion available for ISDC-analysis so far (that for QLA is used instead) #
|
---|
409 | # #
|
---|
410 | # -------------------------------------------------------------------------------------- #
|
---|
411 |
|
---|
412 | # 501 MAGIC
|
---|
413 | source=2
|
---|
414 | name="Mrk501_2014_forMAGIC"
|
---|
415 | bin=-1
|
---|
416 | nightmin=20140714
|
---|
417 | nightmax=20140805
|
---|
418 | get_results
|
---|
419 |
|
---|
420 | bin=30
|
---|
421 | name="Mrk501_2014_forMAGIC30"
|
---|
422 | get_results
|
---|
423 |
|
---|
424 | bin=0
|
---|
425 | name="P"
|
---|
426 | nightmin=20140501
|
---|
427 | nightmax=20140930
|
---|
428 | get_results
|
---|
429 |
|
---|
430 | bin=20
|
---|
431 | nightmin=20140623
|
---|
432 | nightmax=20140623
|
---|
433 | name="Mrk501_test"
|
---|
434 | get_results
|
---|
435 |
|
---|
436 |
|
---|
437 | # end script here
|
---|
438 | exit
|
---|
439 |
|
---|
440 |
|
---|
441 |
|
---|
442 | #
|
---|
443 | # more examples
|
---|
444 | #
|
---|
445 |
|
---|
446 | # Mrk 421
|
---|
447 | source=1
|
---|
448 | name="Mrk421_nightly"
|
---|
449 | bin=-1
|
---|
450 | get_results
|
---|
451 | name="Mrk421_20min"
|
---|
452 | bin=20
|
---|
453 | get_results
|
---|
454 | name="Mrk421_3d"
|
---|
455 | bin=-3
|
---|
456 | get_results
|
---|
457 | name="Mrk421_10d"
|
---|
458 | bin=-10
|
---|
459 | get_results
|
---|
460 | name="Mrk421_period"
|
---|
461 | bin=0
|
---|
462 | get_results
|
---|
463 |
|
---|
464 |
|
---|
465 |
|
---|
466 | # Mrk 501
|
---|
467 | source=2
|
---|
468 | name="Mrk501_nightly"
|
---|
469 | bin=-1
|
---|
470 | get_results
|
---|
471 | name="Mrk501_20min"
|
---|
472 | bin=20
|
---|
473 | get_results
|
---|
474 | name="Mrk501_3d"
|
---|
475 | bin=-3
|
---|
476 | get_results
|
---|
477 | name="Mrk501_10d"
|
---|
478 | bin=-10
|
---|
479 | get_results
|
---|
480 | name="Mrk501_period"
|
---|
481 | bin=0
|
---|
482 | get_results
|
---|
483 |
|
---|
484 |
|
---|
485 |
|
---|
486 | # 2344
|
---|
487 | source=3
|
---|
488 | name="2344_nightly"
|
---|
489 | bin=-1
|
---|
490 | get_results
|
---|
491 | name="2344_20min"
|
---|
492 | bin=20
|
---|
493 | get_results
|
---|
494 | name="2344_period"
|
---|
495 | bin=0
|
---|
496 | get_results
|
---|
497 |
|
---|
498 |
|
---|
499 |
|
---|
500 | # 1959
|
---|
501 | source=7
|
---|
502 | name="1959_nightly"
|
---|
503 | bin=-1
|
---|
504 | get_results
|
---|
505 | name="1959_20min"
|
---|
506 | bin=20
|
---|
507 | get_results
|
---|
508 | name="1959_period"
|
---|
509 | bin=0
|
---|
510 | get_results
|
---|
511 |
|
---|
512 |
|
---|
513 |
|
---|
514 | # 0323
|
---|
515 | source=12
|
---|
516 | name="0323_nightly"
|
---|
517 | bin=-1
|
---|
518 | get_results
|
---|
519 | name="0323_20min"
|
---|
520 | bin=20
|
---|
521 | get_results
|
---|
522 | name="0323_period"
|
---|
523 | bin=0
|
---|
524 | get_results
|
---|
525 |
|
---|
526 |
|
---|
527 |
|
---|
528 | # crab
|
---|
529 | source=5
|
---|
530 | name="Crab_nightly"
|
---|
531 | bin=-1
|
---|
532 | get_results
|
---|
533 | name="Crab_20min"
|
---|
534 | bin=20
|
---|
535 | get_results
|
---|
536 | name="Crab_period"
|
---|
537 | bin=0
|
---|
538 | get_results
|
---|
539 | name="Crab_season"
|
---|
540 | bin=-365
|
---|
541 | nightmin=20110716
|
---|
542 | nightmax=20180716
|
---|
543 | get_results
|
---|
544 |
|
---|
545 |
|
---|
546 |
|
---|
547 | name="1959_2016"
|
---|
548 | source=7
|
---|
549 | bin=-1
|
---|
550 | nightmin=20160201
|
---|
551 | nightmax=20161105
|
---|
552 | get_results
|
---|
553 |
|
---|
554 | name="1959_all_variable"
|
---|
555 | overwrite="no"
|
---|
556 | source=7
|
---|
557 | bin=-365
|
---|
558 | nightmin=20120201
|
---|
559 | nightmax=20130131
|
---|
560 | get_results
|
---|
561 | nightmin=20130201
|
---|
562 | nightmax=20140131
|
---|
563 | get_results
|
---|
564 | nightmin=20140201
|
---|
565 | nightmax=20150131
|
---|
566 | get_results
|
---|
567 | bin=0
|
---|
568 | nightmin=20150201
|
---|
569 | nightmax=20160131
|
---|
570 | get_results
|
---|
571 | bin=-1
|
---|
572 | nightmin=20160201
|
---|
573 | nightmax=20170131
|
---|
574 | get_results
|
---|
575 | bin=0
|
---|
576 | nightmin=20170201
|
---|
577 | nightmax=20180131
|
---|
578 | get_results
|
---|
579 |
|
---|
580 |
|
---|
581 |
|
---|
582 | overwrite="yes"
|
---|
583 | name="1959_all_variable2"
|
---|
584 | overwrite="no"
|
---|
585 | source=7
|
---|
586 | bin=-365
|
---|
587 | nightmin=20120201
|
---|
588 | nightmax=20130131
|
---|
589 | get_results
|
---|
590 | nightmin=20130201
|
---|
591 | nightmax=20140131
|
---|
592 | get_results
|
---|
593 | nightmin=20140201
|
---|
594 | nightmax=20150131
|
---|
595 | get_results
|
---|
596 | bin=0
|
---|
597 | nightmin=20150201
|
---|
598 | nightmax=20160131
|
---|
599 | get_results
|
---|
600 | bin=-1
|
---|
601 | nightmin=20160201
|
---|
602 | nightmax=20160817
|
---|
603 | get_results
|
---|
604 | bin=0
|
---|
605 | nightmin=20160818
|
---|
606 | nightmax=20180131
|
---|
607 | get_results
|
---|
608 |
|
---|
609 |
|
---|
610 |
|
---|
611 | overwrite="yes"
|
---|
612 | bin=0
|
---|
613 | source=3
|
---|
614 | name="2344period"
|
---|
615 | get_results
|
---|
616 |
|
---|
617 |
|
---|
618 |
|
---|
619 | # flare night (HESS)
|
---|
620 | name="Mrk501_10min_flarenight"
|
---|
621 | source=2
|
---|
622 | bin=10
|
---|
623 | nightmin=20140623
|
---|
624 | nightmax=20140623
|
---|
625 | get_results
|
---|
626 |
|
---|
627 |
|
---|
628 |
|
---|
629 | # flare night (HESS)
|
---|
630 | name="Mrk501_5min_flarenight"
|
---|
631 | source=2
|
---|
632 | bin=5
|
---|
633 | nightmin=20140623
|
---|
634 | nightmax=20140623
|
---|
635 | get_results
|
---|
636 |
|
---|
637 |
|
---|
638 |
|
---|
639 |
|
---|
640 | # full sample
|
---|
641 | name="Mrk421_all_nightly"
|
---|
642 | source=1
|
---|
643 | get_results
|
---|
644 |
|
---|
645 | name="Mrk501_all_nightly"
|
---|
646 | source=2
|
---|
647 | get_results
|
---|
648 |
|
---|
649 | name="1959_all_nightly"
|
---|
650 | source=7
|
---|
651 | get_results
|
---|
652 |
|
---|
653 | name="2344_all_nightly"
|
---|
654 | source=3
|
---|
655 | get_results
|
---|
656 |
|
---|
657 |
|
---|
658 |
|
---|
659 | name="HESE20160427"
|
---|
660 | source=19
|
---|
661 | nightmin=20160425
|
---|
662 | bin=-10
|
---|
663 | get_results
|
---|
664 |
|
---|
665 | name="AMON20160731"
|
---|
666 | source=21
|
---|
667 | nightmin=20160730
|
---|
668 | bin=-10
|
---|
669 | get_results
|
---|
670 |
|
---|
671 |
|
---|
672 |
|
---|