Volitional deep brain stimulation following brain-computer interface training for Parkinson’s disease
The 2 matches
- [1] § Results › BCI effects on motor performance ↔ analysis.ipynb, lines 1080–1155 · score 0.67 · tapping speed, post BCI, pre BCI, constant DBS
- [2] § Materials And Methods › Motor performance assessment ↔ analysis.ipynb, lines 1080–1155 · score 0.52 · inter tap interval, speed
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 1,181 lines · 38 KB · no license · 2 matches
- # %%
- import polars as pl
- import numpy as np
- import seaborn as sns
- import matplotlib.pyplot as plt
- import datetime
- import glob
- import utils
- plt.rcParams["font.family"] = "sans-serif"
- plt.rcParams["font.sans-serif"] = ["Arial Unicode MS"]
- plt.rcParams["font.size"] = 11
- # %%
- # Import statsmodels and ols function
- import statsmodels.api as sm
- from statsmodels.formula.api import ols
- # from statsmodels.regression.mixed_linear_model import MixedLM
- # import statsmodels.formula.api as smf
- # from statsmodels.tools.sm_exceptions import ConvergenceWarning
- from scipy.stats import ttest_ind, ttest_rel
- # %% [markdown]
- # ## Game data
- # %% [markdown]
- # ### BCI game performance
- # %%
- def get_plane_file_list(
- subj,
- data_dir="data/plane_game_data",
- extension="",
- ):
- plane_data_dir = f"{data_dir}/{subj}/{extension}"
- plane_data_file_list = glob.glob("Session_*.csv", root_dir=plane_data_dir)
- plane_data_file_list.sort()
- return plane_data_file_list, plane_data_dir
- def read_plane_data(plane_data_file):
- df_plane = pl.read_csv(
- plane_data_file,
- has_header=False,
- skip_rows=1,
- null_values="-",
- new_columns=["Timestamp_ticks", "x", "y", "score"],
- ).with_columns(x=-pl.col("x"))
- df_plane = df_plane[:-1] # remove last row (usually incomplete)
- return df_plane
- def get_date_from_plane_data(df_plane):
- tick = df_plane["Timestamp_ticks"][0]
- converted_ticks = datetime.datetime(1, 1, 1) + datetime.timedelta(
- microseconds=tick / 10
- )
- # timestamp = converted_ticks.timestamp()
- # converted_time = converted_ticks.strftime("%Y-%m-%d %H:%M:%S.%fZ")[:-3]
- date = converted_ticks.strftime("%Y-%m-%d")
- return date
- def get_score_per_block(
- df_plane,
- x_per_second=17.3,
- t_start=30,
- break_length=60,
- ending_length=10,
- NF_block_length=300,
- ):
- x_block1_start = (t_start) * x_per_second
- x_block1_end = (t_start + NF_block_length) * x_per_second
- x_block2_start = (t_start + NF_block_length + break_length) * x_per_second
- x_block2_end = (t_start + NF_block_length * 2 + break_length) * x_per_second
- x_block3_start = (t_start + NF_block_length * 2 + break_length) * x_per_second
- x_block3_end = (t_start + NF_block_length * 3 + break_length * 2) * x_per_second
- score_block1_start = df_plane.filter(pl.col("x") <= x_block1_start)["score"][-1]
- score_block1_end = df_plane.filter(pl.col("x") <= x_block1_end)["score"][-1]
- score_block2_start = df_plane.filter(pl.col("x") <= x_block2_start)["score"][-1]
- score_block2_end = df_plane.filter(pl.col("x") <= x_block2_end)["score"][-1]
- score_block3_start = df_plane.filter(pl.col("x") <= x_block3_start)["score"][-1]
- score_block3_end = df_plane.filter(pl.col("x") <= x_block3_end)["score"][-1]
- score_per_block = [
- score_block1_end - score_block1_start,
- score_block2_end - score_block2_start,
- score_block3_end - score_block3_start,
- ]
- return score_per_block
- def get_score_for_sessions(
- subj, first_session, last_session, file_list, plane_data_dir
- ):
- df_score_all = pl.DataFrame({})
- for session_num in range(first_session, last_session):
- plane_data_file = f"{plane_data_dir}/{file_list[session_num]}"
- # print(plane_data_file)
- df_plane = read_plane_data(plane_data_file)
- date = get_date_from_plane_data(df_plane)
- score_per_block = get_score_per_block(df_plane)
- # dbs condition
- dbs_condition = file_list[session_num][37:-4]
- if dbs_condition == "":
- dbs_condition = "constant"
- dict_game_performance = {
- "subj": subj,
- "date": date,
- "session": session_num,
- "dbs": dbs_condition,
- "block": [1, 2, 3],
- "score": score_per_block,
- }
- df_game_performance = pl.DataFrame(dict_game_performance)
- df_score_all = pl.concat((df_score_all, df_game_performance))
- return df_score_all
- # %%
- subj = "RCS05"
- plane_file_list1_rcs05, plane_data_dir1_rcs05 = get_plane_file_list(subj, extension="")
- plane_file_list2_rcs05, plane_data_dir2_rcs05 = get_plane_file_list(subj, extension="extended")
- df_score_training_rcs05 = get_score_for_sessions(
- subj, 0, 7, plane_file_list1_rcs05, plane_data_dir1_rcs05
- )
- df_score_testing_rcs05 = get_score_for_sessions(
- subj, 0, 12, plane_file_list2_rcs05, plane_data_dir2_rcs05
- )
- subj = "RCS15"
- plane_file_list1_rcs15, plane_data_dir1_rcs15 = get_plane_file_list(subj, extension="")
- plane_file_list2_rcs15, plane_data_dir2_rcs15 = get_plane_file_list(subj, extension="extended")
- df_score_training_rcs15 = get_score_for_sessions(
- subj, 0, 7, plane_file_list1_rcs15, plane_data_dir1_rcs15
- )
- df_score_testing_rcs15 = get_score_for_sessions(
- subj, 0, 12, plane_file_list2_rcs15, plane_data_dir2_rcs15
- )
- # combine from subjects
- df_score_training = pl.concat(
- (df_score_training_rcs05, df_score_training_rcs15)
- ).with_columns(
- session=pl.col("date").rank("dense").over("subj"),
- subj=pl.col("subj").replace({"RCS05": "patient1", "RCS15": "patient2"}),
- )
- df_score_testing = pl.concat(
- (df_score_testing_rcs05, df_score_testing_rcs15)
- ).with_columns(
- session=pl.col("date").rank("dense").over("subj"),
- subj=pl.col("subj").replace({"RCS05": "patient1", "RCS15": "patient2"}),
- )
- # %%
- # separate panels
- g = sns.catplot(
- df_score_training.to_pandas(),
- x="session",
- y="score",
- hue="subj",
- col="subj",
- alpha=0.7,
- kind="point",
- palette="Set2",
- height=2,
- aspect=1.5,
- )
- g.set_titles("{col_name}")
- g.fig.suptitle("training sessions", y=1.05)
- # plt.savefig("figures/training_session_score.png", dpi=300, bbox_inches="tight")
- # %%
- from statsmodels.formula.api import ols
- # Fit ordinary least squares linear regression
- model = ols("score ~ session", data=df_score_training.to_pandas()).fit()
- print("Linear regression for both patients combined:\n", model.summary(), "\n")
- print("Exact p-value for session coefficient: ", model.pvalues["session"])
- # %%
- # separate panels
- g = sns.FacetGrid(
- df_score_testing.to_pandas(),
- col="subj",
- hue="subj",
- palette="Set2",
- height=2.5,
- aspect=1,
- )
- g.map(
- sns.violinplot,
- "dbs",
- "score",
- alpha=0.2,
- width=0.5,
- inner=None,
- order=["constant", "increase", "decrease"],
- )
- g.map(
- sns.pointplot, "dbs", "score", alpha=0.7, order=["constant", "increase", "decrease"]
- )
- g.add_legend()
- g.set_titles("{col_name}")
- g.set_axis_labels("DBS policy", "score")
- g.fig.suptitle("testing sessions", y=1.05)
- # plt.savefig("figures/testing_session_score.png", dpi=300, bbox_inches="tight")
- # %%
- # ANOVA test
- for subj in ["patient1", "patient2"]:
- df_score_testing_subj = df_score_testing.filter(pl.col("subj") == subj)
- model = ols(formula="score ~ dbs", data=df_score_testing_subj.to_pandas()).fit()
- print(f"{subj}:\n", sm.stats.anova_lm(model, typ=2), "\n")
- # %% [markdown]
- # ### Get trial conditions
- # %%
- def get_x_intervals(t_intervals, block_num, x_per_second=17.3):
- x_intervals = np.array(t_intervals) * x_per_second
- # print(x_intervals)
- if block_num % 2 == 1:
- rest_intervals = np.array(
- [
- [x_intervals[i], x_intervals[i + 1]]
- for i in range(0, len(x_intervals) - 1, 2)
- ]
- )
- down_intervals = np.array(
- [
- [x_intervals[i], x_intervals[i + 1]]
- for i in range(1, len(x_intervals) - 1, 2)
- ]
- )
- else:
- down_intervals = np.array(
- [
- [x_intervals[i], x_intervals[i + 1]]
- for i in range(0, len(x_intervals) - 1, 2)
- ]
- )
- rest_intervals = np.array(
- [
- [x_intervals[i], x_intervals[i + 1]]
- for i in range(1, len(x_intervals) - 1, 2)
- ]
- )
- return x_intervals, rest_intervals, down_intervals
- x_per_second = 17.3
- # length in seconds
- t_start = 30
- trial_length = 15
- break_length = 60
- NF_block_length = 300
- t_intervals_block1 = [
- t_start + i * trial_length for i in range(int(NF_block_length / trial_length) + 1)
- ]
- t_intervals_block2 = [
- t_start + NF_block_length + break_length + i * trial_length
- for i in range(int(NF_block_length / trial_length) + 1)
- ]
- t_intervals_block3 = [
- t_start + NF_block_length * 2 + break_length * 2 + i * trial_length
- for i in range(int(NF_block_length / trial_length) + 1)
- ]
- x_intervals_block1 = get_x_intervals(t_intervals_block1, block_num=1)
- x_intervals_block2 = get_x_intervals(t_intervals_block2, block_num=2)
- x_intervals_block3 = get_x_intervals(t_intervals_block3, block_num=1)
- rest_intervals_all = np.concatenate(
- (x_intervals_block1[1], x_intervals_block2[1], x_intervals_block3[1]), axis=0
- )
- down_intervals_all = np.concatenate(
- (x_intervals_block1[2], x_intervals_block2[2], x_intervals_block3[2]), axis=0
- )
- trial_onsets_all = np.concatenate(
- (x_intervals_block1[0][:-1], x_intervals_block2[0][:-1], x_intervals_block3[0][:-1])
- )
- # %%
- def get_condition_for_x(
- x, rest_intervals=rest_intervals_all, down_intervals=down_intervals_all
- ):
- rest_test = np.int64(x >= rest_intervals)
- rest_result = np.sum(rest_test[:, 0] - rest_test[:, 1])
- down_test = np.int64(x >= down_intervals)
- down_result = np.sum(down_test[:, 0] - down_test[:, 1])
- if rest_result == 1:
- condition = "rest"
- elif down_result == 1:
- condition = "regulate"
- else:
- condition = "other"
- return condition
- def get_trial_num_for_x(x, trial_onsets=trial_onsets_all):
- return np.sum(x >= trial_onsets)
- def get_plane_data(
- subj, first_session, last_session, plane_data_file_list, plane_data_dir
- ):
- df_plane = pl.DataFrame({})
- for session_num in range(first_session, last_session):
- plane_data_file = f"{plane_data_dir}/{plane_data_file_list[session_num]}"
- df = read_plane_data(plane_data_file)
- date = get_date_from_plane_data(df)
- dbs_condition = plane_data_file_list[session_num][37:-4]
- if dbs_condition == "":
- dbs_condition = "constant"
- df = df.with_columns(
- subj=pl.lit(subj),
- session=pl.lit(session_num),
- date=pl.lit(date),
- dbs=pl.lit(dbs_condition),
- )
- df_plane = pl.concat((df_plane, df))
- timestamp_col = np.empty(len(df_plane))
- for i in range(len(df_plane)):
- ticks = df_plane["Timestamp_ticks"][i]
- converted_ticks = datetime.datetime(1, 1, 1) + datetime.timedelta(
- microseconds=ticks / 10
- )
- timestamp_col[i] = converted_ticks.timestamp()
- df_plane = df_plane.with_columns(unixtime=timestamp_col)
- return df_plane
- def get_condition_for_plane_data(df_plane):
- df_plane_condition = df_plane.with_columns(
- condition=pl.col("x").map_elements(get_condition_for_x, return_dtype=pl.String),
- trial=pl.col("x").map_elements(get_trial_num_for_x, return_dtype=pl.Int64),
- )
- df_plane_condition = df_plane_condition.filter(
- pl.col("condition").is_in(["regulate", "rest"])
- )
- return df_plane_condition
- # %%
- # RCS05
- df_plane_training_rcs05 = get_plane_data(
- "RCS05", 0, 7, plane_file_list1_rcs05, plane_data_dir1_rcs05
- )
- df_plane_training_rcs05_condition = get_condition_for_plane_data(
- df_plane_training_rcs05
- )
- # recalculate condition for RCS05 initial training sessions because the trial conditions were counterbalanced across blocks
- df_plane_training_rcs05_condition = df_plane_training_rcs05_condition.with_columns(
- condition=pl.when(pl.col("trial") % 2 == 0)
- .then(pl.lit("regulate"))
- .otherwise(pl.lit("rest"))
- )
- df_plane_testing_rcs05 = get_plane_data(
- "RCS05", 0, 12, plane_file_list2_rcs05, plane_data_dir2_rcs05
- )
- df_plane_testing_rcs05_condition = get_condition_for_plane_data(df_plane_testing_rcs05)
- # RCS15
- df_plane_training_rcs15 = get_plane_data(
- "RCS15", 0, 7, plane_file_list1_rcs15, plane_data_dir1_rcs15
- )
- df_plane_training_rcs15_condition = get_condition_for_plane_data(
- df_plane_training_rcs15
- )
- df_plane_testing_rcs15 = get_plane_data(
- "RCS15", 0, 12, plane_file_list2_rcs15, plane_data_dir2_rcs15
- )
- df_plane_testing_rcs15_condition = get_condition_for_plane_data(df_plane_testing_rcs15)
- # combine from subjects
- df_plane_condition_training = pl.concat(
- (df_plane_training_rcs05_condition, df_plane_training_rcs15_condition)
- ).with_columns(session=pl.col("date").rank("dense").over("subj"))
- df_plane_condition_testing = pl.concat(
- (df_plane_testing_rcs05_condition, df_plane_testing_rcs15_condition)
- ).with_columns(session=pl.col("date").rank("dense").over("subj"))
- # %% [markdown]
- # ## Neural data
- # %% [markdown]
- # ### Primary analyses
- # %%
- def get_rcs_file_list(
- subj,
- data_dir="data/neural_data",
- extension="",
- hemisphere="L",
- file_type="Adaptive_data",
- ):
- rcs_data_dir = f"{data_dir}/{subj}/{subj}{hemisphere}/{extension}"
- rcs_file_list = glob.glob(
- f"day*/Device*/{file_type}.parquet", root_dir=rcs_data_dir
- )
- rcs_file_list.sort()
- return rcs_file_list, rcs_data_dir
- def read_rcs_adaptive_parquet(file, data_dir):
- df_rcs = pl.read_parquet(f"{data_dir}/{file}", row_index_name="row_number")
- output_col = pl.Series(
- "output",
- [
- utils.uint_to_float(df_rcs["Ld0_output"][i], 32, 10)
- for i in range(len(df_rcs))
- ],
- )
- df_rcs = (
- df_rcs.with_columns(
- date=pl.col("localTime").cast(pl.String).str.slice(0, 10),
- unixtime=(pl.col("newDerivedTime") / 1e3),
- input=pl.col("featureInput"),
- output=output_col,
- )
- .with_columns(
- input_log=pl.col("input").log(),
- output_log=pl.col("output").log(),
- # height_on_game_screen = (pl.col('output').log()-3)*16.5
- )
- .filter(pl.col("row_number") > 0)
- )
- df_rcs = df_rcs.drop(["row_number", "newDerivedTime", "featureInput", "Ld0_output"])
- return df_rcs
- def get_adaptive_data_for_sessions(
- subj, first_session, last_session, parquet_list, data_dir
- ):
- df_rcs_all = pl.DataFrame()
- for file in parquet_list[first_session:last_session]:
- df_rcs = read_rcs_adaptive_parquet(file, data_dir)
- df_rcs = df_rcs.drop(["localTime"])
- df_rcs_all = pl.concat((df_rcs_all, df_rcs))
- df_rcs_all = df_rcs_all.insert_column(
- 0, pl.Series("subj", np.repeat(subj, len(df_rcs_all)))
- )
- df_rcs_all = df_rcs_all.sort("unixtime")
- return df_rcs_all
- # %%
- subj = "RCS05"
- adaptive_file_list1_rcs05, adaptive_data_dir1_rcs05 = get_rcs_file_list(
- subj, extension=""
- )
- adaptive_file_list2_rcs05, adaptive_data_dir2_rcs05 = get_rcs_file_list(
- subj, extension="extended"
- )
- df_rcs_adaptive_training_rcs05 = get_adaptive_data_for_sessions(
- subj, 0, 7, adaptive_file_list1_rcs05, adaptive_data_dir1_rcs05
- )
- df_rcs_adaptive_testing_rcs05 = get_adaptive_data_for_sessions(
- subj, 0, 12, adaptive_file_list2_rcs05, adaptive_data_dir2_rcs05
- )
- subj = "RCS15"
- adaptive_file_list1_rcs15, adaptive_data_dir1_rcs15 = get_rcs_file_list(
- subj, extension=""
- )
- adaptive_file_list2_rcs15, adaptive_data_dir2_rcs15 = get_rcs_file_list(
- subj, extension="extended"
- )
- df_rcs_adaptive_training_rcs15 = get_adaptive_data_for_sessions(
- subj, 0, 7, adaptive_file_list1_rcs15, adaptive_data_dir1_rcs15
- )
- df_rcs_adaptive_testing_rcs15 = get_adaptive_data_for_sessions(
- subj, 0, 12, adaptive_file_list2_rcs15, adaptive_data_dir2_rcs15
- )
- # combine from subjects
- df_rcs_adaptive_training = pl.concat(
- (df_rcs_adaptive_training_rcs05, df_rcs_adaptive_training_rcs15)
- ).with_columns(session=pl.col("date").rank("dense").over("subj"))
- df_rcs_adaptive_testing = pl.concat(
- (df_rcs_adaptive_testing_rcs05, df_rcs_adaptive_testing_rcs15)
- ).with_columns(session=pl.col("date").rank("dense").over("subj"))
- # %%
- join_tolerance = 1 # seconds
- thresh_rcs05 = 18
- thresh_rcs15 = 17
- df_rcs_adaptive_training_condition = df_rcs_adaptive_training.join_asof(
- df_plane_condition_training.select(
- ["subj", "unixtime", "condition", "dbs", "trial"]
- ).sort("unixtime"),
- on="unixtime",
- by="subj",
- tolerance=join_tolerance,
- ).with_columns(
- subj=pl.col("subj").replace({"RCS05": "patient1", "RCS15": "patient2"}),
- DBS_state=pl.col("CurrentAdaptiveState").replace(
- {"State 0": "low", "State 1": "high"}
- ),
- DBS_state_num=pl.col("CurrentAdaptiveState")
- .replace({"State 0": 0, "State 1": 1})
- .cast(pl.Int32),
- )
- df_rcs_adaptive_testing_condition = df_rcs_adaptive_testing.join_asof(
- df_plane_condition_testing.select(
- ["subj", "unixtime", "condition", "dbs", "trial"]
- ).sort("unixtime"),
- on="unixtime",
- by="subj",
- tolerance=join_tolerance,
- ).with_columns(
- subj=pl.col("subj").replace({"RCS05": "patient1", "RCS15": "patient2"}),
- DBS_state=pl.col("CurrentAdaptiveState").replace(
- {"State 0": "low", "State 1": "high"}
- ),
- DBS_state_num=pl.col("CurrentAdaptiveState")
- .replace({"State 0": 0, "State 1": 1})
- .cast(pl.Int32),
- )
- # %%
- # distribution
- df_plot = df_rcs_adaptive_testing_condition.filter(pl.col("trial") <= 40)
- g = sns.FacetGrid(
- df_plot.to_pandas(),
- col="subj",
- hue="condition",
- palette="Accent",
- hue_order=["regulate", "rest"],
- height=2,
- aspect=1.5,
- sharey=True,
- )
- g.map(sns.histplot, "output_log", alpha=0.6, binwidth=0.08)
- g.add_legend()
- g.set_axis_labels("normalized beta power")
- g.figure.suptitle("Distribution of beta power during test", y=1.05)
- g.set_titles("{col_name}")
- g.figure.axes[0].axvline(x=np.log(thresh_rcs05), color="black", linestyle="--")
- g.figure.axes[1].axvline(x=np.log(thresh_rcs15), color="black", linestyle="--")
- # plt.savefig(
- # "figures/beta_distribution_testing_session.png", dpi=300, bbox_inches="tight"
- # )
- # %%
- # Perform t-test to compare 'output_log' between 'regulate' and 'rest' for each subject
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(pl.col("subj") == subj)
- df_pd = df_plot_subj.to_pandas()
- group_reg = df_pd[df_pd["condition"] == "regulate"]["output_log"].dropna().values
- group_rest = df_pd[df_pd["condition"] == "rest"]["output_log"].dropna().values
- print(f"T-test for 'output_log' between 'regulate' and 'rest' for {subj}:")
- if len(group_reg) > 1 and len(group_rest) > 1:
- t_stat, p_val = ttest_ind(group_reg, group_rest, equal_var=False)
- d = utils.cohens_d(group_reg, group_rest)
- print(
- f" t({len(group_reg) + len(group_rest) - 2}): {t_stat:.3f}, p = {p_val:.3g}, Cohen's d = {d:.3f}"
- )
- else:
- print(" Not enough data for t-test")
- print()
- # %%
- df_plot = (
- df_rcs_adaptive_testing_condition.filter(pl.col("trial") <= 40)
- .groupby(["subj", "session", "dbs", "condition", "trial", "DBS_state"])
- .agg(pl.col("DBS_state").count().alias("count"))
- .with_columns(
- percentage=pl.col("count")
- / pl.col("count").sum().over(["subj", "session", "dbs", "condition", "trial"])
- * 100
- )
- )
- df_plot.sort(["subj", "session", "dbs", "condition", "trial", "DBS_state"])
- # # count plot
- # sns.catplot(data=df_rcs_adaptive_testing_condition.to_pandas(), x='condition', hue='DBS_state',
- # col="subj", kind="count", palette='Accent', order=['regulate','rest'], hue_order=['low', 'high'],
- # height=2, aspect=1)
- # percentage plot
- g = sns.catplot(
- data=df_plot.to_pandas(),
- x="condition",
- y="percentage",
- hue="DBS_state",
- col="subj",
- kind="bar",
- palette="Set2",
- order=["regulate", "rest"],
- hue_order=["low", "high"],
- height=2,
- aspect=1.2,
- ).set(ylim=[0, 120])
- plt.suptitle("Distribution of adaptive state during test", y=1.05)
- g._legend.set_title("beta state")
- g.set_titles("{col_name}")
- # plt.savefig(
- # "figures/adaptive_state_distribution_testing_session.png",
- # dpi=300,
- # bbox_inches="tight",
- # )
- # %%
- # ANOVA test
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(pl.col("subj") == subj)
- observed = df_plot_subj.to_pandas().pivot_table(
- index="DBS_state", columns="condition", values="percentage", aggfunc="mean"
- )
- print(f"\n{subj}:")
- print(observed)
- model = ols(
- formula="percentage ~ DBS_state*condition", data=df_plot_subj.to_pandas()
- ).fit()
- print(f"{subj}:\n", sm.stats.anova_lm(model, typ=2), "\n")
- # %%
- patient_list = ["patient1", "patient2"]
- rcs_thresholds = {"patient1": thresh_rcs05, "patient2": thresh_rcs15}
- stim_limits = {"patient1": [2.5, 3.5], "patient2": [3.5, 4.5]}
- for s in patient_list:
- if s == "patient1":
- df_plot_all = df_rcs_adaptive_testing_condition.filter(
- pl.col("subj") == "patient1",
- pl.col("session") == 1,
- pl.col("trial") >= 0,
- pl.col("trial") <= 8,
- )
- else:
- df_plot_all = df_rcs_adaptive_testing_condition.filter(
- pl.col("subj") == "patient2",
- pl.col("session") == 3,
- pl.col("trial") >= 10,
- pl.col("trial") <= 18,
- )
- policies = ["constant", "increase", "decrease"]
- x_labels = ["", "time (s)", ""]
- y_labels1 = ["beta power", "", ""]
- y_labels2 = ["state", "", ""]
- y_labels3 = ["stim", "", ""]
- rugplot_legends = [False, False, True]
- fig = plt.figure(figsize=(10, 2.5))
- grid = plt.GridSpec(5, 3, hspace=0.5, wspace=0.15)
- # plt.suptitle(f'{s}', y=1.1, fontsize=16)
- for i in range(len(policies)):
- policy = policies[i]
- df_plot = df_plot_all.filter(pl.col("dbs") == policy)
- df_plot = df_plot.with_columns(
- time=pl.col("unixtime") - df_plot["unixtime"].min()
- ).to_pandas()
- main_ax = fig.add_subplot(grid[:3, i : i + 1])
- mid_ax = fig.add_subplot(grid[3, i : i + 1])
- lower_ax = fig.add_subplot(grid[4, i : i + 1])
- # main panel
- main_ax.set(xticklabels=[]) # remove the tick labels
- main_ax.tick_params(bottom=False) # remove the ticks
- main_ax.axhline(y=rcs_thresholds[s], color="grey", lw=1, linestyle="--")
- main_ax.set_title(f"{policy} policy")
- sns.lineplot(
- ax=main_ax,
- data=df_plot,
- x="time",
- y="output",
- c="red",
- alpha=0.5,
- errorbar=None,
- estimator=None,
- ).set(ylabel=y_labels1[i], xlabel="", ylim=[-5, 100])
- # sns.rugplot(
- # ax=main_ax,
- # data=df_plot,
- # x="time",
- # hue="condition",
- # palette="Accent",
- # hue_order=["regulate", "rest"],
- # height=0.05,
- # lw=2,
- # expand_margins=True,
- # legend=rugplot_legends[i],
- # ).set(xlabel="")
- sns.lineplot(
- ax=main_ax,
- data=df_plot,
- x="time",
- y=0,
- hue="condition",
- units="trial",
- palette="Accent",
- hue_order=["regulate", "rest"],
- lw=2,
- legend=rugplot_legends[i],
- ).set(xlabel="")
- if i == 2:
- sns.move_legend(main_ax, "upper left", bbox_to_anchor=(1, 1))
- # mid panel
- mid_ax.set(xticklabels=[]) # remove the tick labels
- mid_ax.tick_params(bottom=False) # remove the ticks
- sns.lineplot(
- ax=mid_ax,
- data=df_plot,
- x="time",
- y="DBS_state_num",
- c="orange",
- alpha=0.5,
- errorbar=None,
- estimator=None,
- ).set(ylabel=y_labels2[i], xlabel="", ylim=[-0.5, 1.5])
- # lower panel
- sns.lineplot(
- ax=lower_ax,
- data=df_plot,
- x="time",
- y="stim_level",
- c="blue",
- alpha=0.5,
- errorbar=None,
- estimator=None,
- ).set(ylim=stim_limits[s], ylabel=y_labels3[i], xlabel=x_labels[i])
- # sns.rugplot(ax=lower_ax, data=df_plot, x="time", hue="condition", height=0.03, legend=False)
- # plt.savefig(f"figures/adaptive_DBS_dynamics_{s}.png", dpi=300, bbox_inches="tight")
- # %%
- df_plot = (
- df_rcs_adaptive_testing_condition.filter(pl.col("session") <= 4)
- .group_by("subj", "date", "session", "trial", "condition", "dbs")
- .agg(pl.col("stim_level").mean())
- .sort("session", "trial")
- )
- # sns.catplot(data=df_plot.to_pandas(), x='condition', y='stim_level', hue='dbs',
- # row="subj", kind="point", palette='Accent', order=['rest','regulate'], sharey=False,
- # height=2, aspect=1.5, markersize=3).set(ylabel='stim level')
- g = sns.FacetGrid(
- df_plot.to_pandas(),
- row="subj",
- hue="dbs",
- palette="Set2",
- hue_order=["constant", "increase", "decrease"],
- row_order=["patient1", "patient2"],
- height=2.5,
- aspect=1.5,
- sharey=False,
- )
- g.map(sns.violinplot, "condition", "stim_level", alpha=0.3, width=0.5, inner=None)
- g.map(sns.pointplot, "condition", "stim_level", markersize=3)
- g.add_legend(title="DBS policy")
- g.set_axis_labels("condition", "stim amplitude (mA)")
- g.figure.suptitle("Average stimulation level during test", y=1.05)
- g.set_titles("{row_name}")
- # plt.savefig(f'figures/average_stim_level_testing_session.png', dpi=300, bbox_inches='tight')
- # %%
- # ANOVA test
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(pl.col("subj") == subj)
- model = ols(
- formula="stim_level ~ dbs*condition", data=df_plot_subj.to_pandas()
- ).fit()
- print(f"{subj}:\n", sm.stats.anova_lm(model, typ=2), "\n")
- # from scipy.stats import ttest_ind
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(pl.col("subj") == subj)
- for dbs_cond in ["increase", "decrease"]:
- rest = df_plot_subj.filter(
- (pl.col("dbs") == dbs_cond) & (pl.col("condition") == "rest")
- )["stim_level"].to_numpy()
- regulate = df_plot_subj.filter(
- (pl.col("dbs") == dbs_cond) & (pl.col("condition") == "regulate")
- )["stim_level"].to_numpy()
- if len(rest) > 0 and len(regulate) > 0:
- t_stat, p_value = ttest_ind(rest, regulate, equal_var=True)
- # Calculate Cohen's d for independent samples
- n1 = len(rest)
- n2 = len(regulate)
- df_val = n1 + n2 - 2
- mean_rest = rest.mean()
- mean_regulate = regulate.mean()
- pooled_std = np.sqrt(((n1 - 1) * np.var(rest, ddof=1) + (n2 - 1) * np.var(regulate, ddof=1)) / df_val)
- cohens_d = (mean_regulate - mean_rest) / pooled_std if pooled_std > 0 else np.nan
- print(
- f"{subj}, dbs={dbs_cond}: t-test rest vs regulate: t = {t_stat:.3f}, p = {p_value}, df = {df_val}, cohen's d = {cohens_d:.3f}"
- )
- else:
- print(f"{subj}, dbs={dbs_cond}: Not enough data for t-test")
- # %% [markdown]
- # ### Supplementary analyses
- # %%
- df_plot = (
- df_rcs_adaptive_testing_condition.group_by(
- "subj", "session", "dbs", "condition", "trial"
- )
- .agg(pl.col("input_log").mean())
- .filter(pl.col("trial") <= 40)
- )
- # with violin plot
- g = sns.FacetGrid(
- df_plot.to_pandas(),
- col="subj",
- hue="condition",
- palette="Accent",
- height=2,
- aspect=1.4,
- hue_order=["regulate", "rest"],
- sharey=False,
- )
- g.map(
- sns.violinplot,
- "dbs",
- "input_log",
- alpha=0.3,
- width=0.5,
- inner=None,
- order=["constant", "increase", "decrease"],
- )
- g.map(sns.pointplot, "dbs", "input_log", alpha=1, markersize=3, capsize=0.1, lw=1)
- g.add_legend()
- g.set_titles("{col_name}")
- g.set_axis_labels("DBS policy", "beta power (log)")
- g.fig.suptitle("Cortical beta power during testing sessions", y=1.05)
- plt.savefig("figures/testing_session_beta_power.png", dpi=300, bbox_inches="tight")
- # %%
- # ANOVA test
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(pl.col("subj") == subj)
- model = ols(
- formula="input_log ~ dbs*condition", data=df_plot_subj.to_pandas()
- ).fit()
- print(f"{subj}:\n", sm.stats.anova_lm(model, typ=2), "\n")
- # %%
- # posthoc t-test comparison between regulate and rest under each DBS policy, print out t-test result and Cohen's d
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(
- pl.col("subj") == subj, pl.col("input_log").is_not_null()
- )
- df_pd = df_plot_subj.to_pandas()
- print(f"Posthoc t-test between regulate and rest for {subj}:")
- for dbs_policy in ["constant", "increase", "decrease"]:
- group_reg = (
- df_pd[(df_pd["dbs"] == dbs_policy) & (df_pd["condition"] == "regulate")][
- "input_log"
- ]
- .dropna()
- .values
- )
- group_rest = (
- df_pd[(df_pd["dbs"] == dbs_policy) & (df_pd["condition"] == "rest")][
- "input_log"
- ]
- .dropna()
- .values
- )
- if len(group_reg) > 1 and len(group_rest) > 1:
- t_stat, p_val = ttest_ind(group_reg, group_rest, equal_var=False)
- d = utils.cohens_d(group_reg, group_rest)
- print(f" DBS: {dbs_policy}")
- print(
- f" t({len(group_reg) + len(group_rest) - 2}): {t_stat:.3f}, p = {p_val:.3g}, Cohen's d = {d:.3f}"
- )
- else:
- print(f" DBS: {dbs_policy}")
- print(" Not enough data for t-test")
- print("")
- # %%
- # For each subj, session, trial: time from trial onset to first DBS_state == 'low'
- first_low_times = (
- df_rcs_adaptive_testing_condition.filter(pl.col("DBS_state") == "low")
- .group_by(["subj", "session", "trial", "condition", "dbs"])
- .agg(first_low_time=pl.col("unixtime").min())
- )
- # Merge with trial onset
- trial_onsets = df_rcs_adaptive_testing_condition.group_by(
- ["subj", "session", "trial", "condition", "dbs"]
- ).agg(trial_onset=pl.col("unixtime").min())
- # Join to compute time-to-first-low
- time_to_first_low = (
- first_low_times.join(
- trial_onsets, on=["subj", "session", "trial", "condition", "dbs"]
- )
- .with_columns(
- time_from_onset_to_first_low=pl.col("first_low_time") - pl.col("trial_onset")
- )
- .select(
- ["subj", "session", "trial", "condition", "dbs", "time_from_onset_to_first_low"]
- )
- )
- # %%
- df_plot = time_to_first_low.sort("subj", "session", "trial").filter(
- pl.col("trial") <= 40
- )
- g = sns.FacetGrid(
- df_plot.to_pandas(),
- col="subj",
- hue="condition",
- palette="Accent",
- height=2,
- aspect=1.4,
- hue_order=["regulate", "rest"],
- sharey=False,
- )
- # g.map(sns.violinplot, "dbs", "time_from_onset_to_first_low", alpha=0.3, width=0.5, inner=None, order=['constant', 'increase', 'decrease'])
- g.map(
- sns.pointplot,
- "dbs",
- "time_from_onset_to_first_low",
- alpha=0.8,
- markersize=3,
- capsize=0.1,
- lw=2,
- order=["constant", "increase", "decrease"],
- )
- g.add_legend()
- g.set_titles("{col_name}")
- g.set_axis_labels("DBS policy", "Time (s)")
- g.fig.suptitle("Time used to reach personalized threshold", y=1.05)
- plt.savefig(
- "figures/testing_session_time_to_first_low.png", dpi=300, bbox_inches="tight"
- )
- # %%
- # ANOVA test
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(
- pl.col("subj") == subj, pl.col("time_from_onset_to_first_low").is_not_null()
- )
- model = ols(
- formula="time_from_onset_to_first_low ~ dbs*condition",
- data=df_plot_subj.to_pandas(),
- ).fit()
- print(f"{subj}:\n", sm.stats.anova_lm(model, typ=2), "\n")
- # %%
- # posthoc t-test comparison between regulate and rest under each DBS policy, print out t-test result and Cohen's d
- for subj in ["patient1", "patient2"]:
- df_plot_subj = df_plot.filter(
- pl.col("subj") == subj, pl.col("time_from_onset_to_first_low").is_not_null()
- )
- df_pd = df_plot_subj.to_pandas()
- print(f"Posthoc t-test between regulate and rest for {subj}:")
- for dbs_policy in ["constant", "increase", "decrease"]:
- group_reg = (
- df_pd[(df_pd["dbs"] == dbs_policy) & (df_pd["condition"] == "regulate")][
- "time_from_onset_to_first_low"
- ]
- .dropna()
- .values
- )
- group_rest = (
- df_pd[(df_pd["dbs"] == dbs_policy) & (df_pd["condition"] == "rest")][
- "time_from_onset_to_first_low"
- ]
- .dropna()
- .values
- )
- if len(group_reg) > 1 and len(group_rest) > 1:
- t_stat, p_val = ttest_ind(group_reg, group_rest, equal_var=False)
- d = utils.cohens_d(group_reg, group_rest)
- print(f" DBS: {dbs_policy}")
- print(
- f" t({len(group_reg) + len(group_rest) - 2}): {t_stat:.3f}, p = {p_val:.3g}, Cohen's d = {d:.3f}"
- )
- else:
- print(f" DBS: {dbs_policy}")
- print(" Not enough data for t-test")
- print("")
- # %% [markdown]
- # ## Motor performance data
- # %%
- def read_key_tapping_summary_data(subj, dbs_conditions=["constant", "increase", "decrease"]):
- file = f"data/motor_data/key_tapping_{subj}.csv"
- df = pl.read_csv(file)
- df_filtered = df.filter(pl.col("DBS Condition").is_in(dbs_conditions))
- df_filtered = df_filtered.rename({"DBS Condition": "DBS_Condition"})
- # Add Pre vs. Post Label
- df_filtered = df_filtered.with_columns(
- subj=pl.lit(subj), date=pl.col("Session Date").rank(method="dense")
- )
- if subj == "RCS05": # RCS05 has only one constant pre key tapping and 3 post key tapping (constant, increase, decrease)
- df_filtered = df_filtered.with_columns(
- task_order_num=pl.col("File Name").rank(method="dense").over(["date"])
- ).with_columns(
- task_order_num_max=pl.col("task_order_num").max().over(["date"]),
- task_order=pl.when(pl.col("task_order_num") == 1)
- .then(pl.lit("pre-BCI"))
- .otherwise(pl.lit("post-BCI"))
- )
- elif subj == "RCS15":
- # RCS15 has constant, increase, and decrease pre and post key tapping
- # 2024-10-29 file: (1 pre, 1 post)*3 = 6 files; later files: (1 pre, 1 after block 1, 1 after block 2)*3 = 9 files
- df_filtered = df_filtered.with_columns(
- task_order_num=pl.col("File Name")
- .rank(method="dense")
- .over(["date", "DBS_Condition"])
- ).with_columns(
- task_order_num_max=pl.col("task_order_num").max().over(["date", "DBS_Condition"])
- ).with_columns(
- task_order=pl.when(pl.col("task_order_num") == 1)
- .then(pl.lit("pre-BCI"))
- .when(pl.col("task_order_num") == pl.col("task_order_num_max"))
- .then(pl.lit("post-BCI"))
- .otherwise(pl.lit("middle-BCI"))
- )
- return df_filtered
- # %%
- df_key_tapping_rcs05 = read_key_tapping_summary_data("RCS05")
- df_key_tapping_rcs15 = read_key_tapping_summary_data("RCS15")
- df_key_tapping_all = pl.concat(
- (df_key_tapping_rcs05, df_key_tapping_rcs15)
- ).with_columns(
- subj=pl.col("subj").replace({"RCS05": "patient1", "RCS15": "patient2"}),
- trial_id=(pl.col("date") - 1) * 10 + pl.col("Trial"),
- tapping_speed=1/pl.col("avg_rt")
- )
- df_key_tapping_all
- # %%
- outcome_var = "avg_rt"
- # outcome_var = "Errors"
- # outcome_var = "tapping_speed"
- fig, ax = plt.subplots(1, 2, figsize=(8, 3))
- for i, subj in enumerate(["patient1", "patient2"]):
- df_plot = df_key_tapping_all.filter(
- pl.col("subj") == subj,
- pl.col("DBS_Condition") == "constant",
- pl.col("task_order").is_in(["pre-BCI", "post-BCI"]),
- )
- legend = "full" if subj == "patient2" else False
- # Violin plot (distribution of reaction times)
- sns.violinplot(
- data=df_plot.to_pandas(),
- x="task_order",
- y=outcome_var,
- hue="task_order",
- inner="point",
- inner_kws={"alpha": 0.05},
- palette="Paired",
- legend=legend,
- linewidth=1.2,
- alpha=0.8,
- ax=ax[i],
- )
- sns.lineplot(
- data=df_plot.to_pandas(),
- x="task_order",
- y=outcome_var,
- color="gray",
- units="trial_id",
- alpha=0.1,
- estimator=None,
- ax=ax[i],
- )
- # Overlay point plot (mean reaction times with standard error)
- sns.pointplot(
- data=df_plot.to_pandas(),
- x="task_order",
- y=outcome_var,
- estimator="mean",
- color="black",
- alpha=0.5,
- markers="o",
- markersize=5,
- lw=2,
- capsize=0.1,
- ax=ax[i],
- )
- ax[i].set_title(subj, fontsize=12, fontweight="bold")
- ax[i].set_xlabel("", fontsize=12)
- # Titles and labels
- if outcome_var == "avg_rt":
- # ax[i].set_ylim(None, 0.4)
- if subj == "patient1":
- ax[i].set_ylabel("inter-tap interval (s)", fontsize=12)
- else:
- ax[i].set_ylabel(None, fontsize=12)
- elif outcome_var == "Errors":
- ax[i].set_ylim(None, 3)
- if subj == "patient1":
- ax[i].set_ylabel("number of errors", fontsize=12)
- else:
- ax[i].set_ylabel(None, fontsize=12)
- sns.move_legend(ax[1], "center left", bbox_to_anchor=(1, 0.5), title="Timing")
- plt.suptitle("Key tapping performance", y=1.03, fontsize=14, fontweight="bold")
- # plt.savefig(f"figures/key_tapping_{outcome_var}_constantDBS.png", dpi=300, bbox_inches="tight")
- # %%
- # Run t-test comparing outcome_var between task_order for Patient 1 and Patient 2 separately
- outcome_var = "avg_rt"
- for subj in ["patient1", "patient2"]:
- df_subj = df_key_tapping_all.filter(
- pl.col("subj") == subj,
- pl.col("DBS_Condition") == "constant",
- ).sort("Session Number", "Trial")
- group1_vals = df_subj.filter(pl.col("task_order") == "pre-BCI")[outcome_var].to_numpy()
- group2_vals = df_subj.filter(pl.col("task_order") == "post-BCI")[outcome_var].to_numpy()
- # Paired t-test using group1_vals and group2_vals (assuming order is matched)
- if len(group1_vals) == len(group2_vals) and len(group1_vals) > 0:
- tstat_paired, pval_paired = ttest_rel(group1_vals, group2_vals, nan_policy='omit')
- n_paired = len(group1_vals)
- df_paired = n_paired - 1
- mean1_paired, mean2_paired = group1_vals.mean(), group2_vals.mean()
- diff = group1_vals - group2_vals
- pooled_sd_paired = diff.std(ddof=1)
- cohend_paired = (mean1_paired - mean2_paired) / pooled_sd_paired if pooled_sd_paired != 0 else np.nan
- print(f"{subj}: Paired t-test between pre-BCI and post-BCI for '{outcome_var}': t={tstat_paired:.3f}, p={pval_paired:.3g}, df={df_paired}, Cohen's d={cohend_paired:.3f}")
- elif len(group1_vals) != len(group2_vals):
- print(f"{subj}: Cannot run paired t-test; groups have unequal length ({len(group1_vals)} vs {len(group2_vals)}).")
analysis.ipynb at commit b2b11d5, no license · at the source
Overview
- Department of Neurology, University of California, San Francisco
- Department of Psychology, University of California, San Diego
- Department of Neurological Surgery, University of California, San Francisco
- Department of Neurological Surgery, University of Washington
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
tepzhang/volitional_DBS
b2b11d54e1dab1d173ace3dd004af95761ba7db2, 20 March 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
3 files
- analysis.ipynb, Jupyter, 1,181 lines, 2 matches
- key_tapping_task/
key_tapping_v3.py , Python, 48 lines - utils.py, Python, 69 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 3 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Code and data availability statement
The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: tepzhang/
volitional_DBS
Read it in the paper: doi.org/10.64898/2026.08.12.26350419.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, journal, dates, 6 authors, 1 funder, 35 references.
Cite
This paper
Zhang, J.-X., Suh, J., Daniel, P., Starr, P., Herron, J., & Little, S. (2026). Volitional deep brain stimulation following brain-computer interface training for Parkinson’s disease. medRxiv (preprint). https://
BibTeX
@article{zhang2026voliti
author = {Zhang, Jin-Xiao and Suh, Jiyeon and Daniel, Pria and Starr, Philip and Herron, Jeffrey and Little, Simon},
title = {{Volitional deep brain stimulation following brain-computer interface training for Parkinson’s disease}},
journal = {medRxiv (preprint)},
year = {2026},
month = aug,
publisher = {medRxiv},
doi = {10.64898/
url = {https://
}
RIS
TY - JOUR
AU - Zhang, Jin-Xiao
AU - Suh, Jiyeon
AU - Daniel, Pria
AU - Starr, Philip
AU - Herron, Jeffrey
AU - Little, Simon
TI - Volitional deep brain stimulation following brain-computer interface training for Parkinson’s disease
T2 - medRxiv (preprint)
J2 - medRxiv
PY - 2026
DA - 2026/
PB - medRxiv
DO - 10.64898/
UR - https://
ER -
CSL-JSON
{
"id": "10.64898/
"type": "article",
"title": "Volitional deep brain stimulation following brain-computer interface training for Parkinson’s disease",
"container-title": "medRxiv (preprint)",
"author": [
{
"family": "Zhang",
"given": "Jin-Xiao"
},
{
"family": "Suh",
"given": "Jiyeon"
},
{
"family": "Daniel",
"given": "Pria"
},
{
"family": "Starr",
"given": "Philip"
},
{
"family": "Herron",
"given": "Jeffrey"
},
{
"family": "Little",
"given": "Simon"
}
],
"container-title-short":
"DOI": "10.64898/
"publisher": "medRxiv",
"URL": "https://
"issued": {
"date-parts": [
[
2026,
8,
14
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1016/j.ebiom.2026.106293 [code]
- Dynamic neural states underpin motor symptom severity in Parkinson's disease: a longitudinal analysis of chronic cortico-subthalamic nucleus recordings.Journal: EBioMedicineIn common: statsmodels, seaborn, SciPy, 2 other tools, Parkinson's, 5 references
- [2] doi:10.1038/s41591-026-04432-4 [code]
- Activity-dependent adaptive deep brain stimulation improves gait in Parkinson's disease.Journal: Nature medicineIn common: SciPy, Matplotlib, NumPy, Parkinson's, clinical / translational, 5 references
- [3] doi:10.1038/s41591-026-04434-2 [code]
- Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial.Journal: Nature medicineIn common: SciPy, Matplotlib, NumPy, Parkinson's, clinical / translational, 4 references
- [4] doi:10.1038/s41467-026-70633-7 [code]
- Global coincident bursts of high frequency oscillations across the human cortex coordinate large-scale memory processing.Journal: Nature communicationsIn common: statsmodels, seaborn, SciPy, 2 other tools, 2 references
- [5] doi:10.1038/s41593-026-02228-w [code]
- Circuit response to neuromodulation characterized with simultaneous deep brain stimulation and precision neuroimaging in humans.Journal: Nature neuroscienceIn common: statsmodels, seaborn, SciPy, 2 other tools, Parkinson's, 1 reference
- [6] doi:10.1038/s41531-026-01531-4 [code]
- Inconsistent subthalamic local field potential beta activity amid in- and antiphasic neuronal bursts.Journal: NPJ Parkinson's diseaseIn common: SciPy, Matplotlib, NumPy, Parkinson's, clinical / translational, 2 references
- [7] doi:10.1017/s0033291726104103 [code]
- Linking brain structure to stress reactivity: cingulate surface area predicts acute cortisol responses.Journal: Psychological medicineIn common: statsmodels, seaborn, SciPy, 2 other tools, 1 reference
- [8] doi:10.1162/imag.a.1226 [code]
- A neuroscientist's guide to neural burst detection.Journal: Imaging neuroscience (Cambridge, Mass.)In common: statsmodels, seaborn, SciPy, 2 other tools, 1 reference
- [9] doi:10.1038/s43856-026-01606-6 [code]
- Validation of remote multimodal AI screening for Parkinson disease across diverse settings.Journal: Communications medicineIn common: statsmodels, seaborn, SciPy, 2 other tools, Parkinson's, clinical / translational
- [10] doi:10.1038/s41531-026-01380-1 [code]
- Identifying maximal beta power from directional subthalamic local field potentials in Parkinson's disease.Journal: NPJ Parkinson's diseaseIn common: statsmodels, seaborn, SciPy, 2 other tools, Parkinson's, clinical / translational
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 3 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:e8d36a13e01893bf…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
