Changeset 19042 for trunk/DataCheck/Tools
- Timestamp:
- 06/29/18 18:11:56 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Tools/get_data.sh
r19039 r19042 36 36 # ---------------- 37 37 # must-have 38 # - use get_data.sh for download*.php instead of Send_Data*.sh 39 # -> add policy 38 # - fix bug for timeunit=timestamp (min-binning) 39 # - add policy 40 # - add email sending and return values 40 41 # - update function for zd/th-correction 41 42 # - update CU for QLA … … 191 192 where=$where" AND fRunTypeKey=1 " 192 193 # zd cut 193 where=$where" AND fZenithDistanceMax < "$zdmax 194 if [ "$zdmax" != "" ] 195 then 196 where=$where" AND fZenithDistanceMax < "$zdmax 197 fi 194 198 # th cut 195 where=$where" AND fThresholdMedian < "$thmax 199 if [ "$thmax" != "" ] 200 then 201 where=$where" AND "$thresh" < "$thmax 202 fi 203 # dust cut 204 if [ "$dust" != "" ] 205 then 206 where=$where" AND fTNGDust<"$dust 207 fi 208 # light condition cut 209 if [ "$light" == "no moon" ] 210 then 211 where=$where" AND fZenithDistanceMoon>90" 212 fi 213 if [ "$light" == "dark" ] 214 then 215 where=$where" AND fMoonZenithDistance>90 AND fSunZenithDistance>108 " 216 fi 196 217 querybase=$from$where 197 218 … … 296 317 fi 297 318 298 299 fileint=$datapath"/FACT_preliminary_"$name"_internal.dat"300 if [ "$overwrite" = "yes" ]301 then302 echo "creating "$fileint" ..."303 echo "# This file was created at "`date` > $fileint304 echo "# The following query was used: " >> $fileint305 echo "# "$queryint >> $fileint306 # add policy here307 fi308 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]"309 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 "310 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(R750cor) avg(R750ref) "311 echo $headerint >> $fileint312 #echo "$queryint"313 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryint" >> $fileint314 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint"315 316 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"317 if [ "$overwrite" = "yes" ]318 then319 echo "creating "$filecol" ..."320 echo "# This file was created at "`date` > $filecol321 echo "# The following query was used: " >> $filecol322 echo "# "$querycol >> $filecol323 # add policy here324 fi325 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]"326 headercol=$headercol" excrate_err[evts/h] corr.excrate_err[evts/h] flux_err[CU] flux_err[e-11/cm2/s] significance "327 echo $headercol >> $filecol328 #echo "$querycol"329 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol330 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol331 332 319 # write file for externals only for allowed binnings 333 320 if [ $bin -eq 20 ] || [ $bin -eq -1 ] … … 346 333 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext" 347 334 fi 335 if [ "$mode" == "auto" ] && [ "$expert" == "no" ] 336 then 337 return 338 fi 339 340 fileint=$datapath"/FACT_preliminary_"$name"_internal.dat" 341 if [ "$overwrite" = "yes" ] 342 then 343 echo "creating "$fileint" ..." 344 echo "# This file was created at "`date` > $fileint 345 echo "# The following query was used: " >> $fileint 346 echo "# "$queryint >> $fileint 347 # add policy here 348 fi 349 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]" 350 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 " 351 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(R750cor) avg(R750ref) " 352 echo $headerint >> $fileint 353 #echo "$queryint" 354 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryint" >> $fileint 355 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint" 356 if [ "$mode"="auto" ] 357 then 358 return 359 fi 360 361 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat" 362 if [ "$overwrite" = "yes" ] 363 then 364 echo "creating "$filecol" ..." 365 echo "# This file was created at "`date` > $filecol 366 echo "# The following query was used: " >> $filecol 367 echo "# "$querycol >> $filecol 368 # add policy here 369 fi 370 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]" 371 headercol=$headercol" excrate_err[evts/h] corr.excrate_err[evts/h] flux_err[CU] flux_err[e-11/cm2/s] significance " 372 echo $headercol >> $filecol 373 #echo "$querycol" 374 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol 375 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol 376 348 377 } 378 379 # evaluation of command line options (for usage with download.php) 380 381 if [ ${#@} -eq 13 ] 382 then 383 #get_data.sh $start $stop $source $timebin $email $table $time $expert $dch $zd $th $light $dust 384 mode="auto" 385 # setup 386 path=`dirname $0` 387 datapath=$path"/data" 388 sqlpw=/home/$USER/.mysql.pw2 389 host=10.0.100.21 390 dbname=factdata 391 nightmin=$1 392 nightmax=$2 393 source=$3 394 bin=$4 395 email=$5 396 table=$6 397 timeunit=$7 398 expert=$8 399 usedch=$9 # novalue gives same result as no 400 if [ "${10}" != "novalue" ] && [ "${10}" != "all" ] 401 then 402 zdmax=${10} 403 fi 404 if [ "${11}" != "novalue" ] && [ "${11}" != "all" ] 405 then 406 thmax=${11} 407 fi 408 if [ "${12}" != "novalue" ] && [ "${12}" != "all" ] 409 then 410 light=${12} 411 fi 412 if [ "${13}" != "novalue" ] && [ "${13}" != "all" ] 413 then 414 dust=${13} 415 fi 416 name=`echo $email | sed -e 's/@/-at-/'` 417 get_results 418 419 if [ "$expert" == "yes" ] 420 then 421 echo $fileint 422 else 423 echo $fileext 424 fi 425 426 # next: light, dust 427 # implement all options 428 # make dch swi 429 430 exit 431 fi 432 433 349 434 350 435 # -------------------------------------------------------------------------------------- # … … 401 486 nightmin=20111115 402 487 nightmax=20201231 403 # defaults for zd and threshold404 zdmax=90 # all data405 thmax=1500 # all data406 488 # overwrite dataset file? 407 489 # (useful to combine different binnings in one file -> set to "no") … … 416 498 # use a line like the following defining your own data quality selection cut 417 499 #dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 " 500 # apply additional predefined cuts 501 # light conditions 502 #light="no moon" # only data with no moon (but twilight allowed) 503 #light="dark" # only dark night data 504 # TNG dust - cut away data with calima 505 #dust=1 506 #dust=10 507 418 508 419 509 # -------------------------------------------------------------------------------------- #
Note:
See TracChangeset
for help on using the changeset viewer.