def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__, 'ccf.log')
    paths = ff.get_paths(data_folder)

    if docopt_args['create']:
        path = docopt_args['<output_folder>']
        src = Path(sys.path[0]).joinpath('ccf-input-template.csv')
        dst = Path(path).joinpath('ccf-input.csv')
        if dst.exists():
            print(f'{dst} already exists')
        else:
            shutil.copy(src, dst)
    else:
        drop_cols = ['photometer', 'camera']
        input_df = pd.read_csv(paths['ccf_input']).replace(0, np.NaN).dropna()
        # input_df = pd.read_csv(docopt_args['<input_path>']).dropna(subset=drop_cols, how='all')
        final_trendlines = {}
        for pps in input_df['pps'].unique():
            logger.info(f'\nPPS: {pps}')
            pps_df = input_df.query('pps==@pps')
            final_trendlines[pps] = get_trendline(pps_df)

        # output_path =
        # if docopt_args['-o'] is not None:
        #     output_path = Path(docopt_args['-o']).joinpath(output_path)
        output_df = pd.DataFrame(data=final_trendlines,
                                 index=['slope', 'intercept']).T
        output_df.to_csv(Path(data_folder).joinpath('ccf-output.csv'))
        output_df.to_csv(Path(ff.APPDATA_DIR).joinpath('ccf-output.csv'))

        input_df.to_csv(Path(data_folder).joinpath('ccf-input.csv'),
                        index=False)
        input_df.to_csv(Path(ff.APPDATA_DIR).joinpath('ccf-input.csv'),
                        index=False)
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__,
                                                       'partial_sequence.log')
    paths = ff.get_paths(data_folder)
    test_seq_df = pd.read_csv(paths['test_seq'])
    tags = [int(i) for i in docopt_args['<tags>']]
    exclude_setup = test_seq_df[(
        test_seq_df['tag'].isin(tags))]['test_name'].apply(
            lambda name: 'standby' in name or 'waketime' in name).all()
    if exclude_setup:
        mask = (test_seq_df['tag'].isin(tags))
    else:
        mask = (test_seq_df['test_name'].isin(
            ['screen_config'])) | (test_seq_df['tag'].isin(tags))
        mask = mask | (
            test_seq_df['test_name'].apply(lambda name: 'ccf' in name))
    # if  and paths['ccf'] is not None:
    #     src, dst = str(paths['ccf']),  str(Path(ff.APPDATA_DIR).joinpath('ccf-output.csv'))
    #     shutil.copy(src, dst)
    #     src, dst = str(paths['ccf_input']), str(Path(ff.APPDATA_DIR).joinpath('ccf-input.csv'))
    #     shutil.copy(src, dst)
    # else:

    partial_test_seq_df = test_seq_df[mask].reset_index().drop('index', axis=1)
    command_df = cs.create_command_df(partial_test_seq_df)
    ts.save_sequences(partial_test_seq_df,
                      command_df,
                      data_folder,
                      partial=True)
Exemple #3
0
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__, 'repair-sequence.log')

    repair_folder = data_folder.joinpath('Repair')
    repair_folder.mkdir(exist_ok=True)
    
    tags = docopt_args['<test_tags>']
    paths = get_paths(data_folder)
    logger.info(paths)
    
    og_test_seq_df = pd.read_csv(paths['test_seq'])
    test_order = get_test_order(og_test_seq_df, tags)
    
    rename_pps = recreate_rename_pps(og_test_seq_df, ts.get_tests())
    qson = (og_test_seq_df['qs'] == 'on').any()
    test_seq_df = ts.create_test_seq_df(test_order, rename_pps, qson)
    test_seq_df.index = range(len(test_seq_df))
    tag_to_name = dict(zip(og_test_seq_df['tag'], og_test_seq_df['test_name']))
    repair_tags = {tag_to_name[int(tag)]: f"{tag} repair" for tag in tags}
    test_seq_df['tag'] = np.where(test_seq_df['test_name'].isin(repair_tags),
                                  test_seq_df['test_name'].apply(repair_tags.get),
                                  test_seq_df['tag'])
    logger.info('\n' + test_seq_df.to_string())
    
    command_df = cs.create_command_df(test_seq_df)
    ts.save_sequences(test_seq_df, command_df, data_folder, repair=True)
Exemple #4
0
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__,
                                                       'basic_report.log')
    paths = ff.get_paths(data_folder)
    report_data = get_report_data(paths, data_folder, docopt_args)
    expected_data = ['data_folder', 'merged_df', 'rsdf', 'test_specs_df']
    check_report_data(report_data, expected_data)
    make_basic_report(report_data)
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__,
                                                       'test_status.log')
    paths = ff.get_paths(data_folder)

    test_seq_df = pd.read_csv(paths['test_seq'])
    merged_df = rd.get_merged_df(test_seq_df, paths, data_folder)

    rd.get_status_df.__wrapped__(test_seq_df, merged_df, paths, data_folder)
Exemple #6
0
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__, 'report.log')
    paths = ff.get_paths(data_folder)
    
    if Path(sys.path[0]).joinpath('simple.txt').exists():
        merged_df = rd.get_merged_df(paths, data_folder)
        rd.get_results_summary_df(merged_df, data_folder, waketimes={})
        rd.get_ccf_df(merged_df, data_folder)
    else:
        report_data = rd.get_report_data(paths, data_folder, docopt_args)
        ISection.save_content_dir = Path(data_folder).joinpath('Elements')
        make_report(report_data)
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__, 'apl_power_report.log')
    paths = ff.get_paths(data_folder)
    report_data = get_report_data(paths, data_folder, docopt_args)
    ISection.save_content_dir = Path(data_folder).joinpath('APLvsPowerCharts')
    expected_data = [
        'data_folder',
        'merged_df',
        'rsdf',
        'test_specs_df'
    ]
    check_report_data(report_data, expected_data)
    make_report(report_data)
def main():

    logger, docopt_args, data_folder = lf.start_script(__doc__,
                                                       'lum_report.log')

    if data_folder is None:
        paths = {'lum_profile': Path(docopt_args['<lum_profile>'])}

    else:
        paths = ff.get_paths(data_folder)

    report_data = get_report_data(paths, data_folder, docopt_args)
    report_data['data_folder'] = paths['lum_profile'].parent
    expected_data = ['lum_df', 'test_specs_df']
    check_report_data(report_data, expected_data)
    make_lum_report(report_data)
Exemple #9
0
def main():
    logger, docopt_args, data_folder = lf.start_script(
        __doc__, 'compliance_report.log')
    paths = ff.get_paths(data_folder)
    report_data = get_report_data(paths, data_folder, docopt_args)
    expected_data = [
        'data_folder',
        'report_type',
        'merged_df',
        'hdr',
        'on_mode_df',
        'limit_funcs',
        'rsdf',
        'area',
        'standby_df',
        'waketimes',
        'test_specs_df',
    ]
    check_report_data(report_data, expected_data)
    make_compliance_report(report_data)
def main():
    logger, docopt_args, data_folder = lf.start_script(__doc__,
                                                       'merge_results.log')
    paths = ff.get_paths(data_folder)
    get_merged_df(paths, data_folder)