-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
305b483
commit 8848c5d
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#%% | ||
import pandas as pd | ||
import openmatrix as omx | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
|
||
network_fid_path = Path(r"Z:\MTC\US0024934.9168\Task_3_runtime_improvements\3.1_network_fidelity\run_result") | ||
|
||
#%% | ||
|
||
def read_matrix_as_long_df(path: Path, run_name): | ||
run = omx.open_file(path, "r") | ||
am_time = np.array(run["AM_da_time"]) | ||
index_lables = list(range(am_time.shape[0])) | ||
return pd.DataFrame(am_time, index=index_lables, columns=index_lables).stack().rename(run_name).to_frame() | ||
|
||
all_skims = [] | ||
for skim_matrix_path in network_fid_path.rglob("*AM_taz.omx"): | ||
run_name = skim_matrix_path.parts[6] | ||
all_skims.append(read_matrix_as_long_df(skim_matrix_path, run_name)) | ||
|
||
all_skims = pd.concat(all_skims, axis=1) | ||
# %% | ||
#%%% | ||
all_skims.to_csv(r"Z:\MTC\US0024934.9168\Task_3_runtime_improvements\3.1_network_fidelity\run_result\consolidated\skims.csv") | ||
# %% |