source: trunk/DataCheck/Tools/get_data.sh@ 19045

Last change on this file since 19045 was 19044, checked in by Daniela Dorner, 8 years ago
added sending email
  • Property svn:executable set to *
File size: 25.7 KB
Line 
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# - fix bug for timeunit=timestamp (min-binning)
38# - add information on souce, binning, etc to data-file
39# must-have
40# - update function for zd/th-correction
41# - update CU for QLA
42# - add CU for ISDC analysis
43# - add < 20121212 data for QLA
44# - check crab flux
45# nice-to-have
46# - add E2dNdE
47# - functionality to determine start time for seaon-binning
48# - offer several predefined datachecks?
49
50#
51# content of files (wish list):
52# -----------------------------
53# REMARK: keep order of columns to allow for reading with TGraph directly from file: X Y EX EY
54#
55# internal
56# --------
57# time: time, delta time, start, stop, ontime
58# flux: excrate, excerr, corrate, corerr, CU CUerr, flux, fluxerr,
59# other info on flux: signif, cu-factor, num exc, num sig, num bg
60# other info: zd th R750cor R750ref
61#
62# external (allow only 20min and nightly binning)
63# --------
64# time: time, delta time, start, stop
65# flux: excrate, excerr
66#
67# collaborators
68# -------------
69# time: time, delta time, start, stop, ontime
70# flux: excrate, excerr, corrate, corerr, flux, flux-err, significance
71#
72# additional information to put:
73# ------------------------------
74# timestamp of creation
75# query (for debugging / answering questions)
76# policy (adapted for internal/collaborators/external) [define in files to be used also by Send_Data*.sh
77#
78
79
80function print_policy()
81{
82 echo "#"
83 echo "# Data Usage Policy: "
84 if [ "$expert" == "no" ]
85 then
86 echo "# Using data from the FACT Quick Look Analysis, you agree to cite the FACT design"
87 echo "# paper and the quick look analysis website. "
88 echo "#"
89 echo "# References: "
90 echo "# FACT design paper: http://adsabs.harvard.edu/abs/2013JInst...8P6008A"
91 echo "# http://iopscience.iop.org/1748-0221/8/06/P06008 "
92 echo "# FACT Performance Paper: href='http://adsabs.harvard.edu/abs/2014JInst...9P0012B"
93 echo "# href='http://iopscience.iop.org/1748-0221/9/10/P10012"
94 echo "# FACT quick look analysis: https://fact-project.org/monitoring"
95 echo "# http://adsabs.harvard.edu/abs/2015arXiv150202582D"
96 echo "# If you intend to use data or information from this website, please let us know for reference."
97 else
98 echo "# As a member or associated member of the FACT Collaboration, you have access to internal information."
99 echo "# Any publication using FACT internal information has to have the full FACT author list."
100 fi
101 echo "#"
102}
103
104
105
106function get_results()
107{
108 # some query parts
109
110 # some numbers for flux calculation
111 crabflux="3.37e-11"
112 fluxprec=13
113 crabflux="3.37"
114 fluxprec=2
115
116 # some names and definitions needed several times below
117 # ontime
118 ontime1=" TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn "
119 ontime2=" fOnTimeAfterCuts "
120 ontimeif=" IF(ISNULL(fEffectiveOn), "$ontime2", "$ontime1") "
121 # zd and threshold
122 zenith="fZenithDistance"
123 thresh="IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)"
124 # correction factor for excess rate (formula by TB)
125 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))) "
126 # conversion to CU (determined by DD for QLA)
127 # https://www.fact-project.org/logbook/showthread.php?tid=4927
128 cufactor="CUQLA(fNight)" # missing: ISDC analysis
129 # some calculations
130 excerr="ExcErr(Sum(fNumSigEvts), SUM(fNumBgEvts))"
131 CU="SUM("$correvts"/"$cufactor")/SUM("$ontimeif")*3600"
132 CUerr=$excerr"/SUM("$ontimeif")*3600*SUM("$correvts"/"$cufactor")/SUM(fNumExcEvts)"
133 excerr2="ExcErr(SUM(o.sigevts),SUM(o.bgevts))"
134 CU2="SUM(o.corevts/o.cufactor)/SUM(o.ot)*3600"
135 CUerr2=$excerr2"/SUM(o.ot)*3600*SUM(o.corevts/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))"
136
137 # columns to be selected
138 # for night-binning
139 ontime=" ROUND(SUM("$ontimeif")/60., 1) AS ontime"
140 excrate=" ROUND(SUM(fNumExcEvts)/SUM("$ontimeif")*3600, 1) AS excrate"
141 significance="ROUND(LiMa(Sum(fNumSigEvts), SUM(fNumBgEvts)), 1) AS significance"
142 numexc="Sum(fNumExcEvts) AS numexc"
143 numsig="Sum(fNumSigEvts) AS numsig"
144 numbg="Sum(fNumBgEvts) AS numbg"
145 excrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600, 1) AS excrateerr"
146 correxcrate=" ROUND(SUM("$correvts")/SUM("$ontimeif")*3600, 1) AS correxcrate"
147 correxcrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600*SUM("$correvts")/SUM(fNumExcEvts), 1) AS correxcrateerr"
148 cu=" ROUND("$CU", 2) AS cu"
149 cuerr=" ROUND("$CUerr", 2) AS cuerr"
150 flux="ROUND("$CU" * "$crabflux", 2) AS flux"
151 fluxerr="ROUND("$CUerr" * "$crabflux", 2) AS fluxerr"
152 # for minute binning
153 ontime2=" ROUND(SUM(o.ot)/60., 1) AS ontime"
154 excrate2=" ROUND((SUM(o.sigevts)-SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrate"
155 significance2=" ROUND(LiMa(SUM(o.sigevts),SUM(o.bgevts)), 1) AS significance"
156 numexc2="Sum(o.sigevts-o.bgevts) AS numexc"
157 numsig2="Sum(o.sigevts) AS numsig"
158 numbg2="Sum(o.bgevts) AS numbg"
159 excrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600, 1) AS excrateerr"
160 correxcrate2=" ROUND(SUM(o.corevts)/SUM(o.ot)*3600, 1) AS correxcrate"
161 correxcrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600*SUM(o.corevts)/(SUM(o.sigevts)-SUM(o.bgevts)), 1) AS correxcrateerr"
162 cu2=" ROUND("$CU2", 2) AS cu"
163 cuerr2=" ROUND("$CUerr2", 2) AS cuerr"
164 flux2="ROUND("$CU2" * "$crabflux", "$fluxprec") AS flux"
165 fluxerr2="ROUND("$CUerr2" *"$crabflux", "$fluxprec") AS fluxerr"
166
167 case $timeunit in
168 mjd) delta="(Mjd(MAX(fRunStop))-Mjd(MIN(fRunStart)))/2"
169 start=" Mjd(MIN(fRunStart)) AS start"
170 stop=" Mjd(MAX(fRunStop)) AS stop"
171 deltat=$delta" AS deltat"
172 time=" Mjd(MIN(fRunStart))+"$delta" AS time"
173 delta2="(Mjd(MAX(o.stop))-Mjd(MIN(o.start)))/2"
174 start2=" Mjd(MIN(o.start)) AS start"
175 stop2=" Mjd(MAX(o.stop)) AS stop"
176 deltat2=$delta2" AS deltat"
177 time2=" Mjd(MIN(o.start))+"$delta2" AS time"
178 ;;
179 unix) delta="(Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')))/2"
180 start="Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')) AS start"
181 stop="Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) AS stop"
182 deltat=$delta" AS deltat"
183 time=" Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM'))+"$delta" AS time"
184 delta2="(Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')))/2"
185 startstop2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')) AS start"
186 startstop2=$starstop2" Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) AS stop"
187 deltat2=$delta2" AS deltat"
188 time2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM'))+"$delta2" AS time"
189 ;;
190 *) delta="sec_to_time(time_to_sec(timediff(MAX(fRunStop), MIN(fRunStart)))/2)"
191 start=" MIN(fRunStart) AS start"
192 stop=" MAX(fRunStop) AS stop"
193 deltat=$delta" AS deltat"
194 time=" addtime(MIN(fRunStart), "$delta") AS time"
195 delta2="sec_to_time(time_to_sec(timediff(MAX(o.stop), MIN(o.start)))/2)"
196 start2=" MIN(o.start) AS start"
197 stop2=" MAX(o.stop) AS stop"
198 deltat2=$delta" AS deltat"
199 time2=" addtime(MIN(o.start), "$delta2") AS time"
200 ;;
201 esac
202
203 # from and join of query
204 from=" FROM RunInfo LEFT JOIN "$table" USING (fNight, fRunID) "
205
206 # data check based on artificial trigger rate
207 # details see https://www.fact-project.org/logbook/showthread.php?tid=5790
208 #dch=" AND fR750Cor/fR750Ref >0.93 "
209 dchstd=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
210
211 # put together where-clause of query
212 # time range and source
213 where=" WHERE fSourceKey="$source" AND fNight BETWEEN "$nightmin" AND "$nightmax
214 where=$where" AND NOT ISNULL(fNumExcEvts) "
215 # some sanity checks
216 where=$where" AND fRunTypeKey=1 "
217 # zd cut
218 if [ "$zdmax" != "" ]
219 then
220 where=$where" AND fZenithDistanceMax < "$zdmax
221 fi
222 # th cut
223 if [ "$thmax" != "" ]
224 then
225 where=$where" AND "$thresh" < "$thmax
226 fi
227 # dust cut
228 if [ "$dust" != "" ]
229 then
230 where=$where" AND fTNGDust<"$dust
231 fi
232 # light condition cut
233 if [ "$light" == "no moon" ]
234 then
235 where=$where" AND fZenithDistanceMoon>90"
236 fi
237 if [ "$light" == "dark" ]
238 then
239 where=$where" AND fMoonZenithDistance>90 AND fSunZenithDistance>108 "
240 fi
241 querybase=$from$where
242
243 if [ "$usedch" == "yes" ]
244 then
245 if [ "$dch" == "" ]
246 then
247 querydch=$dchstd
248 else
249 echo "you are using for datacheck: "$dch
250 querydch=$dch
251 fi
252 fi
253
254
255 if [ $bin -le 0 ]
256 then
257 num="#bin"
258 # first part of the query
259 querystart="SELECT "
260 if [ $bin -eq 0 ]
261 then
262 querystart=$querystart" fPeriod AS num, "
263 else
264 querystart=$querystart" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) AS num, "
265 fi
266 querystart=$querystart" "$time", "$start", "$stop", "
267
268 # final part of the query
269 queryend=" GROUP BY num "
270 if [ "$ontimelimit" = "" ]
271 then
272 queryend=$queryend" HAVING SUM("$ontimeif")>1200 ORDER BY num " # 20 min
273 else
274 queryend=$queryend" HAVING SUM("$ontimeif")>"$ontimelimit" ORDER BY num "
275 fi
276
277 # internal
278 queryint=$querystart
279 queryint=$queryint" "$excrate", "$correxcrate", "$cu", "$flux", "
280 queryint=$queryint" "$deltat", "$ontime", "
281 queryint=$queryint" "$excrateerr", "$correxcrateerr", "$cuerr", "$fluxerr", "
282 queryint=$queryint" "$significance", "
283 queryint=$queryint" MIN(fNight) AS nightmin, MAX(fNight) AS nightmax, "
284 queryint=$queryint" "$numexc", "$numsig", "$numbg", "
285 queryint=$queryint" MIN("$zenith"Min) AS zdmin, MAX("$zenith"Max) AS zdmax, "
286 queryint=$queryint" MIN("$thresh") AS thmin, MAX("$thresh") AS thmax, "
287 queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG(fR750Cor), 2) AS R750cor, ROUND(AVG(fR750Ref), 2) AS R750ref "
288 queryint=$queryint" "$querybase" "$querydch" "$queryend
289
290 # for collaborators
291 querycol=$querystart
292 querycol=$querycol" "$excrate", "$correxcrate", "$cu", "$flux", "
293 querycol=$querycol" "$deltat", "$ontime", "
294 querycol=$querycol" "$excrateerr", "$correxcrateerr", "$cuerr", "$fluxerr", "
295 querycol=$querycol" "$significance
296 querycol=$querycol" "$querybase" "$querydch" "$queryend
297
298 # external
299 # no datacheck applied for external files
300 queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase" "$queryend
301
302 else
303 num=
304 # first part of the query
305 querystart="SELECT "
306 querystart=$querystart" "$time2", "$start2", "$stop2", "
307
308 # final part of the query
309 querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, "
310 querybase=$querybase" fR750Cor AS R750cor, fR750Ref AS R750ref, "$cufactor" AS cufactor, "
311 querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, "
312 querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, "
313 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, "
314 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night "
315 querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS "
316 querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'"
317
318 # internal
319 queryint=$querystart
320 queryint=$queryint" "$excrate2", "$correxcrate2", "$cu2", "$flux2", "
321 queryint=$queryint" "$deltat2", "$ontime2", "
322 queryint=$queryint" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxerr2", "
323 queryint=$queryint" "$significance2", "
324 queryint=$queryint" avg(o.night) AS night, "
325 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", "
326 queryint=$queryint" MIN(o.zdmin) AS zdmin, MAX(o.zdmax) AS zdmax, MIN(o.th) AS thmin, MAX(o.th) AS thmax, "
327 queryint=$queryint" ROUND(AVG(o.cufactor), 1) AS cufactor, ROUND(AVG(o.R750cor), 2) AS R750cor, ROUND(AVG(o.R750ref), 2) AS R750ref "
328 queryint=$queryint" "$querybase
329
330 # for collaborators
331 querycol=$querystart
332 querycol=$querycol" "$excrate2", "$correxcrate2", "$cu2", "$flux2", "
333 querycol=$querycol" "$deltat2", "$ontime2", "
334 querycol=$querycol" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxerr2", "
335 querycol=$querycol" "$significance2
336 querycol=$querycol" "$querybase
337
338 # external
339 queryext=$querystart" "$excrate2", "$deltat2", "$ontime2", "$excrateerr2" "$querybase
340
341 fi
342
343 # write file for externals only for allowed binnings
344 if [ $bin -eq 20 ] || [ $bin -eq -1 ]
345 then
346 fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
347 if [ "$overwrite" = "yes" ]
348 then
349 if [ "$mode" != "auto" ]
350 then
351 echo "creating "$fileext" ..."
352 fi
353 echo "# This file was created at "`date` > $fileext
354 print_policy >> $fileext
355 fi
356 headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "
357 echo $headerext >> $fileext
358 #echo "$queryext"
359 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext
360 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"
361 fi
362 if [ "$mode" == "auto" ] && [ "$expert" == "no" ]
363 then
364 return
365 fi
366
367 fileint=$datapath"/FACT_preliminary_"$name"_internal.dat"
368 if [ "$overwrite" = "yes" ]
369 then
370 if [ "$mode" != "auto" ]
371 then
372 echo "creating "$fileint" ..."
373 fi
374 echo "# This file was created at "`date` > $fileint
375 print_policy >> $fileint
376 echo "# The following query was used: " >> $fileint
377 echo "# "$queryint >> $fileint
378 echo "#" >> $fileint
379 fi
380 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]"
381 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 "
382 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(R750cor) avg(R750ref) "
383 echo $headerint >> $fileint
384 #echo "$queryint"
385 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryint" >> $fileint
386 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint"
387 if [ "$mode"="auto" ]
388 then
389 return
390 fi
391
392 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"
393 if [ "$overwrite" = "yes" ]
394 then
395 echo "creating "$filecol" ..."
396 echo "# This file was created at "`date` > $filecol
397 print_policy >> $filecol
398 echo "# The following query was used: " >> $filecol
399 echo "# "$querycol >> $filecol
400 echo "#" >> $filecol
401 fi
402 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]"
403 headercol=$headercol" excrate_err[evts/h] corr.excrate_err[evts/h] flux_err[CU] flux_err[e-11/cm2/s] significance "
404 echo $headercol >> $filecol
405 #echo "$querycol"
406 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol
407 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol
408}
409
410# evaluation of command line options (for usage with download.php)
411
412if [ ${#@} -eq 13 ]
413then
414 #get_data.sh $start $stop $source $timebin $email $table $time $expert $dch $zd $th $light $dust
415 mode="auto"
416 overwrite="yes"
417 # setup
418 datapath="/home/factwww/dch/data"
419 sqlpw=/home/fact/.mysql.pw
420 host=10.0.100.21
421 dbname=factdata
422 nightmin=$1
423 nightmax=$2
424 source=$3
425 bin=$4
426 if [ "$bin" == "00" ]
427 then
428 bin=0
429 fi
430 email=$5
431 table=$6
432 timeunit=$7
433 expert=$8
434 usedch=$9 # novalue gives same result as no
435 if [ "${10}" != "novalue" ] && [ "${10}" != "all" ]
436 then
437 zdmax=${10}
438 fi
439 if [ "${11}" != "novalue" ] && [ "${11}" != "all" ]
440 then
441 thmax=${11}
442 fi
443 if [ "${12}" != "novalue" ] && [ "${12}" != "all" ]
444 then
445 light=${12}
446 fi
447 if [ "${13}" != "novalue" ] && [ "${13}" != "all" ]
448 then
449 dust=${13}
450 fi
451 name=`echo $email | sed -e 's/@/-at-/'`
452 get_results
453
454 # sending email
455 if [ "$expert" == "yes" ]
456 then
457 cat $fileint | mail -s 'FACT internal data download' -b dorner@astro.uni-wuerzburg.de -r dorner@astro.uni-wuerzburg.de $email
458 else
459 cat $fileext | mail -s 'FACT data download' -b dorner@astro.uni-wuerzburg.de -r dorner@astro.uni-wuerzburg.de $email
460 fi
461
462 exit
463fi
464
465
466
467# -------------------------------------------------------------------------------------- #
468# SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP #
469# -------------------------------------------------------------------------------------- #
470# #
471# The lines below define the basic setup for the database and give examples and #
472# explanations for the various options available. #
473# The request of the data itself is done with a smaller setup further down. #
474# #
475# -------------------------------------------------------------------------------------- #
476#
477# ----------
478# DB SETUP
479# ----------
480# path to file with mysql password
481sqlpw=/home/$USER/.mysql.pw
482# host of mysql server with FACT DB
483#host=lp-fact # ISDC
484host=10.0.100.21 # LP or LP via vpn
485#host=localhost # your local machine in case you have a copy of DB
486# name of database
487dbname=factdata
488#
489# -------------
490# BASIC SETUP
491# -------------
492# output path
493path=`dirname $0`
494datapath=$path"/data"
495# create directory for data files
496if ! [ -e $datapath ]
497then
498 mkdir $datapath
499fi
500# time unit
501#timeunit=timestamp # default
502#timeunit=unix
503timeunit=mjd
504# time binning
505# positive values: minutes
506# negative values: days
507# special case 0: period
508# for season binning choose -365 and according start date
509#bin=20 # minutes
510#bin=0 # period
511bin=-1 # nightly
512#bin=-365 # yearly
513# choose analysis
514#table="AnalysisResultsAllQLA" # N/A
515table="AnalysisResultsRunLP" # QLA
516#table="AnalysisResultsRunISDC" # ISDC
517# time range
518nightmin=20111115
519nightmax=20201231
520# overwrite dataset file?
521# (useful to combine different binnings in one file -> set to "no")
522overwrite="yes"
523# optional: require minimal ontime per bin (default 20 min)
524#ontimelimit=30 # 30 min
525ontimelimit= # default 20 min
526# data quality selection
527# if you explicitely don't want a datacheck, you can comment the following line
528usedch="yes"
529# use your own datacheck instead
530# use a line like the following defining your own data quality selection cut
531#dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
532# apply additional predefined cuts
533# light conditions
534#light="no moon" # only data with no moon (but twilight allowed)
535#light="dark" # only dark night data
536# TNG dust - cut away data with calima
537#dust=1
538#dust=10
539
540
541# -------------------------------------------------------------------------------------- #
542# SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE #
543# -------------------------------------------------------------------------------------- #
544# #
545# Adapt the lines below to your needs. #
546# Overwrite default settings above. #
547# The data-request is sent with the line 'get_results.' #
548# Minumum setup: Define source key and name for file. #
549# The list of source keys can be found at #
550# https://fact-project.org/run_db/db/printtable.php?fTable=Source&fSortBy=fSourceKEY+ #
551# More examples can be found further down. #
552# #
553# REMARKS: #
554# - correction of effect of zd and threshold not yet finalized and only valid for QLA #
555# - no CU-conversion available for ISDC-analysis so far (that for QLA is used instead) #
556# #
557# -------------------------------------------------------------------------------------- #
558
559# 501 MAGIC
560source=2
561name="Mrk501_2014_forMAGIC"
562bin=-1
563nightmin=20140714
564nightmax=20140805
565get_results
566
567bin=30
568name="Mrk501_2014_forMAGIC30"
569get_results
570
571bin=0
572name="P"
573nightmin=20140501
574nightmax=20140930
575get_results
576
577bin=20
578nightmin=20140623
579nightmax=20140623
580name="Mrk501_test"
581get_results
582
583
584# end script here
585exit
586
587
588
589#
590# more examples
591#
592
593# Mrk 421
594source=1
595name="Mrk421_nightly"
596bin=-1
597get_results
598name="Mrk421_20min"
599bin=20
600get_results
601name="Mrk421_3d"
602bin=-3
603get_results
604name="Mrk421_10d"
605bin=-10
606get_results
607name="Mrk421_period"
608bin=0
609get_results
610
611
612
613# Mrk 501
614source=2
615name="Mrk501_nightly"
616bin=-1
617get_results
618name="Mrk501_20min"
619bin=20
620get_results
621name="Mrk501_3d"
622bin=-3
623get_results
624name="Mrk501_10d"
625bin=-10
626get_results
627name="Mrk501_period"
628bin=0
629get_results
630
631
632
633# 2344
634source=3
635name="2344_nightly"
636bin=-1
637get_results
638name="2344_20min"
639bin=20
640get_results
641name="2344_period"
642bin=0
643get_results
644
645
646
647# 1959
648source=7
649name="1959_nightly"
650bin=-1
651get_results
652name="1959_20min"
653bin=20
654get_results
655name="1959_period"
656bin=0
657get_results
658
659
660
661# 0323
662source=12
663name="0323_nightly"
664bin=-1
665get_results
666name="0323_20min"
667bin=20
668get_results
669name="0323_period"
670bin=0
671get_results
672
673
674
675# crab
676source=5
677name="Crab_nightly"
678bin=-1
679get_results
680name="Crab_20min"
681bin=20
682get_results
683name="Crab_period"
684bin=0
685get_results
686name="Crab_season"
687bin=-365
688nightmin=20110716
689nightmax=20180716
690get_results
691
692
693
694name="1959_2016"
695source=7
696bin=-1
697nightmin=20160201
698nightmax=20161105
699get_results
700
701name="1959_all_variable"
702overwrite="no"
703source=7
704bin=-365
705nightmin=20120201
706nightmax=20130131
707get_results
708nightmin=20130201
709nightmax=20140131
710get_results
711nightmin=20140201
712nightmax=20150131
713get_results
714bin=0
715nightmin=20150201
716nightmax=20160131
717get_results
718bin=-1
719nightmin=20160201
720nightmax=20170131
721get_results
722bin=0
723nightmin=20170201
724nightmax=20180131
725get_results
726
727
728
729overwrite="yes"
730name="1959_all_variable2"
731overwrite="no"
732source=7
733bin=-365
734nightmin=20120201
735nightmax=20130131
736get_results
737nightmin=20130201
738nightmax=20140131
739get_results
740nightmin=20140201
741nightmax=20150131
742get_results
743bin=0
744nightmin=20150201
745nightmax=20160131
746get_results
747bin=-1
748nightmin=20160201
749nightmax=20160817
750get_results
751bin=0
752nightmin=20160818
753nightmax=20180131
754get_results
755
756
757
758overwrite="yes"
759bin=0
760source=3
761name="2344period"
762get_results
763
764
765
766# flare night (HESS)
767name="Mrk501_10min_flarenight"
768source=2
769bin=10
770nightmin=20140623
771nightmax=20140623
772get_results
773
774
775
776# flare night (HESS)
777name="Mrk501_5min_flarenight"
778source=2
779bin=5
780nightmin=20140623
781nightmax=20140623
782get_results
783
784
785
786
787# full sample
788name="Mrk421_all_nightly"
789source=1
790get_results
791
792name="Mrk501_all_nightly"
793source=2
794get_results
795
796name="1959_all_nightly"
797source=7
798get_results
799
800name="2344_all_nightly"
801source=3
802get_results
803
804
805
806name="HESE20160427"
807source=19
808nightmin=20160425
809bin=-10
810get_results
811
812name="AMON20160731"
813source=21
814nightmin=20160730
815bin=-10
816get_results
817
818
819
Note: See TracBrowser for help on using the repository browser.