Lv1_swift_filter.py
def time_order(eventlist,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.

    eventlist - list of event files
    ordered_text - path to the text file that will list the time-ordered event files
    """
    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)):
        ordered_file.write(ordered_eventlist[i] + '\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.

    eventlist - list of event files
    ordered_text - path to the text file that will list the time-ordered event files
    
Return a list of event files in time order. The order of ObsIDs in the database
aren't necessarily organized in order of date.

list of event files
ordered_text - path to the text file that will list the time-ordered event files
Return a list of event files in time order . The order of ObsIDs in the database aren ' t necessarily organized in order of date . list of event files ordered_text - path to the text file that will list the time - ordered event files
def time_order(eventlist,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)):
        ordered_file.write(ordered_eventlist[i] + '\n')
    ordered_file.close()
    return
def time_order ( eventlist , 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 ) ) : ordered_file . write ( ordered_eventlist [ i ] + '\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.

    eventlist - list of event files
    ordered_text - path to the text file that will list the time-ordered event files
    """
eventlist
ordered_text