Add files via upload
This commit is contained in:
parent
621d188c87
commit
840bae8628
3 changed files with 55 additions and 0 deletions
19
reproduction_effort/functions/get_experiments.py
Normal file
19
reproduction_effort/functions/get_experiments.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import torch
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
|
@torch.no_grad()
|
||||||
|
def get_experiments(path: str) -> torch.Tensor:
|
||||||
|
filename_np: str = os.path.join(
|
||||||
|
path,
|
||||||
|
"Exp*_Part001.npy",
|
||||||
|
)
|
||||||
|
|
||||||
|
list_str = glob.glob(filename_np)
|
||||||
|
list_int: list[int] = []
|
||||||
|
for i in range(0, len(list_str)):
|
||||||
|
list_int.append(int(list_str[i].split("Exp")[-1].split("_Trial")[0]))
|
||||||
|
list_int = sorted(list_int)
|
||||||
|
|
||||||
|
return torch.tensor(list_int).unique()
|
18
reproduction_effort/functions/get_parts.py
Normal file
18
reproduction_effort/functions/get_parts.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import torch
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
|
@torch.no_grad()
|
||||||
|
def get_parts(path: str, experiment_id: int, trial_id: int) -> torch.Tensor:
|
||||||
|
filename_np: str = os.path.join(
|
||||||
|
path,
|
||||||
|
f"Exp{experiment_id:03d}_Trial{trial_id:03d}_Part*.npy",
|
||||||
|
)
|
||||||
|
|
||||||
|
list_str = glob.glob(filename_np)
|
||||||
|
list_int: list[int] = []
|
||||||
|
for i in range(0, len(list_str)):
|
||||||
|
list_int.append(int(list_str[i].split("_Part")[-1].split(".npy")[0]))
|
||||||
|
list_int = sorted(list_int)
|
||||||
|
return torch.tensor(list_int).unique()
|
18
reproduction_effort/functions/get_trials.py
Normal file
18
reproduction_effort/functions/get_trials.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import torch
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
|
@torch.no_grad()
|
||||||
|
def get_trials(path: str, experiment_id: int) -> torch.Tensor:
|
||||||
|
filename_np: str = os.path.join(
|
||||||
|
path,
|
||||||
|
f"Exp{experiment_id:03d}_Trial*_Part001.npy",
|
||||||
|
)
|
||||||
|
|
||||||
|
list_str = glob.glob(filename_np)
|
||||||
|
list_int: list[int] = []
|
||||||
|
for i in range(0, len(list_str)):
|
||||||
|
list_int.append(int(list_str[i].split("_Trial")[-1].split("_Part")[0]))
|
||||||
|
list_int = sorted(list_int)
|
||||||
|
return torch.tensor(list_int).unique()
|
Loading…
Reference in a new issue