Lv1_swift_filter.py
def interm_time_order(eventlist,initialfile,ordered_text):
    """
    Return a list of event files in time order. The order of ObsIDs in the database
    aren't necessarily organized in order of date.

    This is for the intermediate event files.

    eventlist - list of event files
    initialfile - initialfile used for the merging; especially if it was generated from merging just the events
    ordered_text - text file listing the paths and extension for the merging
    """
    if type(eventlist) != np.array and type(eventlist) != list:
        raise TypeError('eventlist should either be an array or a list!')

    start_times = [fits.open(eventlist[i])[1].header['TSTART'] for i in range(len(eventlist))]

    time_ordered = np.argsort(start_times)
    ordered_eventlist = np.array(eventlist)[time_ordered]

    ordered_file = open(ordered_text,'w')
    for i in range(len(ordered_eventlist)):
        if i == 0:
            ordered_file.write(initialfile + '[GTI]' + '\n')
        else:
            ordered_file.write(ordered_eventlist[i] + '[GTI]' + '\n')
    ordered_file.close()

    return

    Return a list of event files in time order. The order of ObsIDs in the database
    aren't necessarily organized in order of date.

    This is for the intermediate event files.

    eventlist - list of event files
    initialfile - initialfile used for the merging; especially if it was generated from merging just the events
    ordered_text - text file listing the paths and extension for the merging
    
Return a list of event files in time order. The order of ObsIDs in the database
aren't necessarily organized in order of date.

This is for the intermediate event files.

list of event files
initialfile - initialfile used for the merging; especially if it was generated from merging just the events
ordered_text - text file listing the paths and extension for the merging
Return a list of event files in time order . The order of ObsIDs in the database aren ' t necessarily organized in order of date . This is for the intermediate event files . list of event files initialfile - initialfile used for the merging ; especially if it was generated from merging just the events ordered_text - text file listing the paths and extension for the merging
def interm_time_order(eventlist,initialfile,ordered_text):
    if type(eventlist) != np.array and type(eventlist) != list:
        raise TypeError('eventlist should either be an array or a list!')
    start_times = [fits.open(eventlist[i])[1].header['TSTART'] for i in range(len(eventlist))]
    time_ordered = np.argsort(start_times)
    ordered_eventlist = np.array(eventlist)[time_ordered]
    ordered_file = open(ordered_text,'w')
    for i in range(len(ordered_eventlist)):
        if i == 0:
            ordered_file.write(initialfile + '[GTI]' + '\n')
        else:
            ordered_file.write(ordered_eventlist[i] + '[GTI]' + '\n')
    ordered_file.close()
    return
def interm_time_order ( eventlist , initialfile , ordered_text ) : if type ( eventlist ) != np . array and type ( eventlist ) != list : raise TypeError ( 'eventlist should either be an array or a list!' ) start_times = [ fits . open ( eventlist [ i ] ) [ 1 ] . header [ 'TSTART' ] for i in range ( len ( eventlist ) ) ] time_ordered = np . argsort ( start_times ) ordered_eventlist = np . array ( eventlist ) [ time_ordered ] ordered_file = open ( ordered_text , 'w' ) for i in range ( len ( ordered_eventlist ) ) : if i == 0 : ordered_file . write ( initialfile + '[GTI]' + '\n' ) else : ordered_file . write ( ordered_eventlist [ i ] + '[GTI]' + '\n' ) ordered_file . close ( ) return
Return a list of event files in time order.
Return a list of event files in time order .
"""
    Return a list of event files in time order. The order of ObsIDs in the database
    aren't necessarily organized in order of date.

    This is for the intermediate event files.

    eventlist - list of event files
    initialfile - initialfile used for the merging; especially if it was generated from merging just the events
    ordered_text - text file listing the paths and extension for the merging
    """
eventlist
initialfile
ordered_text