Skip to content

Instantly share code, notes, and snippets.

@SubhadityaMukherjee
Last active April 11, 2023 09:25
Show Gist options
  • Save SubhadityaMukherjee/a8647e7b5d33826502e995a1af1f9976 to your computer and use it in GitHub Desktop.
Save SubhadityaMukherjee/a8647e7b5d33826502e995a1af1f9976 to your computer and use it in GitHub Desktop.

Revisions

  1. SubhadityaMukherjee revised this gist Apr 11, 2023. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions tbprocess.py
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,14 @@
    def process_runs(main_path):
    all_files = get_event_files(main_path=main_path)
    def process_runs(main_path, save_ims=False) -> pd.DataFrame:
    """Process all runs and return a dataframe of all results"""
    all_files = get_event_files(main_path=main_path, save_ims=False)
    all_dict = {}
    for files in tqdm(all_files, total = len(all_files)):
    event_acc = EventAccumulator(files)
    event_acc.Reload()
    temp_dict = process_event_acc(event_acc)
    all_dict[files] = temp_dict
    return pd.DataFrame.from_records(all_dict).T.reset_index()
    for files in tqdm(all_files, total=len(all_files)):
    try:
    # Process each file using the EventAccumulator and save to a dictionary
    event_acc = EventAccumulator(files)
    event_acc.Reload()
    temp_dict = process_event_acc(event_acc, save_ims=save_ims)
    all_dict[files] = temp_dict
    except IndexError:
    pass
    return pd.DataFrame.from_records(all_dict).T.reset_index()
  2. SubhadityaMukherjee created this gist Mar 16, 2023.
    9 changes: 9 additions & 0 deletions tbprocess.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    def process_runs(main_path):
    all_files = get_event_files(main_path=main_path)
    all_dict = {}
    for files in tqdm(all_files, total = len(all_files)):
    event_acc = EventAccumulator(files)
    event_acc.Reload()
    temp_dict = process_event_acc(event_acc)
    all_dict[files] = temp_dict
    return pd.DataFrame.from_records(all_dict).T.reset_index()