Skip to content

Commit

Permalink
Remove: OSL_HMM/HMM_MAR and updated examples. (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohil8 authored Jun 28, 2023
1 parent 1780052 commit 563c9c0
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 630 deletions.
92 changes: 0 additions & 92 deletions examples/meg/uk_meg_notts/dynemo_fixed-cov.py

This file was deleted.

32 changes: 21 additions & 11 deletions examples/meg/uk_meg_notts/hmm_tinda.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,38 @@
"""

import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import ttest_rel

from osl_dynamics.inference.modes import argmax_time_courses
from osl_dynamics.inference import modes
from osl_dynamics.analysis.tinda import tinda, plot_cycle, optimise_sequence
from osl_dynamics.data import HMM_MAR


# Some settings
# Settings
os.makedirs("figures", exist_ok=True) # Directory for plots
do_bonferroni_correction = True

# Load precomputed HMM
print("Loading HMM")
hmm = HMM_MAR(
"/well/woolrich/projects/uk_meg_notts/eo/natcomms18/results/Subj1-55_K-12/hmm.mat"
)
# We will download example data hosted on osf.io/by2tc.
# Note, osfclient must be installed. This can be installed with pip:
#
# pip install osfclient

def get_data(name, output_dir):
if os.path.exists(output_dir):
print(f"{output_dir} already downloaded. Skipping..")
return
os.system(f"osf -p by2tc fetch trained_models/{name}.zip")
os.system(f"unzip -o {name}.zip -d {output_dir}")
os.remove(f"{name}.zip")
print(f"Data downloaded to: {output_dir}")

get_data("tde-hmm_notts_rest_55_subj", output_dir="notts_tde_hmm")

# Get state time courses
gamma = hmm.gamma()
stc = argmax_time_courses(gamma)
# Get the state time course
alpha = pickle.load(open("notts_tde_hmm/alpha.pkl", "rb"))
stc = modes.argmax_time_courses(alpha)

# Run TINDA on every subject
print("Running TINDA")
Expand Down
77 changes: 0 additions & 77 deletions examples/meg/uk_meg_notts/sage_fixed-cov.py

This file was deleted.

29 changes: 0 additions & 29 deletions examples/plotting/activity-maps_means.py

This file was deleted.

47 changes: 0 additions & 47 deletions examples/plotting/activity-maps_tde-cov.py

This file was deleted.

30 changes: 0 additions & 30 deletions examples/plotting/activity-maps_vars.py

This file was deleted.

35 changes: 0 additions & 35 deletions examples/plotting/activity-maps_workbench.py

This file was deleted.

Loading

0 comments on commit 563c9c0

Please sign in to comment.