def fit_params_txt(fit_params, bp_list, out_dir):
    """Generates a text file in the same folder as the detrending plots that lists applied linear fit equations"""

    # Create .txt file and copy breakpoint list
    text_dir = out_dir + '\\detrending_fit_eqs.txt'
    text_file = open(text_dir, 'w+')
    bps_form = [i for i in bp_list]

    # Write to and save .txt file
    for count, params in enumerate(fit_params):
        if len(bp_list) != 0:
            text_file.write('From %s to %s: %.4f * dist_downstream + %.4f\n' % (bps_form[count], bps_form[count+1], params[0], params[1]))
        else:
            text_file.write('For full reach: %.4f * dist_downstream + %.4f\n' % (params[0], params[1]))
    text_file.close()

    return text_dir