In [ ]:
import os
import tqdm

In [ ]:
# --------------------------------
# -------- User input ------------
# --------------------------------

# Specify path to exported landmark data
lmpath = os.path.absolute('landmark.csv')

In [ ]:
# Load landmarks from csv
oldlm = pd.read_csv(lmpath)

We will sort landmark data according to stype and organize it in a two tiered dictionary according to sample type (s) and channel (c).


In [12]:
Dlm = {}
for stype in tqdm.tqdm(oldlm.stype.unique()):
    # These two lines may need to be modified based on stype structure
    s = stype.split('_')[0]
    c = stype.split('_')[1]
    
    # Add sample type dictionary if not already present
    if s not in Dlm.keys():
        Dlm[s] = {}
    
    # Save sample specific landmark data to dictionary
    Dlm[s][c] = oldlm[oldlm.stype==stype]