= Segments =
* [[https://segments-web.ligo.org|DQSEGDB]]
== File convention in local KAGRA servers ==
* Directory in Kamioka: {{{/users/DET/Segments/}}} -> {{{/users/DET/Segments/${name}/${yyyy}/}}}
* Directory in Kashiwa: {{{/home/detchar/Segments/}}} -> {{{/home/detchar/Segments/${name}/${yyyy}/}}}
* File: {{{SegmentList_foo_UTC_yyyy-mm-dd.txt}}} -> {{{${name}_SEGMENT_UTC_${yyyy-mm-dd}.txt}}}
== Recommendation ==
* '''All the data analysis must require K1-SCIENCE_MODE or K1-DET_FOR_GRB200415A is active.'''
* Basically K1-SCIENCE_MODE is recommended, but if you are interested in the gamma-ray event, K1-DET_FOR_GRB200415A is recommended.
== Definition ==
||# || '''name''' || '''definition''' || '''file name''' || '''description''' || '''valid period''' ||
||1 || K1-GRD_SCIENCE_MODE || K1:GRD_IFO_STATE_N == 1000 || K1-GRD_SCIENCE_MODE_SEGMENT_UTC_yyyy-mm-dd || Observation mode based on guardian || 2020/1/10~ ||
||2 || K1-GRD_LOCKED || K1:GRD-LSC_LOCK_STATE_N == 10000 || K1-GRD_LOCKED_SEGMENT_UTC_yyyy-mm-dd || Interferometer locked || 2022/11/9~ ||
||3 || K1-GRD_UNLOCKED || --(K1:GRD_IFO_STATE_N < 100)--<
> K1:GRD-LSC_LOCK_STATE_N != 1000 || K1-GRD_UNLOCKED_SEGMENT_UTC_yyyy-mm-dd || Not locked || --(2020/1/10~)--<
> 2020/4/7~21 ||
||4 || K1-OMC_OVERFLOW_OK || K1:FEC-32_ADC_OVERFLOW_0_0 == 0 || K1-OMC_OVERFLOW_SEGMENT_OK_UTC_yyyy-mm-dd || No overflow || 2020/4/7~21 ||
||5 || K1-OMC_OVERFLOW_VETO || K1:FEC-32_ADC_OVERFLOW_0_0 != 0 || K1-OMC_OVERFLOW_SEGMENT_UTC_yyyy-mm-dd || overflow || 2020/4/7~21 ||
|| || || || || || ||
||6 || K1-DAQ_STATUS_BAD || See [[https://gwdoc.icrr.u-tokyo.ac.jp/DocDB/0117/G2011751/001/daqerror_O3GK.pdf|Broken frame report]] || K1-DAQ_STATUS_BAD_SEGMENT_UTC_yyyy-mm-dd || Broken frame files || 2020/4/7~21 ||
||7 || K1-SCIENCE_MODE || K1-GRD_SCIENCE_MODE && K1-OMC_OVERFLOW_OK && not K1-DAQ_STATUS_BAD || K1-SCIENCE_MODE_SEGMENT_UTC_yyyy-mm-dd || Science mode || 2020/4/7~21 ||
||8 || K1-DET_FOR_GRB200415A || K1:GRD_IFO_STATE_N == 1000<
>| | (K1:GRD-LSC_LOCK_STATE_N == 1000 <
>&& K1:FEC-32_ADC_OVERFLOW_0_0 == 0) on 4/15, other period is identical to K1-SCIENCE_MODE|| K1-DET_FOR_GRB_SEGMENT_UTC_yyyy-mm-dd || special definition for GRB200415A<
>see [[https://gwdoc.icrr.u-tokyo.ac.jp/cgi-bin/private/DocDB/ShowDocument?docid=11653|JGW-T2011653]] || 2020/4/7~21 ||
|| || || || || || ||
|| || || || || || ||
||9 || K1-GRD_PEM_EARTHQUAKE || K1:GRD_PEM_EARTHQUAKE_STATE_N == 1000 || K1-GRD_PEN_EARTHQUAKE_SEGMENT_UTC_yyyy-mm-dd || Earthquake flag || 2020/1/22~ ||
||10 || K1-CAL_CS_PROC_C00_STRAIN_DBL_DQ_SNR100 || K1:CAL_CS_PROC_C00_STRAIN_DBL_DQ has glitch of SNR > 100 || K1-CAL_CS_PROC_C00_STRAIN_DBL_DQ_SNR100_SEGMENT_UTC_yyyy-mm-dd || Earthquake flag || 2020/2/6~ ||
Obsolete
|| '''name''' || '''definition''' || '''file name''' || '''description''' || '''valid period''' ||
||2 || K1-GRD_LOCKED || --(K1:GRD_IFO_STATE_N >= 100)--<
> K1:GRD-LSC_LOCK_STATE_N == 1000 || K1-GRD_LOCKED_SEGMENT_UTC_yyyy-mm-dd || Interferometer locked ||--(2020/1/10~)--<
> 2020/4/7~21 ||
|| || K1:GRD_LSC_LOCK_STATE_N == 1000 || SegmentList_FPMI_UTC_yyyy-mm-dd || Observation mode || ~2020/1/20 ||
|| || K1:GRD_LSC_LOCK_STATE_N != 1000 || SegmentList_unlocked_UTC_yyyy-mm-dd || NOT Observation mode ||~2020/1/20 ||
|| || || || ||
|| || K1:GRD-LSC_LOCK_STATE_N == 300 || SegmentList_locked_UTC_yyyy-mm-dd || FPMI locked || ~2020/1/20 ||
|| K1-GRD_LOCKED || K1:GRD_IFO_STATE_N >= 100 || K1-GRD_LOCKED_SEGMENT_UTC_yyyy-mm-dd || FPMI locked || 2020/1/10~4/6 ||
|| K1-GRD_UNLOCKED || K1:GRD_IFO_STATE_N < 100 || K1-GRD_UNLOCKED_SEGMENT_UTC_yyyy-mm-dd || Not locked || 2020/1/10~4/6 ||
|| || || || ||
|| || K1:GRD_IMC_STATE_N >= 100 || SegmentList_IMC_UTC_yyyy-mm-dd || IMC locked || ~2020/1/20 ||
|| || || || ||
== Automation ==
* Script: /users/DET/tools/Segments/Script/make15minSegment.py ([[https://github.com/gw-detchar/tools/blob/master/Segments/Script/make15minSegment.py|GitHub]])
* Schedule: 0:10 (UTC) by crontab on k1det0 (Partial file accumulation every 15 min under /users/DET/tools/Segments/Script/Partial/)
* List of segments:
* K1-GRD_SCIENCE_MODE
* K1-GRD_UNLOCKED
* K1-GRD_LOCKED
* K1-GRD_PEM_EARTHQUAKE
* K1-OMC_OVERFLOW_VETO
* K1-OMC_OVERFLOW_OK
== Notes for developer ==
* About sharing data with LIGO on [[https://segments-web.ligo.org|DQSEGDB]], please contact Robert Bruntz.
* Now K1-SCIENCE_MODE is not generated automatically.
* Toward O4, automation of DAQ err segments will be required.
* Automation code make15minSegment.py has test mode option -t. The output file will be generated in temporary directory.
* Omicron trigger based segments can be generated by /users/DET/tools/Segments/Script/makeOmicronSegment.py
* Segment file on Kashiwa server is not synchronized to that in Kamioka. They are generated independently. You need to synchronize code in Kashiwa server by Git. (Or direct synchronization by rsync or something can be an option.)
== sample code to access DQSEGDB ==
* copied from [[https://gwpy.github.io/docs/2.1.2/segments/dqsegdb/|link]]
* on python, run following commands;
{{{
>>> from gwpy.segments import DataQualityFlag
>>> segs = DataQualityFlag.query('L1:DMT-ANALYSIS_READY:1', 'Sep 14 2015', 'Sep 15 2015')
}}}