Changeset 20031 for trunk


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.
Location:
trunk/Mars/hawc/processing
Files:
12 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}
  • trunk/Mars/hawc/processing/extract-raw-headers.sh

    r20026 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# This is the directory in which to serach for files
     
    610FITSDUMP=~/FACT++/build/fitsdump
    711# File to which the queries are written
    8 OUTPUT="insert-queries.sql"
     12OUTPUT="insert-raw.sql"
    913
    10 # Remove an existing file with queries
    11 rm -f ${OUTPUT}
     14echo \
     15"\
     16CREATE TABLE RawData  IF NOT EXIST
     17(
     18  Telescope tinyint UNSIGNED NOT NULL,
     19  NIGHT int UNSIGNED NOT NULL,
     20  RUNID mediumint UNSIGNED NOT NULL,
     21  DATE-OBS datetime(6) NOT NULL,
     22  DATE-END datetime(6) NOT NULL,
     23  RUNTYPE tinyint UNSIGNED NOT NULL,
     24  DRSSTEP tinyint UNSIGNED DEFAULT NULL,
     25  NROI mediumint UNSIGNED NOT NULL,
     26  ZNAXIS2 bigint UNSIGNED NOT NULL,
     27  NTRG int UNSIGNED NOT NULL,
     28  NTRGMISC int UNSIGNED NOT NULL,
     29  NTRGPED int UNSIGNED NOT NULL,
     30  REFCLK float NOT NULL,
     31  ZRATIO float NOT NULL,
     32  DAC0 mediumint UNSIGNED NOT NULL,
     33  DAC1 mediumint UNSIGNED NOT NULL,
     34  DAC2 mediumint UNSIGNED NOT NULL,
     35  DAC3 mediumint UNSIGNED NOT NULL,
     36  DAC4 mediumint UNSIGNED NOT NULL,
     37  DAC5 mediumint UNSIGNED NOT NULL,
     38  DAC6 mediumint UNSIGNED NOT NULL,
     39  DAC7 mediumint UNSIGNED NOT NULL,
     40  DATE timestamp NOT NULL,
     41  DRSCALIB tinyint(1) NOT NULL,
     42  NTRGEXT1 int UNSIGNED NOT NULL,
     43  NTRGEXT2 int UNSIGNED NOT NULL,
     44  NTRGLPE int UNSIGNED NOT NULL,
     45  NTRGLPI int UNSIGNED NOT NULL,
     46  NTRGTIM int UNSIGNED NOT NULL,
     47  TSTARTF double NOT NULL,
     48  TSTARTI mediumint UNSIGNED NOT NULL,
     49  TSTOPF double NOT NULL,
     50  TSTOPI mediumint UNSIGNED NOT NULL,
     51  DNA0 bigint UNSIGNED NOT NULL,
     52  DNA1 bigint UNSIGNED NOT NULL,
     53  FWVER0 mediumint UNSIGNED NOT NULL,
     54  FWVER1 mediumint UNSIGNED NOT NULL,
     55  PRIMARY KEY (Telescope, NIGHT, RUNID),
     56  KEY (RUNTYPE)
     57);
     58"\ > ${OUTPUT}
     59
    1260
    1361# Loop over all tokens returned by the given bash extension
     
    58106      then
    59107          echo "INSERT INTO RawData SET" >> ${OUTPUT}
    60           echo ${RESULT}                 >> ${OUTPUT}
     108          echo Telescope=${TELESCOPE},   >> ${OUTPUT}
     109          echo ${RESULT}                 >> ${OUTPUT}
    61110          echo ";"                       >> ${OUTPUT}                                     
    62111      fi
  • trunk/Mars/hawc/processing/find-calibration-files.sql

    r20026 r20031  
    88      SELECT
    99         -- NIGHT and RUNID of the data file
    10          R1.NIGHT AS NIGHT,
    11          R1.RUNID AS RUNID,
     10         R1.Telescope AS Telescope,
     11         R1.NIGHT     AS NIGHT,
     12         R1.RUNID     AS RUNID,
    1213         -- NIGHT and RUNID of the DRS file
    13          R2.NIGHT AS DrsNight,
    14          R2.RUNID AS DrsRunID,
     14         R2.NIGHT     AS DrsNight,
     15         R2.RUNID     AS DrsRunID,
    1516         -- Time difference between the two
    1617         LEAST(
     
    4041         DoNotUse ON (R2.NIGHT=DoNotUse.NIGHT AND R2.RUNID=DoNotUse.RUNID)
    4142      WHERE
     43         -- Of course claibration must be from the same telescope
     44         R1.Telescope=R2.Telescope
     45      AND
    4246         -- Select all combinations that have a data file in R1 and a drs file (at step 1) in R2
    43          ISNULL(R1.DRSSTEP) AND R2.DRSSTEP=1 
     47         ISNULL(R1.DRSSTEP) AND R2.DRSSTEP=1
    4448      AND
    4549         -- Only DRS files with 100 events and the correct ROI are considered
     
    5155      -- AND ABS(UNIX_TIMESTAMP(R2.`DATE-OBS`)-UNIX_TIMESTAMP(R1.`DATE-OBS`))<78*3600
    5256      ORDER BY
    53      R1.NIGHT, R1.RUNID, DeltaT
     57         R1.Telescope,
     58         R1.NIGHT,
     59         R1.RUNID,
     60         DeltaT
    5461    )
    5562    SELECT
     63       Telescope,
    5664       NIGHT,
    5765       RUNID,
  • trunk/Mars/hawc/processing/root2sql-callisto.rc

    r20026 r20031  
     1# link to database
    12uri=hawcwrite:password@ihp-pc45.ethz.ch/hawcdata
    23
    3 # Table's name, will be created if it is not existing already
    4 create=yes
    5 delete=yes
    64# Tree's name
    75tree=Events
    86
     7# Table's name, will be created if it is not existing already
     8#table=Callisto
     9
     10# Create if not yet existing
     11create=yes
     12# Delete entries corresponding to consts
     13delete=yes
     14
     15# Consts
     16primary=Telescope
    917primary=NIGHT
    1018primary=RUNID
     19# Event ID
    1120primary=DAQEvtNumber
    1221
     22# Manual specification of type for const columns
     23sql-type=Telescope/TINYINT UNSIGNED NOT NULL
    1324sql-type=NIGHT/INT UNSIGNED NOT NULL
    1425sql-type=RUNID/MEDIUMINT UNSIGNED NOT NULL
  • trunk/Mars/hawc/processing/root2sql-star.rc

    r20026 r20031  
     1# link to database
    12uri=hawcwrite:password@ihp-pc45.ethz.ch/hawcdata
    23
     4# Tree's name
    35tree=Events
    46
     7# Table's name, will be created if it is not existing already
     8#table=Star
     9
     10# Create if not yet existing
    511create=yes
     12# Delete entries corresponding to consts
    613delete=yes
    714
     15# Consts
     16primary=Telescope
    817primary=NIGHT
    918primary=RUNID
     19# Event ID
    1020primary=DAQEvtNumber
    1121
     22# Manual specification of type for const columns
     23sql-type=Telescope/TINYINT UNSIGNED NOT NULL
    1224sql-type=NIGHT/INT UNSIGNED NOT NULL
    1325sql-type=RUNID/MEDIUMINT UNSIGNED NOT NULL
  • trunk/Mars/hawc/processing/run-callisto.sh

    r20028 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 data is expected to be found in /data/raw and data/callisto
     
    2024FROM
    2125    Calibration
     26WHERE
     27    Telescope=${TELESCOPE}
    2228ORDER BY
    2329    NIGHT, RUNID\
  • trunk/Mars/hawc/processing/run-root2sql.sh

    r20026 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# Path where the data is stored... can be callisto or star
     
    6165         -C ${RESOURCE} \
    6266         --table=${TABLE} \
     67         --const.Telescope=${TELESCOPE} \
    6368         --const.NIGHT=${NIGHT} \
    6469         --const.RUNID=${RUNID} \
  • trunk/Mars/hawc/processing/run-star.sh

    r20028 r20031  
    11#!/bin/bash
     2
     3
     4# Specify the telescope for which to run the script. Replace '1'
     5# by $1 if the telesocpe number is supplied as an option to the script
     6TELESCOPE=1
    27
    38# The data is expected to be found in /data/raw and data/callisto
     
    1924    NIGHT, RUNID
    2025FROM
    21     Calibration_new
     26    Calibration
     27WHERE
     28    Telescope=${TELESCOPE}
    2229ORDER BY
    2330    NIGHT, RUNID\
  • trunk/Mars/hawc/processing/software-trigger.sql

    r20026 r20031  
    33CREATE TABLE SoftwareTrigger
    44(
    5     NIGHT   INT       UNSIGNED NOT NULL,
    6     RUNID   MEDIUMINT UNSIGNED NOT NULL,
    7     Cnt500  INT       UNSIGNED NOT NULL,
    8     Cnt750  INT       UNSIGNED NOT NULL,
    9     Cnt1000 INT       UNSIGNED NOT NULL,
    10     Cnt1250 INT       UNSIGNED NOT NULL,
    11     Cnt1500 INT       UNSIGNED NOT NULL,
    12     Cnt2000 INT       UNSIGNED NOT NULL,
    13     Cnt5000 INT       UNSIGNED NOT NULL,
    14     PRIMARY KEY (NIGHT, RUNID)
     5    Telescope TINYINT   UNSIGNED NOT NULL,
     6    NIGHT     INT       UNSIGNED NOT NULL,
     7    RUNID     MEDIUMINT UNSIGNED NOT NULL,
     8    Cnt500    INT       UNSIGNED NOT NULL,
     9    Cnt750    INT       UNSIGNED NOT NULL,
     10    Cnt1000   INT       UNSIGNED NOT NULL,
     11    Cnt1250   INT       UNSIGNED NOT NULL,
     12    Cnt1500   INT       UNSIGNED NOT NULL,
     13    Cnt2000   INT       UNSIGNED NOT NULL,
     14    Cnt5000   INT       UNSIGNED NOT NULL,
     15    PRIMARY KEY (Telescope, NIGHT, RUNID)
    1516)
    1617AS
    1718(
    1819    SELECT
     20        Telescope,
    1921        NIGHT,
    2022        RUNID,
     
    2931        `Callisto`
    3032    GROUP BY
     33        Telescope,
     34        NIGHT,
     35        RUNID
     36    ORDER BY
     37        Telescope,
    3138        NIGHT,
    3239        RUNID
  • trunk/Mars/hawc/processing/summary-aux-data.rc

    r20026 r20031  
    1919   RawData
    2020LEFT JOIN
    21    AuxData USING (NIGHT, RUNID)
     21   AuxData USING (Telescope, NIGHT, RUNID)
    2222LEFT JOIN
    23    SoftwareTrigger USING (NIGHT, RUNID)
     23   SoftwareTrigger USING (Telescope, NIGHT, RUNID)
    2424LEFT JOIN
    25    DoNotUse USING (NIGHT, RUNID)
     25   DoNotUse USING (Telescope, NIGHT, RUNID)
    2626HAVING
    2727   ObsTime>0
    2828ORDER BY
    29    NIGHT, RUNID
     29   Telescope, NIGHT, RUNID
  • trunk/Mars/hawc/processing/summary-callisto.sql

    r20026 r20031  
    11#!/usr/bin/env -S rootifysql
    22SELECT
     3   Telescope,
    34   NIGHT,
     5   RUNID,
    46   (TSTARTI+TSTARTF) AS ObsStart,
    57   RUNTYPE,
     
    1113   `Callisto` Callisto
    1214LEFT JOIN
    13    RawData USING(NIGHT, RUNID)
     15   RawData USING(Telescope, NIGHT, RUNID)
    1416LEFT JOIN
    15    AuxData USING(NIGHT, RUNID)
     17   AuxData USING(Telescope, NIGHT, RUNID)
    1618ORDER BY
    17    NIGHT, RUNID
     19   Telesscope, NIGHT, RUNID
  • trunk/Mars/hawc/processing/summary-star.sql

    r20026 r20031  
    88   `Star` Star
    99LEFT JOIN
    10    RawData USING(NIGHT, RUNID)
    11 
     10   RawData USING(Telescope, NIGHT, RUNID)
     11ORDER BY
     12   Telescope,
     13   NIGHT,
     14   RUNID
Note: See TracChangeset for help on using the changeset viewer.