def gen_power_parameters(subject_id, scan_id, FD_1D, FDJ_1D, DVARS,
    threshold=1.0):
    """ Method to generate Power parameters for scrubbing

    Parameters
    ----------
    subject_id : string
        subject name or id

    scan_id : string
        scan name or id

    FD_ID: string
        framewise displacement(FD as per power et al., 2012) file path

    FDJ_ID: string
        framewise displacement(FD as per jenkinson et al., 2002) file path

    threshold : float
        scrubbing threshold set in the configuration
        by default the value is set to 1.0

    DVARS : string
        path to numpy file containing DVARS

    Returns
    -------
    out_file : string (csv file)
        path to csv file containing all the pow parameters
    """
    import os
    import numpy as np
    out_file = 'pow_params.txt'
    with open(out_file, 'w') as f:
        header = (
            """Subject,Scan,MeanFD,MeanFD_Jenkinson,NumFD_greater_than_%.2f,rootMeanSquareFD,FDquartile(top1/4thFD),PercentFD_greater_than_%.2f,MeanDVARS
"""
            .format(threshold, threshold))
        f.write(header)
        f.write('%s,' % subject_id)
        f.write('%s,' % scan_id)
        powersFD_data = np.loadtxt(FD_1D)
        jenkFD_data = np.loadtxt(FDJ_1D)
        meanFD = np.mean(powersFD_data)
        f.write('%.4f,' % meanFD)
        meanFD_Jenkinson = np.mean(jenkFD_data)
        f.write('%.4f,' % meanFD_Jenkinson)
        numFD = float(jenkFD_data[jenkFD_data > threshold].size)
        f.write('%.4f,' % numFD)
        rmsFD = np.sqrt(np.mean(jenkFD_data))
        f.write('%.4f,' % rmsFD)
        quat = int(len(jenkFD_data) / 4)
        FDquartile = np.mean(np.sort(jenkFD_data)[::-1][:quat])
        f.write('%.4f,' % FDquartile)
        count = np.float(jenkFD_data[jenkFD_data > threshold].size)
        percentFD = count * 100 / (len(jenkFD_data) + 1)
        f.write('%.4f,' % percentFD)
        meanDVARS = np.mean(np.load(DVARS))
        f.write('%.4f,' % meanDVARS)
    return os.path.abspath(out_file)
