Assessing adverse effects and unspecific effects of transcutaneous spinal direct current stimulation (tsDCS).
5 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 5 matches
- [1] § Materials and Methods › Data processing › UEs › Respiratory activity ↔ UE_analysis_4_respiration.py, lines 4 to 63 · score 0.94 · representing maximum inhalation, breathing cycle, consecutive breaths, standard deviation, breathing rate variability, signal minima · block
oscr:b:QFNRK8CWEHRFQ-6· Report a mismatch - [2] § Materials and Methods › Data processing › UEs › Skin conductance fluctuations (SCF) ↔ UE_analysis_2_SCF.py, lines 4 to 63 · score 0.90 · Butterworth bandpass, baseline signal, skin conductance, SCF, 0.0159 Hz, quantified · block
oscr:b:F6CGQRWZW3028-8· Report a mismatch - [3] § Materials and Methods › Data processing › UEs › Electrocardiographic (ECG) activity ↔ UE_analysis_3_ECG.py, lines 4 to 73 · score 0.76 · heart beats, heart rate variability, py, square, root, ecg · block
oscr:b:JWSQE6AGAN4G9-S· Report a mismatch - [4] § Materials and Methods › Statistical analysis › UEs ↔ UE_analysis_5_outlier.py, lines 4 to 28 · score 0.75 · abnormal signal fluctuations, participants autonomic, inadvertently, instructed, administration, tsDCS · block
oscr:b:44002FK1NXXRS-T· Report a mismatch - [5] § Materials and Methods › Data processing › UEs › Electrocardiographic (ECG) activity ↔ UE_analysis_1_prep.py, lines 4 to 68 · score 0.62 · Pan Tompkins Algorithm, beats, ecg, peaks · block
oscr:b:E8F7YV9HN30SR-J· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 480 lines · 22 KB · no license · 1 match
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Description:
- ------------
- This script analyzes the respiratory activity.
- First we cut the data according to the information saved using a_tsdcs_UE_analysis_prep.py.
- The time points that mark the beginning of a new breathing cycle are automatically detected
- as signal minima represent maximum inhalation.
- We then extract the breathing rate (breaths per minute) and breathing rate variability
- (standard deviation of the interval between consecutive breaths) over the whole interval
- and within the 4 quartiles.
- In the unblinding step the session-condition mapping is read and
- outliers are excluded. The resulting table BR_BDev_unblind.csv can be used
- for statistical analysis and further plotting.
- The within-subject plots (fig 4D and 4E) are created.
- Additionally, an interaction plot (fig 4F) is created.
- Authors:
- --------
- Ulrike Horn
- Contact:
- --------
- [email hidden]
- Date:
- -----
- 20th November 2023
- """
- import mne
- import numpy as np
- import pandas as pd
- import os
- import glob
- import json
- from scipy import signal, stats
- import matplotlib as mpl
- mpl.use('TkAgg')
- import matplotlib.pyplot as plt
- import seaborn as sns
- raw_path = '/data/pt_02582/tsDCS_BIDS/'
- output_path = '/data/pt_02582/tsDCS_processed/'
- result_path = '/data/pt_02582/tsDCS_results/Resp/'
- if not os.path.exists(output_path):
- os.makedirs(output_path)
- if not os.path.exists(result_path):
- os.makedirs(result_path)
- new_sr = 100 # Hz that data will be downsampled to
- tasks = ['tsDCS']
- subjects = ['SR01', 'SR02', 'SR03', 'SR04', 'SR05', 'SR06', 'SR07', 'SR08', 'SR09', 'SR10',
- 'SR11', 'SR12', 'SR13', 'SR14', 'SR15', 'SR16', 'SR17', 'SR18', 'SR19', 'SR20']
- sessions = [1, 2, 3]
- preprocess = True
- save_markers = True
- unblinding = True
- within_sub_plot = True
- interaction_plot = True
- np.random.seed(1990) # for jitter
- color_blue = [0, 128/255, 255/255]
- color_red = [227/255, 0, 15/255]
- color_orange = [239/255, 138/255, 16/255]
- new_rc_params = {"font.family": 'Arial', "font.size": 12, "font.serif": [],
- "svg.fonttype": 'none'}
- mpl.rcParams.update(new_rc_params)
- bpm_all = []
- dev_all = []
- bpm_Q1 = []
- dev_Q1 = []
- bpm_Q2 = []
- dev_Q2 = []
- bpm_Q3 = []
- dev_Q3 = []
- bpm_Q4 = []
- dev_Q4 = []
- for isub in subjects:
- sub = 'sub-' + isub
- print('subject {}'.format(isub))
- for ses in sessions:
- for task in tasks:
- physio_files = glob.glob(raw_path + sub + os.sep + 'ses-' + str(ses) + os.sep + 'beh' + os.sep + '*' + task + '*_emg.vhdr')
- physio_files = np.array(sorted(physio_files))
- if len(physio_files) > 1:
- print('Warning! More than one file found!')
- sub_out_path = output_path + sub + os.sep + 'ses-' + str(ses) + os.sep + 'Resp'
- if not os.path.exists(sub_out_path):
- os.makedirs(sub_out_path)
- if preprocess:
- p = physio_files[0]
- # import raw data with MNE
- raw = mne.io.read_raw_brainvision(p, preload=True)
- sr = raw.info['sfreq']
- # pick respiration channel
- raw.pick_channels(ch_names=["RES"])
- # get events file
- tmp = p.split('_emg')
- event_file = tmp[0] + '_events.tsv'
- events = pd.read_table(event_file, sep='\t')
- # cut data from manually inserted event
- onset = events.loc[events['value'] == 'manual', 'onset'].values[0]
- duration = events.loc[events['value'] == 'manual', 'duration'].values[0]
- if onset + duration >= len(raw) / sr:
- raw.crop(tmin=onset, tmax=None, include_tmax=True)
- else:
- raw.crop(tmin=onset, tmax=onset + duration, include_tmax=True)
- raw_plot = raw.get_data() # convert object to numpy array of shape (n_channels, n_times)
- raw_plot = np.squeeze(raw_plot) # get rid of dimension "n_channels" -> (rows: time points)
- # inhalation starts = min peaks, so invert data
- raw_plot = 1 - raw_plot
- median_height = np.median(raw_plot)
- inhale_peaks, properties = signal.find_peaks(raw_plot, height=median_height, distance=1.0 * sr, width=0.5 * sr)
- # how many breaths per minute?
- bpm = len(inhale_peaks) / (len(raw_plot) / sr / 60)
- bpm_all.append(bpm)
- # how much deviation is in the peaks
- dev = np.std(np.diff(inhale_peaks))/sr
- dev_all.append(dev)
- # same for 5 minute blocks
- len_quart = int(np.floor(len(raw_plot)/4))
- inhale_peaks_1 = np.delete(inhale_peaks, inhale_peaks > len_quart)
- bpm_1 = len(inhale_peaks_1) / ((len(raw_plot)/4) / sr / 60)
- bpm_Q1.append(bpm_1)
- dev_1 = np.std(np.diff(inhale_peaks_1)) / sr
- dev_Q1.append(dev_1)
- inhale_peaks_2 = np.delete(inhale_peaks, (inhale_peaks < len_quart) | (inhale_peaks > 2 * len_quart))
- bpm_2 = len(inhale_peaks_2) / ((len(raw_plot) / 4) / sr / 60)
- bpm_Q2.append(bpm_2)
- dev_2 = np.std(np.diff(inhale_peaks_2)) / sr
- dev_Q2.append(dev_2)
- inhale_peaks_3 = np.delete(inhale_peaks, (inhale_peaks < 2 * len_quart) | (inhale_peaks > 3 * len_quart))
- bpm_3 = len(inhale_peaks_3) / ((len(raw_plot) / 4) / sr / 60)
- bpm_Q3.append(bpm_3)
- dev_3 = np.std(np.diff(inhale_peaks_3)) / sr
- dev_Q3.append(dev_3)
- inhale_peaks_4 = np.delete(inhale_peaks, inhale_peaks < 3 * len_quart)
- bpm_4 = len(inhale_peaks_4) / ((len(raw_plot) / 4) / sr / 60)
- bpm_Q4.append(bpm_4)
- dev_4 = np.std(np.diff(inhale_peaks_4)) / sr
- dev_Q4.append(dev_4)
- if save_markers:
- rep_subjects = subjects * 3
- rep_subjects_prefix = ['sub-' + subject for subject in rep_subjects]
- markers = pd.DataFrame({'BPM': bpm_all, 'BDev': dev_all,
- 'BPM_Q1': bpm_Q1, 'BPM_Q2': bpm_Q2, 'BPM_Q3': bpm_Q3, 'BPM_Q4': bpm_Q4,
- 'BDev_Q1': dev_Q1, 'BDev_Q2': dev_Q2, 'BDev_Q3': dev_Q3, 'BDev_Q4': dev_Q4,
- 'Subject': rep_subjects_prefix,
- 'Session': np.resize(np.arange(1, 4), len(subjects)*3)})
- markers.to_csv(result_path + 'BPM.csv', sep=',', index=False)
- if unblinding:
- def adjust_box_widths(g, fac):
- """
- Adjust the withs of a seaborn-generated boxplot.
- """
- # iterating through Axes instances
- for ax in g.axes:
- # iterating through axes artists:
- for c in ax.get_children():
- # searching for PathPatches
- if isinstance(c, PathPatch):
- # getting current width of box:
- p = c.get_path()
- verts = p.vertices
- verts_sub = verts[:-1]
- xmin = np.min(verts_sub[:, 0])
- xmax = np.max(verts_sub[:, 0])
- xmid = 0.5 * (xmin + xmax)
- xhalf = 0.5 * (xmax - xmin)
- # setting new width of box
- xmin_new = xmid - fac * xhalf
- xmax_new = xmid + fac * xhalf
- verts_sub[verts_sub[:, 0] == xmin, 0] = xmin_new
- verts_sub[verts_sub[:, 0] == xmax, 0] = xmax_new
- # setting new width of median line
- for l in ax.lines:
- if np.all(l.get_xdata() == [xmin, xmax]):
- l.set_xdata([xmin_new, xmax_new])
- df = pd.read_csv(result_path + 'BPM.csv', sep=',', header=0)
- rand_df = pd.read_csv('/data/pt_02582/tsDCS_BIDS/participants.tsv', sep='\t')
- def replace_cond(row):
- this_sub = row['Subject']
- this_rand = rand_df[rand_df['participant_id'] == this_sub]
- if row['Session'] == 1:
- val = this_rand['condition_ses-1'].values[0]
- elif row['Session'] == 2:
- val = this_rand['condition_ses-2'].values[0]
- elif row['Session'] == 3:
- val = this_rand['condition_ses-3'].values[0]
- else:
- print('something weird happened')
- return val
- df['Condition'] = df.apply(replace_cond, axis=1)
- # exclude the subjects' sessions that we decided on:
- df.loc[(df['Subject'] == 'sub-SR01') & (df['Session'] == 2), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR08') & (df['Session'] == 2), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR09'), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR10') & (df['Session'] == 3), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR13'), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR14'), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR16') & (df['Session'] == 3), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR17') & (df['Session'] == 3), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- df.loc[(df['Subject'] == 'sub-SR19') & (df['Session'] == 1), ['BPM', 'BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev', 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4']] = np.nan
- # make a plot
- sns.set_context("talk")
- hue_order = ['A', 'C', 'B']
- fig, axes = plt.subplots(2, 1)
- fig.suptitle('Breathing rate and breathing rate variability', fontsize=16)
- sns.boxplot(df, x='Condition', y='BPM', order=hue_order,
- ax=axes[0], boxprops={'alpha': 0.4}, showfliers=False)
- sns.stripplot(data=df, x="Condition", y="BPM", order=hue_order, hue='Condition', hue_order=hue_order,
- dodge=False, ax=axes[0])
- handles, labels = axes[0].get_legend_handles_labels()
- axes[0].legend(handles=handles, labels=['A (Anodal)', 'C (Cathodal)', 'B (Sham)'], loc='upper right')
- sns.boxplot(df, x='Condition', y='BDev', order=hue_order,
- ax=axes[1], boxprops={'alpha': 0.4}, showfliers=False)
- sns.stripplot(data=df, x="Condition", y="BDev", order=hue_order, hue='Condition', hue_order=hue_order,
- dodge=False, ax=axes[1], legend=False)
- handles, labels = axes[0].get_legend_handles_labels()
- plt.show()
- # create tables for the stats
- df = df.drop(['Session'], axis=1)
- wide_df = df.pivot(index='Subject', columns='Condition', values=['BPM', 'BDev', 'BPM_Q1',
- 'BPM_Q2', 'BPM_Q3', 'BPM_Q4',
- 'BDev_Q1', 'BDev_Q2', 'BDev_Q3', 'BDev_Q4'])
- wide_df.columns = ['_'.join(col).strip() for col in wide_df.columns.values]
- wide_df.reset_index('Subject', inplace=True)
- wide_df.to_csv(result_path + 'BPM_BDev_unblind.csv', sep=',', index=None)
- if within_sub_plot:
- df = pd.read_csv(result_path + 'BPM_BDev_unblind.csv', sep=',')
- # 1. Breathing rate BPM
- # cathodal comparison
- cathodal = df.drop(labels=['BPM_A', 'BDev_A', 'BDev_B', 'BDev_C',
- 'BPM_Q1_A', 'BPM_Q2_A', 'BPM_Q3_A', 'BPM_Q4_A',
- 'BDev_Q1_A', 'BDev_Q2_A', 'BDev_Q3_A', 'BDev_Q4_A'
- ], axis=1)
- cathodal.dropna(axis=0, inplace=True)
- cathodal.reset_index(inplace=True, drop=True)
- cathodal.drop('Subject', axis=1, inplace=True)
- sns.set_context("poster")
- sns.set_style("white")
- jitter = 0.05
- df_x_jitter = pd.DataFrame(np.random.normal(loc=0, scale=jitter, size=(cathodal.values.shape[0], 2)),
- columns=['Sham', 'Cathodal'])
- df_x_jitter += np.arange(2)
- fig, ax = plt.subplots(1, 2, figsize=(12, 8), sharey=True)
- fig.suptitle("Breathing rate", fontsize=30)
- b = sns.boxplot(ax=ax[0], x=np.repeat(0, len(cathodal)), y=cathodal['BPM_B'], color=color_blue, width=0.5,
- native_scale=True, showfliers=False)
- for patch in b.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- c = sns.boxplot(ax=ax[0], x=np.repeat(1, len(cathodal)), y=cathodal['BPM_C'], color=color_red, width=0.5,
- native_scale=True, showfliers=False)
- for patch in c.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- df_sham = pd.DataFrame({'jitter': df_x_jitter['Sham'], 'bpm': cathodal['BPM_B']})
- df_cath = pd.DataFrame({'jitter': df_x_jitter['Cathodal'], 'bpm': cathodal['BPM_C']})
- sns.scatterplot(ax=ax[0], data=df_sham, x='jitter', y='bpm', color=color_blue, zorder=100, edgecolor="black")
- sns.scatterplot(ax=ax[0], data=df_cath, x='jitter', y='bpm', color=color_red, zorder=100, edgecolor="black")
- ax[0].set_xticks(range(2))
- ax[0].set_xticklabels(['Sham', 'Cathodal'])
- ax[0].tick_params(axis='x', which='major', labelsize=25)
- ax[0].set_xlim(-1.0, 2)
- sns.despine()
- ax[0].set_xlabel('')
- ax[0].set_ylabel('Breaths per minute', fontsize=25)
- plt.subplots_adjust(bottom=0.2, left=0.15)
- ax[0].set_title('Cathodal', fontsize=25)
- for idx in cathodal.index:
- ax[0].plot(df_x_jitter.loc[idx, ['Sham', 'Cathodal']], cathodal.loc[idx, ['BPM_B', 'BPM_C']], color='grey',
- linewidth=0.5, linestyle='--', zorder=-1)
- # anodal comparison
- anodal = df.drop(labels=['BPM_C', 'BDev_A', 'BDev_B', 'BDev_C',
- 'BPM_Q1_C', 'BPM_Q2_C', 'BPM_Q3_C', 'BPM_Q4_C',
- 'BDev_Q1_C', 'BDev_Q2_C', 'BDev_Q3_C', 'BDev_Q4_C'
- ], axis=1)
- anodal.dropna(axis=0, inplace=True)
- anodal.reset_index(inplace=True, drop=True)
- anodal.drop('Subject', axis=1, inplace=True)
- df_x_jitter = pd.DataFrame(np.random.normal(loc=0, scale=jitter, size=(anodal.values.shape[0], 2)),
- columns=['Sham', 'Anodal'])
- df_x_jitter += np.arange(2)
- b = sns.boxplot(ax=ax[1], x=np.repeat(0, len(anodal)), y=anodal['BPM_B'], color=color_blue, width=0.5,
- native_scale=True, showfliers=False)
- for patch in b.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- c = sns.boxplot(ax=ax[1], x=np.repeat(1, len(anodal)), y=anodal['BPM_A'], color=color_orange, width=0.5,
- native_scale=True, showfliers=False)
- for patch in c.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- df_sham = pd.DataFrame({'jitter': df_x_jitter['Sham'], 'bpm': anodal['BPM_B']})
- df_anod = pd.DataFrame({'jitter': df_x_jitter['Anodal'], 'bpm': anodal['BPM_A']})
- sns.scatterplot(ax=ax[1], data=df_sham, x='jitter', y='bpm', color=color_blue, zorder=100, edgecolor="black")
- sns.scatterplot(ax=ax[1], data=df_anod, x='jitter', y='bpm', color=color_orange, zorder=100, edgecolor="black")
- ax[1].set_xticks(range(2))
- ax[1].set_xticklabels(['Sham', 'Anodal'])
- ax[1].tick_params(axis='x', which='major', labelsize=25)
- ax[1].set_xlim(-1.0, 2)
- sns.despine()
- ax[1].set_xlabel('')
- ax[1].set_ylabel('Breaths per minute', fontsize=25)
- plt.subplots_adjust(bottom=0.2, left=0.15)
- ax[1].set_title('Anodal', fontsize=25)
- for idx in anodal.index:
- ax[1].plot(df_x_jitter.loc[idx, ['Sham', 'Anodal']], anodal.loc[idx, ['BPM_B', 'BPM_A']], color='grey',
- linewidth=0.5, linestyle='--', zorder=-1)
- plt.savefig(result_path + 'BR_within_sub.png')
- plt.show()
- # 2. Breathing rate variability HRV
- # cathodal comparison
- cathodal = df.drop(labels=['BDev_A', 'BPM_A', 'BPM_B', 'BPM_C',
- 'BPM_Q1_A', 'BPM_Q2_A', 'BPM_Q3_A', 'BPM_Q4_A',
- 'BDev_Q1_A', 'BDev_Q2_A', 'BDev_Q3_A', 'BDev_Q4_A'
- ], axis=1)
- cathodal.dropna(axis=0, inplace=True)
- cathodal.reset_index(inplace=True, drop=True)
- cathodal.drop('Subject', axis=1, inplace=True)
- sns.set_context("poster")
- sns.set_style("white")
- jitter = 0.05
- df_x_jitter = pd.DataFrame(np.random.normal(loc=0, scale=jitter, size=(cathodal.values.shape[0], 2)),
- columns=['Sham', 'Cathodal'])
- df_x_jitter += np.arange(2)
- fig, ax = plt.subplots(1, 2, figsize=(12, 8), sharey=True)
- fig.suptitle("Breathing rate variability", fontsize=30)
- b = sns.boxplot(ax=ax[0], x=np.repeat(0, len(cathodal)), y=cathodal['BDev_B'], color=color_blue, width=0.5,
- native_scale=True, showfliers=False)
- for patch in b.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- c = sns.boxplot(ax=ax[0], x=np.repeat(1, len(cathodal)), y=cathodal['BDev_C'], color=color_red, width=0.5,
- native_scale=True, showfliers=False)
- for patch in c.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- df_sham = pd.DataFrame({'jitter': df_x_jitter['Sham'], 'bdev': cathodal['BDev_B']})
- df_cath = pd.DataFrame({'jitter': df_x_jitter['Cathodal'], 'bdev': cathodal['BDev_C']})
- sns.scatterplot(ax=ax[0], data=df_sham, x='jitter', y='bdev', color=color_blue, zorder=100, edgecolor="black")
- sns.scatterplot(ax=ax[0], data=df_cath, x='jitter', y='bdev', color=color_red, zorder=100, edgecolor="black")
- ax[0].set_xticks(range(2))
- ax[0].set_xticklabels(['Sham', 'Cathodal'])
- ax[0].tick_params(axis='x', which='major', labelsize=25)
- ax[0].set_xlim(-1.0, 2)
- sns.despine()
- ax[0].set_xlabel('')
- ax[0].set_ylabel('SD of breath intervals', fontsize=25)
- plt.subplots_adjust(bottom=0.2, left=0.15)
- ax[0].set_title('Cathodal', fontsize=25)
- for idx in cathodal.index:
- ax[0].plot(df_x_jitter.loc[idx, ['Sham', 'Cathodal']], cathodal.loc[idx, ['BDev_B', 'BDev_C']], color='grey',
- linewidth=0.5, linestyle='--', zorder=-1)
- # anodal comparison
- anodal = df.drop(labels=['BDev_C', 'BPM_A', 'BPM_B', 'BPM_C',
- 'BPM_Q1_C', 'BPM_Q2_C', 'BPM_Q3_C', 'BPM_Q4_C',
- 'BDev_Q1_C', 'BDev_Q2_C', 'BDev_Q3_C', 'BDev_Q4_C'
- ], axis=1)
- anodal.dropna(axis=0, inplace=True)
- anodal.reset_index(inplace=True, drop=True)
- anodal.drop('Subject', axis=1, inplace=True)
- df_x_jitter = pd.DataFrame(np.random.normal(loc=0, scale=jitter, size=(anodal.values.shape[0], 2)),
- columns=['Sham', 'Anodal'])
- df_x_jitter += np.arange(2)
- b = sns.boxplot(ax=ax[1], x=np.repeat(0, len(anodal)), y=anodal['BDev_B'], color=color_blue, width=0.5,
- native_scale=True, showfliers=False)
- for patch in b.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- c = sns.boxplot(ax=ax[1], x=np.repeat(1, len(anodal)), y=anodal['BDev_A'], color=color_orange, width=0.5,
- native_scale=True, showfliers=False)
- for patch in c.patches:
- r, g, b, a = patch.get_facecolor()
- patch.set_facecolor((r, g, b, 0.7))
- df_sham = pd.DataFrame({'jitter': df_x_jitter['Sham'], 'bdev': anodal['BDev_B']})
- df_anod = pd.DataFrame({'jitter': df_x_jitter['Anodal'], 'bdev': anodal['BDev_A']})
- sns.scatterplot(ax=ax[1], data=df_sham, x='jitter', y='bdev', color=color_blue, zorder=100, edgecolor="black")
- sns.scatterplot(ax=ax[1], data=df_anod, x='jitter', y='bdev', color=color_orange, zorder=100, edgecolor="black")
- ax[1].set_xticks(range(2))
- ax[1].set_xticklabels(['Sham', 'Anodal'])
- ax[1].tick_params(axis='x', which='major', labelsize=25)
- ax[1].set_xlim(-1.0, 2)
- sns.despine()
- ax[1].set_xlabel('')
- ax[1].set_ylabel('SD of breath intervals', fontsize=25)
- plt.subplots_adjust(bottom=0.2, left=0.15)
- ax[1].set_title('Anodal', fontsize=25)
- for idx in anodal.index:
- ax[1].plot(df_x_jitter.loc[idx, ['Sham', 'Anodal']], anodal.loc[idx, ['BDev_B', 'BDev_A']], color='grey',
- linewidth=0.5, linestyle='--', zorder=-1)
- plt.savefig(result_path + 'BRV_within_sub.png')
- plt.show()
- if interaction_plot:
- df = pd.read_csv(result_path + 'BPM_BDev_unblind.csv', sep=',')
- # breathing rate
- br = df[df.columns.drop(list(df.filter(regex='BDev_')))]
- br = br[br.columns.drop(['BPM_A', 'BPM_B', 'BPM_C'])]
- df_q_long = pd.wide_to_long(br, stubnames=['BPM_Q1', 'BPM_Q2', 'BPM_Q3', 'BPM_Q4'], i='Subject', j='condition',
- sep='_', suffix=r'\w+').reset_index()
- df_q_longer = pd.wide_to_long(df_q_long, stubnames=['BPM'], i=['Subject', 'condition'], j='Quartile',
- sep='_Q', suffix=r'\w+').reset_index()
- sns.set_context("poster")
- sns.set_style("white")
- fig, ax = plt.subplots(1, 1, figsize=(12, 8))
- fig.suptitle("Breathing rate over time", fontsize=30)
- sns.lineplot(data=df_q_longer, x='Quartile', y='BPM', hue='condition', palette=[color_blue, color_red, color_orange],
- hue_order=['B', 'C', 'A'], errorbar='se')
- handles, labels = ax.get_legend_handles_labels()
- ax.xaxis.get_major_locator().set_params(integer=True)
- plt.ylim(14, 19)
- sns.despine()
- plt.subplots_adjust(bottom=0.2, left=0.15)
- ax.set_ylabel('Quartile', fontsize=25)
- ax.set_ylabel('Breaths per minute', fontsize=25)
- plt.legend(handles=handles, labels=['Sham', 'Cathodal', 'Anodal'])
- plt.savefig(result_path + 'BR_Quartile_interaction.png')
- plt.show()
UE_analysis_4_respiration.py at commit 3cbcf57, no license · at the source
Overview
- Max Planck Research Group Pain Perception, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany
- Methods and Development Group Nuclear Magnetic Resonance, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany
- Experimental Psychology and Methods, Wilhelm Wundt Institute for Psychology, Leipzig University, Leipzig, Germany
- Cognitive and Biological Psychology, Wilhelm Wundt Institute for Psychology, Leipzig University, Leipzig, Germany
- Lise Meitner Research Group Cognition and Plasticity, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany
Abstract
Transcutaneous spinal direct current stimulation (tsDCS) is a relatively recent method for non-invasively modulating neural activity in the spinal cord. Despite its growing prominence, comprehensive studies addressing its potential adverse effects (AEs) and unspecific effects (UEs) are lacking. In this study, we conducted a systematic investigation of the potential AEs and UEs of tsDCS in healthy volunteers (N=
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 5 matches between paragraphs and lines of code.
eippertlab/tsdcs-sideeffects
3cbcf57529a400c7cc0b462dd7ebc68b289c2dc2, 25 June 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
11 files
- AE_analysis_figure1.m, MATLAB, 41 lines
- AE_analysis_figure2.m, MATLAB, 65 lines
- AE_analysis_figure3.py, Python, 134 lines
- AE_analysis_figureS2.m, MATLAB, 42 lines
- UE_analysis_1_prep.py, Python, 230 lines, 1 match
- UE_analysis_2_SCF.py, Python, 346 lines, 1 match
- UE_analysis_3_ECG.py, Python, 514 lines, 1 match
- UE_analysis_4_respiratio
n.py , Python, 480 lines, 1 match - UE_analysis_5_outlier.py
, Python, 141 lines, 1 match - UE_analysis_helper_class
_GUI_hb.py , Python, 265 lines - README.md, Text, 15 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;
- 10 scripts, each with its path and the digest of its content;
- 5 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
Datasets cited
Data and Code Availability
The underlying data are openly available (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
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, language, journal, volume, pages, dates, 7 authors, 6 keywords, 1 funder, 81 references.
Cite
This paper
Zhao, H., Horn, U., Freund, M., Bujanow, A., Gundlach, C., Hartwigsen, G., & Eippert, F. (2026). Assessing adverse effects and unspecific effects of transcutaneous spinal direct current stimulation (tsDCS). Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1292. https://
BibTeX
@article{zhao2026assessi
author = {Zhao, Hongyan and Horn, Ulrike and Freund, Melanie and Bujanow, Anna and Gundlach, Christopher and Hartwigsen, Gesa and Eippert, Falk},
title = {{Assessing adverse effects and unspecific effects of transcutaneous spinal direct current stimulation (tsDCS)}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = jul,
volume = {4},
pages = {IMAG.a.1292},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/
url = {https://
pmid = {42459499},
pmcid = {PMC13370751}
}
RIS
TY - JOUR
AU - Zhao, Hongyan
AU - Horn, Ulrike
AU - Freund, Melanie
AU - Bujanow, Anna
AU - Gundlach, Christopher
AU - Hartwigsen, Gesa
AU - Eippert, Falk
TI - Assessing adverse effects and unspecific effects of transcutaneous spinal direct current stimulation (tsDCS)
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/
VL - 4
SP - IMAG.a.1292
SN - 2837-6056
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "Assessing adverse effects and unspecific effects of transcutaneous spinal direct current stimulation (tsDCS)",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Zhao",
"given": "Hongyan"
},
{
"family": "Horn",
"given": "Ulrike"
},
{
"family": "Freund",
"given": "Melanie"
},
{
"family": "Bujanow",
"given": "Anna"
},
{
"family": "Gundlach",
"given": "Christopher"
},
{
"family": "Hartwigsen",
"given": "Gesa"
},
{
"family": "Eippert",
"given": "Falk"
}
],
"container-title-short":
"volume": "4",
"page": "IMAG.a.1292",
"DOI": "10.1162/
"PMID": "42459499",
"PMCID": "PMC13370751",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
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.1371/journal.pone.0267718
- Transcutaneous spinal direct current stimulation (tsDCS) does not affect postural sway of young and healthy subjects during quiet upright standing.Journal: PloS oneIn common: 24 references
- [2] doi:10.1371/journal.pbio.3002828 [code]
- A multichannel electrophysiological approach to noninvasively and precisely record human spinal cord activity.Journal: PLoS biologyIn common: MNE-Python, seaborn, pandas, 3 other tools, 1 reference, 2 authors
- [3] doi:10.1162/imag_a_00273 [code]
- Reliability of task-based fMRI in the dorsal horn of the human spinal cord.Journal: Imaging neuroscience (Cambridge, Mass.)In common: seaborn, pandas, SciPy, 2 other tools, 2 authors
- [4] doi:10.1111/ejn.70375 [code]
- Increase in Ia Afferent Synaptic Excitation of SOD1 G93A Mouse Motoneurons by 2-Week Anodal Trans-Spinal Direct Current Stimulation Does Not Ameliorate the Cellular Burden of the Disease.Journal: The European journal of neuroscienceIn common: 7 references
- [5] doi:10.1016/j.neuroimage.2023.120152 [code]
- Reliability of resting-state functional connectivity in the human spinal cord: Assessing the impact of distinct noise sources.Journal: NeuroImageIn common: 1 reference, 2 authors
- [6] doi:10.1002/hbm.26018 [code]
- Automated slice-specific z-shimming for functional magnetic resonance imaging of the human spinal cord.Journal: Human brain mappingIn common: 1 reference, 2 authors
- [7] doi:10.1162/imag.a.938 [code]
- Evaluating cardiac noise correction approaches for non-invasive electrophysiology of the human spinal cord.Journal: Imaging neuroscience (Cambridge, Mass.)In common: MNE-Python, seaborn, pandas, 3 other tools, 1 reference, author Falk Eippert
- [8] doi:10.1093/braincomms/fcae129 [code]
- Bayesian modelling disentangles language versus executive control disruption in stroke.Journal: Brain communicationsIn common: seaborn, pandas, SciPy, 2 other tools, behavior only, author Gesa Hartwigsen
- [9] doi:10.1523/jneurosci.0657-25.2025 [code]
- Attentional Engagement with Target and Distractor Streams Predicts Speech Comprehension in Multitalker Environments.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: MNE-Python, pandas, SciPy, 2 other tools, author Gesa Hartwigsen
- [10] doi:10.1162/imag_a_00559 [code]
- Body size and intracranial volume interact with the structure of the central nervous system: A multi-center in vivo neuroimaging study.Journal: Imaging neuroscience (Cambridge, Mass.)In common: seaborn, pandas, SciPy, 2 other tools, author Falk Eippert
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, 10 scripts, and 5 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:08636cafcdaa2671…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1162/imag.a.1292)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1162/imag.a.1292.svg
:target: https://openscicode.org/badge/doi/10.1162/imag.a.1292
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1162/imag.a.1292"><img src="https://openscicode.org/badge/doi/10.1162/imag.a.1292.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
