def aeration_data(DO_column, dirpath):
    """Extract the data from folder containing tab delimited
    files of aeration data. The file must be the original tab delimited file.
    All text strings below the header must be removed from these files.
    The file names must be the air flow rates with units of micromoles/s.
    An example file name would be "300.xls" where 300 is the flow rate in
    micromoles/s. The function opens a file dialog for the user to select
    the directory containing the data.

    :param DO_column: Index of the column that contains the dissolved oxygen concentration data.
    :type DO_columm: int
    :param dirpath: Path to the directory containing aeration data you want to analyze
    :type dirpath: string

    :return: collection of

        * **filepaths** (*string list*) - All file paths in the directory sorted by flow rate
        * **airflows** (*numpy.array*) - Sorted array of air flow rates with units of micromole/s
        * **DO_data** (*numpy.array list*) - Sorted list of Numpy arrays. Thus each of the numpy data arrays can have different lengths to accommodate short and long experiments
        * **time_data** (*numpy.array list*) - Sorted list of Numpy arrays containing the times with units of seconds
    """
    #return the list of files in the directory
    filenames = os.listdir(dirpath)
    #extract the flowrates from the filenames and apply units
    airflows = ((np.array([i.split('.', 1)[0] for i in filenames])).astype(np.float32))
    #sort airflows and filenames so that they are in ascending order of flow rates
    idx = np.argsort(airflows)
    airflows = (np.array(airflows)[idx])*u.umole/u.s
    filenames = np.array(filenames)[idx]

    filepaths = [os.path.join(dirpath, i) for i in filenames]
    #DO_data is a list of numpy arrays. Thus each of the numpy data arrays can have different lengths to accommodate short and long experiments
    # cycle through all of the files and extract the column of data with oxygen concentrations and the times
    DO_data=[column_of_data(i,0,DO_column,-1,'mg/L') for i in filepaths]
    time_data=[(column_of_time(i,0,-1)).to(u.s) for i in filepaths]
    aeration_collection = collections.namedtuple('aeration_results','filepaths airflows DO_data time_data')
    aeration_results = aeration_collection(filepaths, airflows, DO_data, time_data)
    return aeration_results
def aeration_data ( DO_column , dirpath ) : filenames = os . listdir ( dirpath ) airflows = ( ( np . array ( [ i . split ( '.' , 1 ) [ 0 ] for i in filenames ] ) ) . astype ( np . float32 ) ) idx = np . argsort ( airflows ) airflows = ( np . array ( airflows ) [ idx ] ) * u . umole / u . s filenames = np . array ( filenames ) [ idx ] filepaths = [ os . path . join ( dirpath , i ) for i in filenames ] DO_data = [ column_of_data ( i , 0 , DO_column , - 1 , 'mg/L' ) for i in filepaths ] time_data = [ ( column_of_time ( i , 0 , - 1 ) ) . to ( u . s ) for i in filepaths ] aeration_collection = collections . namedtuple ( 'aeration_results' , 'filepaths airflows DO_data time_data' ) aeration_results = aeration_collection ( filepaths , airflows , DO_data , time_data ) return aeration_results
Extract the data from folder containing tab delimited
    files of aeration data. The file must be the original tab delimited file.
    All text strings below the header must be removed from these files.
    The file names must be the air flow rates with units of micromoles/s.
    An example file name would be "300.xls" where 300 is the flow rate in
    micromoles/s. The function opens a file dialog for the user to select
    the directory containing the data.

    :param DO_column: Index of the column that contains the dissolved oxygen concentration data.
    :type DO_columm: int
    :param dirpath: Path to the directory containing aeration data you want to analyze
    :type dirpath: string

    :return: collection of

        * **filepaths** (*string list*) - All file paths in the directory sorted by flow rate
        * **airflows** (*numpy.array*) - Sorted array of air flow rates with units of micromole/s
        * **DO_data** (*numpy.array list*) - Sorted list of Numpy arrays. Thus each of the numpy data arrays can have different lengths to accommodate short and long experiments
        * **time_data** (*numpy.array list*) - Sorted list of Numpy arrays containing the times with units of seconds