Changeset 19038


Ignore:
Timestamp:
06/29/18 11:54:09 (7 years ago)
Author:
Daniela Dorner
Message:
made datacheck switchable and allow for own custom-made datacheck
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Tools/get_data.sh

    r19037 r19038  
    3737# - use get_data.sh for download*.php instead of Send_Data*.sh
    3838#   -> add policy
     39#   -> make datacheck switchable
     40# - no datacheck for external
    3941# - update function for correction
    4042# - update CU for QLA
     
    179181   # details see https://www.fact-project.org/logbook/showthread.php?tid=5790
    180182   #dch=" AND fR750Cor/fR750Ref >0.93 "
    181    dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
     183   dchstd=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
    182184   
    183185   # put together where-clause of query
     
    191193   # th cut
    192194   where=$where" AND fThresholdMedian < "$thmax
    193    where=$where" "$dch
     195   querybase=$from$where
     196
     197   if [ "$usedch" == "yes" ]
     198   then
     199      if [ "$dch" == "" ]
     200      then
     201         querydch=$dchstd
     202      else
     203         echo "you are using for datacheck: "$dch
     204         querydch=$dch
     205      fi
     206   fi
     207   
    194208   
    195209   if [ $bin -le 0 ]
     
    207221     
    208222      # final part of the query
    209       querybase=$from$where
    210       querybase=$querybase" GROUP BY num "
     223      queryend=" GROUP BY num "
    211224      if [ "$ontimelimit" = "" ]
    212225      then
    213          querybase=$querybase" HAVING SUM("$ontimeif")>1200 ORDER BY num " # 20 min
     226         queryend=$queryend" HAVING SUM("$ontimeif")>1200 ORDER BY num " # 20 min
    214227      else
    215          querybase=$querybase" HAVING SUM("$ontimeif")>"$ontimelimit" ORDER BY num "
     228         queryend=$queryend" HAVING SUM("$ontimeif")>"$ontimelimit" ORDER BY num "
    216229      fi
    217230     
     
    227240      queryint=$queryint" MIN("$thresh") AS thmin, MAX("$thresh") AS thmax, "
    228241      queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG(fR750Cor), 2) AS R750cor,  ROUND(AVG(fR750Ref), 2) AS R750ref "
    229       queryint=$queryint" "$querybase
     242      queryint=$queryint" "$querybase" "$querydch" "$queryend
    230243     
    231244      # for collaborators
     
    235248      querycol=$querycol" "$excrateerr", "$correxcrateerr", "$cuerr", "$fluxerr", "
    236249      querycol=$querycol" "$significance
    237       querycol=$querycol" "$querybase
     250      querycol=$querycol" "$querybase" "$querydch" "$queryend
    238251     
    239252      # external
    240       queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase
     253      # no datacheck applied for external files
     254      queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase" "$queryend
    241255     
    242256   else
     
    248262      # final part of the query
    249263      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, "
     264      querybase=$querybase" fR750Cor AS R750cor, fR750Ref AS R750ref, "$cufactor" AS cufactor, "
    251265      querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, "
    252266      querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, "
     
    287301      echo "creating "$fileint" ..."
    288302      echo "# This file was created at "`date` > $fileint
    289       # add query and policy here
     303      echo "# The following query was used: " >> $fileint
     304      echo "# "$queryint >> $fileint
     305      # add policy here
    290306   fi
    291307   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]"
     
    302318      echo "creating "$filecol" ..."
    303319      echo "# This file was created at "`date` > $filecol
    304       # add query and policy here
     320      echo "# The following query was used: " >> $filecol
     321      echo "# "$querycol >> $filecol
     322      # add policy here
    305323   fi
    306324   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]"
     
    319337         echo "creating "$fileext" ..."
    320338         echo "# This file was created at "`date` > $fileext
    321          # add query and policy here
     339         # add policy here
    322340      fi
    323341      headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "
     
    391409#ontimelimit=30 # 30 min
    392410ontimelimit= # default 20 min
     411# data quality selection
     412# if you explicitely don't want a datacheck, you can comment the following line
     413usedch="yes"
     414# use your own datacheck instead
     415#   use a line like the following defining your own data quality selection cut
     416#dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
    393417
    394418# -------------------------------------------------------------------------------------- #
Note: See TracChangeset for help on using the changeset viewer.