#!/usr/bin/env tclshexe package require segments package require tconvert #-- Version number of segment files set segsversion 02 #-- Get list of segment end times for each ifo foreach ifo [list H1 H2 L1 ] { set segs$ifo [SegCoalesce [SegRead S2${ifo}v${segsversion}_segs.txt] ] set not$ifo [SegInvert [set segs$ifo]] } #-- Form all combinations set none [SegIntersection $notH1 $notH2 $notL1] set H1 [SegIntersection $segsH1 $notH2 $notL1] set H2 [SegIntersection $notH1 $segsH2 $notL1] set L1 [SegIntersection $notH1 $notH2 $segsL1] set H1H2 [SegIntersection $segsH1 $segsH2 $notL1] set H1L1 [SegIntersection $segsH1 $notH2 $segsL1] set H2L1 [SegIntersection $notH1 $segsH2 $segsL1] set H1H2L1 [SegIntersection $segsH1 $segsH2 $segsL1] #-- Now combine everything array set strings [list \ none " " \ H1 "H1 " \ H2 " H2 " \ L1 " L1" \ H1H2 "H1 H2 " \ H1L1 "H1 L1" \ H2L1 " H2 L1" \ H1H2L1 "H1 H2 L1" ] set lookup [list] foreach type [list none H1 H2 L1 H1H2 H1L1 H2L1 H1H2L1] { set string $strings($type) foreach seg [set $type] { lappend seg $string lappend lookup $seg } } #-- Now sort set lookup [lsort -index 0 $lookup] foreach seg $lookup { set start [lindex $seg 0] set stop [lindex $seg 1] set ifos [lindex $seg 2] if { $start > 0 && $stop < 1999999999 } { puts "$start $stop $ifos [tconvert -l $start] [tconvert -l $stop]" } }