def make_chunks_from_unused(self,length,trig_overlap,play=0,min_length=0,
    sl=0,excl_play=0,pad_data=0):
    """
    Create an extra chunk that uses up the unused data in the science segment.
    @param length: length of chunk in seconds.
    @param trig_overlap: length of time start generating triggers before the
    start of the unused data.
    @param play:
                - 1 : only generate chunks that overlap with S2 playground data.
                - 2 : as 1 plus compute trig start and end times to coincide
                        with the start/end of the playground
    @param min_length: the unused data must be greater than min_length to make a
    chunk.
    @param sl: slide by sl seconds before determining playground data.
    @param excl_play: exclude the first excl_play second from the start and end
    of the chunk when computing if the chunk overlaps with playground.
    @param pad_data: exclude the first and last pad_data seconds of the segment
    when generating chunks

    """
    for seg in self.__sci_segs:
      # if there is unused data longer than the minimum chunk length
      if seg.unused() > min_length:
        end = seg.end() - pad_data
        start = end - length
        if (not play) or (play and (((end-sl-excl_play-729273613)%6370) <
          (600+length-2*excl_play))):
          trig_start = end - seg.unused() - trig_overlap
          if (play == 2):
            # calculate the start of the playground preceeding the chunk end
            play_start = 729273613 + 6370 * \
              math.floor((end-sl-excl_play-729273613) / 6370)
            play_end = play_start + 600
            trig_end = 0
            if ( (play_end - 6370) > start ):
              print "Two playground segments in this chunk"
              print "  Code to handle this case has not been implemented"
              sys.exit(1)
            else:
              if play_start > trig_start:
                trig_start = int(play_start)
              if (play_end < end):
                trig_end = int(play_end)
              if (trig_end == 0) or (trig_end > trig_start):
                seg.add_chunk(start, end, trig_start, trig_end)
          else:
            seg.add_chunk(start, end, trig_start)
        seg.set_unused(0)
def make_chunks_from_unused ( self , length , trig_overlap , play = 0 , min_length = 0 , sl = 0 , excl_play = 0 , pad_data = 0 ) : for seg in self . __sci_segs : if seg . unused ( ) > min_length : end = seg . end ( ) - pad_data start = end - length if ( not play ) or ( play and ( ( ( end - sl - excl_play - 729273613 ) % 6370 ) < ( 600 + length - 2 * excl_play ) ) ) : trig_start = end - seg . unused ( ) - trig_overlap if ( play == 2 ) : play_start = 729273613 + 6370 * math . floor ( ( end - sl - excl_play - 729273613 ) / 6370 ) play_end = play_start + 600 trig_end = 0 if ( ( play_end - 6370 ) > start ) : print "Two playground segments in this chunk" print "  Code to handle this case has not been implemented" sys . exit ( 1 ) else : if play_start > trig_start : trig_start = int ( play_start ) if ( play_end < end ) : trig_end = int ( play_end ) if ( trig_end == 0 ) or ( trig_end > trig_start ) : seg . add_chunk ( start , end , trig_start , trig_end ) else : seg . add_chunk ( start , end , trig_start ) seg . set_unused ( 0 )
Create an extra chunk that uses up the unused data in the science segment.
    @param length: length of chunk in seconds.
    @param trig_overlap: length of time start generating triggers before the
    start of the unused data.
    @param play:
                - 1 : only generate chunks that overlap with S2 playground data.
                - 2 : as 1 plus compute trig start and end times to coincide
                        with the start/end of the playground
    @param min_length: the unused data must be greater than min_length to make a
    chunk.
    @param sl: slide by sl seconds before determining playground data.
    @param excl_play: exclude the first excl_play second from the start and end
    of the chunk when computing if the chunk overlaps with playground.
    @param pad_data: exclude the first and last pad_data seconds of the segment
    when generating chunks