Ignore:
Timestamp:
01/07/21 14:38:53 (4 years ago)
Author:
tbretz
Message:
Included telescope id and the create query to the raw data extraction.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/hawc/processing/extract-aux-data.sh

    r20030 r20031  
    11#!/bin/bash
     2
     3# Specify the telescope for which to run the script. Replace '1'
     4# by $1 if the telesocpe number is supplied as an option to the script
     5TELESCOPE=1
    26
    37# The base directory of the aux-files
     
    711# The path (relative to your Mars/build directory where the processing macros are stored
    812MACROS=../hawc/processing
     13# File to which the queries are written
     14OUTPUT="insert-aux.sql"
    915
    1016# Open the query-file with the create table statement
     
    1319CREATE TABLE AuxData
    1420(
     21   Telescope       TINYINT   UNSIGNED  NOT NULL,
    1522   NIGHT           INT       UNSIGNED  NOT NULL,
    1623   RUNID           MEDIUMINT UNSIGNED  NOT NULL,
     
    4855   RateSum0        FLOAT,
    4956   RateSum1        FLOAT,
    50    PRIMARY KEY(NIGHT, RUNID)
     57   PRIMARY KEY(Telescope, NIGHT, RUNID)
    5158)
    5259SELECT * FROM
    5360( VALUES
    54 "\ > insert-data.sql
     61"\ > ${OUTPUT}
    5562
    5663# Get all available runs and their start and stop time
     
    6168    NIGHT, RUNID, TSTARTI+TSTARTF, TSTOPI+TSTOPF
    6269FROM
    63     RawData\
     70    RawData
     71WHERE
     72    Telescope=${TELESCOPE}\
    6473"\
    6574 |  mysql \
     
    129138
    130139  # Write the result as one row to the query file
    131   echo "/* "${FNAME}" */" >> insert-data.sql
    132   echo "ROW(" >> insert-data.sql
    133   echo " "${NIGHT}, ${RUNID}, >> insert-data.sql
    134   echo " "${DRS_TEMP},        >> insert-data.sql
    135   echo " "${BIAS_DATA},       >> insert-data.sql
    136   echo " "${FTU_DATA},        >> insert-data.sql
    137   echo " "${FTM_DATA}         >> insert-data.sql
    138   echo ")," >> insert-data.sql
     140  echo "/* "${FNAME}" */"                   >> ${OUTPUT}
     141  echo "ROW("                               >> ${OUTPUT}
     142  echo " "${TELESCOPE], ${NIGHT}, ${RUNID}, >> ${OUTPUT}
     143  echo " "${DRS_TEMP},                      >> ${OUTPUT}
     144  echo " "${BIAS_DATA},                     >> ${OUTPUT}
     145  echo " "${FTU_DATA},                      >> ${OUTPUT}
     146  echo " "${FTM_DATA}                       >> ${OUTPUT}
     147  echo "),"                                 >> ${OUTPUT}
    139148
    140149done
     
    144153AS
    145154(
    146    NIGHT, RUNID,
     155   Telescope, NIGHT, RUNID,
    147156   TavgDRS, TrmsDRS,
    148157   Umed, Uavg, Udev, Urms,
     
    156165   RateSum0, RateSum1
    157166)\
    158 " >> insert-data.sql
     167" >> ${OUTPUT}
Note: See TracChangeset for help on using the changeset viewer.