OSCR

Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

One block of code here has 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 1 match
  1. [1] § Results › In vivo acoustoelectric DC neuromodulation ↔ Fig5/Temperature_confound/temp_extract.py, lines 144 to 203 · score 0.50 · EMG height, low pass filtered, peak, ratios, Hilbert, RF · block oscr:b:G9NC27FCSD3SN-4 · 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 · 557 lines · 20 KB · Apache-2.0 · 1 match

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from scipy.fft import fft,fftshift
  4. from scipy import signal
  5. import pandas as pd
  6. from scipy.signal import iirfilter,sosfiltfilt
  7. from scipy.stats import ttest_ind
  8. from scipy.signal import hilbert
  9. from scipy.signal import find_peaks
  10. import scipy.stats
  11. from scipy.stats import pearsonr
  12. import pandas as pd
  13. from scipy import signal
  14. import os
  15. from scipy.signal import hilbert
  16. from os import listdir
  17. from os.path import isfile, join
  18. import re
  19. import heapq
  20. from scipy.integrate import simpson
  21. from numpy import trapz
  22. import gc
  23. #
  24. #
  25. # Plotting:
  26. plt.rc('font', family='serif')
  27. plt.rc('font', serif='Arial')
  28. plt.rcParams['axes.linewidth'] = 2
  29. fonts = 18
  30. #
  31. # File organization for key pictures:
  32. filepath = '/Volumes/extras/temperature_test/temp_study/'
  33. outpath = '/Users/jeanrintoul/Desktop/PhD/analysis/ae_neuromodulation/temperature/temperature_data/'
  34. #
  35. #
  36. dirlist = [ item for item in os.listdir(filepath) if os.path.isdir(os.path.join(filepath, item)) ]
  37. dirlist = sorted(dirlist)
  38. print ('num files in directory: ',len(dirlist))
  39. # print (dirlist)
  40. brain_gains = 10*np.ones(len(dirlist))
  41. # print ('brain gains',brain_gains)
  42. emg_gains = 500*np.ones(len(dirlist))
  43. #
  44. # brain_gains = [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]
  45. # emg_gains = [500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500]
  46. #
  47. # It would be better if I had the gains listed in each directory somehow.
  48. #
  49. # print (len(brain_gains),len(emg_gains))
  50. #
  51. Fs = 5e6
  52. timestep = 1/Fs
  53. m_channel = 0
  54. rf_channel = 4
  55. v_channel = 6
  56. i_channel = 5
  57. emg_channel = 2
  58. cut = 1000
  59. sos_low_band = iirfilter(17, [10], rs=60, btype='lowpass',
  60. analog=False, ftype='cheby2', fs=Fs,
  61. output='sos')
  62. sos_emg_band = iirfilter(17, [100,cut], rs=60, btype='bandpass',
  63. analog=False, ftype='cheby2', fs=Fs,
  64. output='sos')
  65. #
  66. # sos_emg_band = iirfilter(17, [cut], rs=60, btype='lowpass',
  67. # analog=False, ftype='cheby2', fs=Fs,
  68. # output='sos')
  69. #
  70. sos_emg_hilbert = iirfilter(17, [10], rs=60, btype='lowpass',
  71. analog=False, ftype='cheby2', fs=Fs,
  72. output='sos')
  73. #
  74. mains_fs = np.arange(50,1000,50)
  75. # print('mains:',mains_fs)
  76. def mains_stop(signal):
  77. mains = mains_fs
  78. # mains = [50]
  79. for i in range(len(mains)):
  80. sos_mains_stop = iirfilter(17, [mains[i]-4,mains[i]+4], rs=60, btype='bandstop',
  81. analog=False, ftype='cheby2', fs=Fs,
  82. output='sos')
  83. signal = sosfiltfilt(sos_mains_stop, signal)
  84. return signal
  85. #
  86. #
  87. def find_nearest(array, value):
  88. idx = min(range(len(array)), key=lambda i: abs(array[i]-value))
  89. return idx
  90. def metrics(filetoload,filename,typefile):
  91. ae_data = np.load(filetoload)
  92. brain_gain = brain_gains[i]
  93. emg_gain = emg_gains[i]
  94. ae_fsignal = (1e6*ae_data[m_channel]/brain_gain)
  95. duration = int(len(ae_fsignal)/Fs)
  96. N = int(duration*Fs)
  97. t = np.linspace(0, duration, N, endpoint=False)
  98. ae_emgsignal = (1e6*ae_data[emg_channel]/emg_gain)
  99. ae_rfsignal = 10*ae_data[rf_channel]
  100. ae_vsignal = 10*ae_data[v_channel]
  101. ae_isignal = -5 *ae_data[i_channel]/50
  102. rf_pp = np.max(ae_rfsignal) - np.min(ae_rfsignal)
  103. v_pp = np.max(ae_vsignal) - np.min(ae_vsignal)
  104. i_pp = np.max(ae_isignal) - np.min(ae_isignal)
  105. # print ('rf pp, v pp, i pp:',rf_pp,v_pp,i_pp)
  106. ae_low_signal = sosfiltfilt(sos_low_band, ae_fsignal)
  107. ae_emg_signal = sosfiltfilt(sos_emg_band, ae_emgsignal)
  108. ae_emg_signal = mains_stop(ae_emg_signal)
  109. h_ae_emg = abs(hilbert(ae_emg_signal))
  110. hae_emg_signal = sosfiltfilt(sos_emg_hilbert, h_ae_emg)
  111. #
  112. # FFT CODE.
  113. # start_pause = int(0*Fs)
  114. # end_pause = int(duration*Fs)
  115. # xf = np.fft.fftfreq( (end_pause-start_pause), d=timestep)[:(end_pause-start_pause)//2]
  116. # frequencies = xf[1:(end_pause-start_pause)//2]
  117. # fft_ae = fft(ae_fsignal[start_pause:end_pause])
  118. # fft_ae = np.abs(2.0/(end_pause-start_pause) * (fft_ae))[1:(end_pause-start_pause)//2]
  119. # #
  120. # fft_ae_hemg = fft(hae_emg_signal[start_pause:end_pause])
  121. # fft_ae_hemg = np.abs(2.0/(end_pause-start_pause) * (fft_ae_hemg))[1:(end_pause-start_pause)//2]
  122. # #
  123. # f_end_idx = find_nearest(frequencies, 10)
  124. # f_1hz_idx = find_nearest(frequencies, 1)
  125. #
  126. # sub_fft_ae = fft_ae[0:f_end_idx]
  127. # sub_fft_ae_hemg = fft_ae_hemg[0:f_end_idx]
  128. # sub_freqs = frequencies[0:f_end_idx]
  129. # h_amp_1hz = fft_ae_hemg[f_1hz_idx]
  130. # b_amp_1hz = fft_ae[f_1hz_idx]
  131. #
  132. front_gap = 0.5
  133. # SNR metric based on hilbert transformed EMG.
  134. null_times = [0.1]
  135. null_start_time = int ((null_times[0])*Fs)
  136. null_end_time = int((null_times[0]+front_gap)*Fs)
  137. h_null_amplitude = np.mean(hae_emg_signal[null_start_time:null_end_time])
  138. # do it this way to skip the filter artefact at the start.
  139. h_amplitude = np.mean(hae_emg_signal[int(front_gap*Fs):int((duration-0.5)*Fs) ])
  140. print ('h amplitude',h_amplitude,h_null_amplitude)
  141. h_snr = 20*np.log(h_amplitude/h_null_amplitude)
  142. if h_snr < 0:
  143. h_snr = 0
  144. # print ('h snr:',h_snr)
  145. # Calculate the area under the hilbert transformed, low pass filtered EMG curve.
  146. emg_area = np.round(trapz(hae_emg_signal)/Fs)
  147. emg_height = abs(np.max(hae_emg_signal) - np.min(hae_emg_signal))
  148. # print ('emg area =', emg_area )
  149. # calculate the area under the brain signal curve
  150. brain_height = abs(np.max(ae_low_signal) - np.min(ae_low_signal))
  151. brain_area = np.abs(np.round(trapz(ae_low_signal)/Fs))
  152. # print ('brain area =',brain_area)
  153. ratio = brain_area/emg_area
  154. #
  155. # print ('ratio:',ratio)
  156. #
  157. # emg_max_ind= np.argmax(hae_emg_signal[int(0.5*Fs):])
  158. # emg_max_ind = emg_max_ind + int(0.5*Fs)
  159. #
  160. # print ('max ind:', max_ind)
  161. # emg_height = np.round(hae_emg_signal[emg_max_ind],2 )
  162. # emg_max_time = np.round(t[emg_max_ind],2)
  163. # print ('emg height, time: ', emg_height,emg_max_time )
  164. # #
  165. # brain_max_ind = np.argmax(abs(ae_low_signal[int(0.5*Fs):] ) )
  166. # brain_max_ind = brain_max_ind + int(0.5*Fs)
  167. # brain_height = np.round(ae_low_signal[brain_max_ind],2 )
  168. # brain_max_time = np.round(t[brain_max_ind],2)
  169. # print ('max brain height, time: ', brain_height,brain_max_time )
  170. # So the brain max metric is messed up...
  171. # the emg max metric is good.
  172. # for pressure only, it occurs at the end of the ramp, which is correlated to the max in the brain signal.
  173. #
  174. # Find the peaks
  175. x = hae_emg_signal[int(front_gap*Fs):]
  176. peaks, _ = find_peaks(x, distance=int(front_gap*Fs),prominence=1)
  177. peaks = peaks +int(front_gap*Fs)
  178. print ('emg peaks',peaks)
  179. emg_peaks = peaks
  180. #
  181. x = ae_low_signal[int(front_gap*Fs):]
  182. #
  183. start_height = np.mean(ae_low_signal[0:int(front_gap*Fs)])
  184. mid_height = np.mean(ae_low_signal[int(front_gap*Fs):])
  185. print ('start and mid height:',start_height,mid_height)
  186. # if mid_height < start_height: # invert the signal, so they are all up the same way.
  187. # print ('inverted the brain signal for find peaks')
  188. # x = -x
  189. # ae_low_signal = -ae_low_signal
  190. # attempt to center around zero.
  191. ae_low_signal = ae_low_signal - np.min(ae_low_signal)
  192. x = x - np.min(x)
  193. #
  194. brain_peaks, _ = find_peaks(x, distance=int(front_gap*Fs),prominence=100)
  195. brain_peaks = brain_peaks +int(front_gap*Fs)
  196. print ('brain peaks',brain_peaks)
  197. # values = ae_low_signal[brain_peaks]
  198. # sorted_vals = np.sort(values)
  199. #
  200. metric_results = [h_snr,emg_area,brain_area,ratio,rf_pp,v_pp,i_pp,emg_height,brain_height]
  201. emg_arrays = emg_peaks
  202. brain_arrays = brain_peaks
  203. #
  204. # Sub-sample, and save out the brain signal, the hilbert transformed EMG signal, and the original EMG signal.
  205. # Downsampling.
  206. new_Fs = 10000
  207. downsampling_factor = int(Fs/new_Fs)
  208. print('downsampling factor: ',downsampling_factor)
  209. downsampling_filter = iirfilter(17, [new_Fs], rs=60, btype='lowpass',
  210. analog=False, ftype='cheby2', fs=Fs,
  211. output='sos')
  212. #
  213. # downsample for easier plotting.
  214. dae_emg_signal = sosfiltfilt(downsampling_filter, ae_emg_signal)
  215. # Now downsample the data.
  216. brain_signal = ae_low_signal[::downsampling_factor]
  217. dt = t[::downsampling_factor]
  218. d_emg = dae_emg_signal[::downsampling_factor]
  219. d_hemg = hae_emg_signal[::downsampling_factor]
  220. h_rf = abs(hilbert(ae_rfsignal))
  221. h_rf = sosfiltfilt(downsampling_filter, h_rf)
  222. d_rf = h_rf[::downsampling_factor]
  223. h_v = abs(hilbert(ae_vsignal))
  224. h_v = sosfiltfilt(downsampling_filter, h_v)
  225. d_v = h_v[::downsampling_factor]
  226. h_i = abs(hilbert(ae_isignal))
  227. h_i = sosfiltfilt(downsampling_filter, h_i)
  228. d_i = h_i[::downsampling_factor]
  229. #
  230. #
  231. fig = plt.figure(figsize=(6,6))
  232. ax = fig.add_subplot(321)
  233. plt.plot(dt,d_emg,'k')
  234. plt.legend(['emg peaks'],loc='upper right')
  235. ax2 = fig.add_subplot(322)
  236. plt.plot(dt,d_rf,'k')
  237. plt.plot(dt,d_v,'r')
  238. ax3 = fig.add_subplot(323)
  239. plt.plot(dt,d_hemg,'b')
  240. ax4 = fig.add_subplot(324)
  241. plt.plot(dt,d_i,'g')
  242. ax5 = fig.add_subplot(325)
  243. plt.plot(dt,d_hemg/np.max(d_hemg),'r')
  244. plt.plot(dt,brain_signal/np.max(brain_signal),'k' )
  245. plt.plot(dt,d_rf/np.max(d_rf),'b' )
  246. ax6 = fig.add_subplot(326)
  247. plt.plot(dt,brain_signal,'k')
  248. ax.spines['right'].set_visible(False)
  249. ax.spines['top'].set_visible(False)
  250. ax2.spines['right'].set_visible(False)
  251. ax2.spines['top'].set_visible(False)
  252. ax3.spines['right'].set_visible(False)
  253. ax3.spines['top'].set_visible(False)
  254. ax4.spines['right'].set_visible(False)
  255. ax4.spines['top'].set_visible(False)
  256. ax5.spines['right'].set_visible(False)
  257. ax5.spines['top'].set_visible(False)
  258. ax6.spines['right'].set_visible(False)
  259. ax6.spines['top'].set_visible(False)
  260. plt.tight_layout()
  261. plot_filename = outpath+'images/'+filename+ '_'+typefile+'.png'
  262. plt.savefig(plot_filename)
  263. plt.close()
  264. # plt.closefig(plot_filename)
  265. # plt.show()
  266. data = [dt,d_rf,d_v,d_i,d_emg,d_hemg,brain_signal]
  267. #
  268. # large variable garbage collection
  269. del ae_data, ae_fsignal, ae_emgsignal, ae_rfsignal, ae_vsignal, ae_isignal,ae_low_signal,ae_emg_signal
  270. gc.collect()
  271. #
  272. return metric_results,data
  273. #
  274. #
  275. for i in range(len(dirlist)):
  276. # for i in range(1):
  277. # i = 2
  278. if i >= 0:
  279. print ('i',i)
  280. path = filepath + dirlist[i]
  281. print ('dir path:',dirlist[i])
  282. print ('snr, emg area, brain area, ratio, rfpp, vpp, ipp, emg height, brain height, emg height, h emg amp 1hz, brain amp 1hz')
  283. file_list = [f for f in listdir(path) if isfile(join(path, f))]
  284. # print ('file list:', file_list, len(file_list))
  285. #
  286. outfile = dirlist[i]+ '.npz'
  287. #
  288. # deal with AE file.
  289. sub = 'tae_'
  290. filename = next((s for s in file_list if sub in s), None)
  291. # print ('filename',filename)
  292. filetoload = path + '/'+filename
  293. # print ('file',filetoload)
  294. ae_results,aedata = metrics(filetoload,dirlist[i],'ae')
  295. print ('ae results:',ae_results)
  296. # deal with P file.
  297. sub = 'tp_'
  298. filename = next((s for s in file_list if sub in s), None)
  299. # print ('filename',filename)
  300. filetoload = path + '/'+filename
  301. # print ('file',filetoload)
  302. p_results,pdata = metrics(filetoload,dirlist[i],'p')
  303. print ('p_results:',p_results)
  304. #
  305. # voltage only file.
  306. sub = 'tv_'
  307. filename = next((s for s in file_list if sub in s), None)
  308. # print ('filename',filename)
  309. filetoload = path + '/'+filename
  310. # print ('file',filetoload)
  311. v_results,vdata = metrics(filetoload,dirlist[i],'v')
  312. print ('v_results:',v_results)
  313. # Save out all the data.
  314. np.savez(outpath+outfile,ae_results=ae_results,p_results=p_results,v_results=v_results,aedata=aedata,pdata=pdata,vdata=vdata)
  315. print ('saved out a data file!')
  316. #
  317. #
  318. #
  319. # What are the group statistics we want here?
  320. #
  321. # for i in range(len(file_list)):
  322. # #
  323. # # if file_list[i]
  324. # r = re.compile("\s+|_")
  325. # stuff = r.split(file_list[i])
  326. # c1 = ac_filename_1
  327. # c2 = acdc_filename_1
  328. # #
  329. # #
  330. #
  331. # # load the acoustically connected file.
  332. # start_idx = int(0*Fs)
  333. # end_idx = int(duration*Fs)
  334. # #
  335. # ac_data = np.load(c1)
  336. # ac_fsignal = (1e6*ac_data[m_channel]/brain_gain)
  337. # ac_emgsignal = (1e6*ac_data[emg_channel]/emg_gain)
  338. # ac_rfsignal = 10*ac_data[rf_channel]
  339. # ac_low_signal = sosfiltfilt(sos_low_band, ac_fsignal)
  340. # ac_emg_signal = sosfiltfilt(sos_emg_band, ac_emgsignal)
  341. # # ac_emg_signal = mains_stop(ac_emg_signal)
  342. # #
  343. # # load the acoustically disconnected file.
  344. # acdc_data = np.load(c2)
  345. # acdc_fsignal = (1e6*acdc_data[m_channel]/brain_gain)
  346. # acdc_emgsignal = (1e6*acdc_data[emg_channel]/emg_gain)
  347. # acdc_rfsignal = 10*acdc_data[rf_channel]
  348. # acdc_low_signal = sosfiltfilt(sos_low_band, acdc_fsignal)
  349. # acdc_emg_signal = sosfiltfilt(sos_emg_band, acdc_emgsignal)
  350. # # acdc_emg_signal = mains_stop(acdc_emg_signal)
  351. # #
  352. # #
  353. # #
  354. # start_pause = int(0.85*Fs)
  355. # end_pause = int(1.3*Fs)
  356. # xf = np.fft.fftfreq( (end_pause-start_pause), d=timestep)[:(end_pause-start_pause)//2]
  357. # frequencies = xf[1:(end_pause-start_pause)//2]
  358. # #
  359. # # carrier frequency.
  360. # carrier_frequency = 500000
  361. # df_idx = find_nearest(frequencies,carrier_frequency)
  362. # #
  363. # #
  364. # fft_ac = fft(ac_fsignal[start_pause:end_pause])
  365. # fft_ac = np.abs(2.0/(end_pause-start_pause) * (fft_ac))[1:(end_pause-start_pause)//2]
  366. # fft_acdc = fft(acdc_fsignal[start_pause:end_pause])
  367. # fft_acdc = np.abs(2.0/(end_pause-start_pause) * (fft_acdc))[1:(end_pause-start_pause)//2]
  368. # #
  369. # #
  370. # fft_ac_emg = fft(ac_emgsignal[start_pause:end_pause])
  371. # fft_ac_emg = np.abs(2.0/(end_pause-start_pause) * (fft_ac_emg))[1:(end_pause-start_pause)//2]
  372. # fft_acdc_emg = fft(acdc_emgsignal[start_pause:end_pause])
  373. # fft_acdc_emg = np.abs(2.0/(end_pause-start_pause) * (fft_acdc_emg))[1:(end_pause-start_pause)//2]
  374. # #
  375. # print('500khz amplitudes ac/dc:',fft_ac[df_idx],fft_acdc[df_idx])
  376. # #
  377. # #
  378. # # Hilbert transform of EMG signals.
  379. # h_emg_acdc = abs(hilbert(acdc_emg_signal))
  380. # h_emg_ac = abs(hilbert(ac_emg_signal))
  381. # hac_emg_signal = sosfiltfilt(sos_emg_hilbert, h_emg_ac)
  382. # hacdc_emg_signal = sosfiltfilt(sos_emg_hilbert, h_emg_acdc)
  383. # #
  384. # # Then I want to save the hilbert amplitudes.
  385. # pulse_times = [1,3,5]
  386. # null_times = [0.1]
  387. # #
  388. # #
  389. # null_start_time = int ((null_times[0])*Fs)
  390. # null_end_time = int((null_times[0]+0.5)*Fs)
  391. # hac_null_amplitude = np.max(hac_emg_signal[null_start_time:null_end_time])
  392. # hacdc_null_amplitude = np.max(hacdc_emg_signal[null_start_time:null_end_time])
  393. # #
  394. # #
  395. # hamps = []
  396. # hacdc_amps = []
  397. # for i in range(len(pulse_times)):
  398. # start_time = int ((pulse_times[i]-0.5 )*Fs)
  399. # end_time = int((pulse_times[i]+1)*Fs)
  400. # #
  401. # #
  402. # hac_amplitude = np.max(hac_emg_signal[start_time:end_time])
  403. # hacdc_amplitude = np.max(hacdc_emg_signal[start_time:end_time])
  404. # #
  405. # #
  406. # hac_snr = 20*np.log(hac_amplitude/hac_null_amplitude)
  407. # hacdc_snr = 20*np.log(hacdc_amplitude/hacdc_null_amplitude)
  408. # hamps.append(hac_snr)
  409. # hacdc_amps.append(hacdc_snr)
  410. # #
  411. # #
  412. # print ('h ac snr:',hamps)
  413. # print ('h acdc snr:',hacdc_amps)
  414. # #
  415. # #
  416. # #
  417. # acamp = fft_ac[df_idx]
  418. # acdcamp = fft_acdc[df_idx]
  419. # #
  420. # # Save out all the data.
  421. # # np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning)
  422. # np.savez(outpath+outfile,acamp=acamp,acdcamp=acdcamp,hamps=hamps,hacdc_amps=hacdc_amps)
  423. # print ('saved out a data file!')
  424. # #
  425. # #
  426. # fig = plt.figure(figsize=(3,3))
  427. # ax = fig.add_subplot(111)
  428. # plt.plot(frequencies/1000,fft_acdc,'r')
  429. # plt.plot(frequencies/1000,fft_ac,'k')
  430. # ax.spines['right'].set_visible(False)
  431. # ax.spines['top'].set_visible(False)
  432. # ax.set_xlim([500-1,500+1])
  433. # plt.xticks([carrier_frequency/1000],fontsize=fonts)
  434. # plt.yticks(fontsize=fonts)
  435. # plt.tight_layout()
  436. # plot_filename = outpath+'fft_comparison.png'
  437. # plt.savefig(plot_filename)
  438. # plt.show()
  439. # #
  440. # #
  441. # #
  442. # fig = plt.figure(figsize=(6,2))
  443. # ax = fig.add_subplot(111)
  444. # plt.plot(t,acdc_rfsignal,'r')
  445. # plt.plot(t,ac_rfsignal,'k')
  446. # ax.set_xlim([0,duration])
  447. # # plt.yticks([])
  448. # # plt.xticks([])
  449. # ax.spines['right'].set_visible(False)
  450. # ax.spines['top'].set_visible(False)
  451. # ax.spines['left'].set_visible(False)
  452. # ax.spines['bottom'].set_visible(False)
  453. # plt.tight_layout()
  454. # plot_filename = outpath+'rfsignal.png'
  455. # plt.savefig(plot_filename)
  456. # plt.show()
  457. # #
  458. # #
  459. # #
  460. # fig = plt.figure(figsize=(6,2))
  461. # ax = fig.add_subplot(111)
  462. # plt.plot(t,ac_emg_signal ,'k')
  463. # plt.plot(t,acdc_emg_signal ,'r')
  464. # # plt.plot(t,hac_emg_signal ,'-k')
  465. # # plt.plot(t,hacdc_emg_signal,'-r')
  466. # ax.set_ylim([-130,130])
  467. # ax.set_xlim([0,duration])
  468. # # plt.yticks([])
  469. # # plt.xticks([])
  470. # ax.spines['right'].set_visible(False)
  471. # ax.spines['top'].set_visible(False)
  472. # ax.spines['left'].set_visible(False)
  473. # ax.spines['bottom'].set_visible(False)
  474. # plt.tight_layout()
  475. # plot_filename = outpath+'emg_signal.png'
  476. # plt.savefig(plot_filename)
  477. # plt.show()
  478. # fig = plt.figure(figsize=(6,2))
  479. # ax = fig.add_subplot(111)
  480. # # plt.plot(t,ac_emg_signal ,'k')
  481. # # plt.plot(t,acdc_emg_signal ,'r')
  482. # plt.plot(t,hac_emg_signal ,'-k')
  483. # plt.plot(t,hacdc_emg_signal,'-r')
  484. # ax.set_ylim([0,60])
  485. # ax.set_xlim([0,duration])
  486. # # plt.yticks([])
  487. # # plt.xticks([])
  488. # ax.spines['right'].set_visible(False)
  489. # ax.spines['top'].set_visible(False)
  490. # ax.spines['left'].set_visible(False)
  491. # ax.spines['bottom'].set_visible(False)
  492. # plt.tight_layout()
  493. # plot_filename = outpath+'emg_hilbert_signal.png'
  494. # plt.savefig(plot_filename)
  495. # plt.show()
  496. # fig = plt.figure(figsize=(6,2))
  497. # ax = fig.add_subplot(111)
  498. # # plt.plot(t,ac_emg_signal ,'k')
  499. # # plt.plot(t,acdc_emg_signal ,'r')
  500. # plt.plot(t,ac_low_signal ,'-k')
  501. # plt.plot(t,acdc_low_signal,'-r')
  502. # # ax.set_ylim([0,60])
  503. # ax.set_xlim([0,duration])
  504. # plt.yticks([])
  505. # plt.xticks([])
  506. # ax.spines['right'].set_visible(False)
  507. # ax.spines['top'].set_visible(False)
  508. # ax.spines['left'].set_visible(False)
  509. # ax.spines['bottom'].set_visible(False)
  510. # plt.tight_layout()
  511. # plot_filename = outpath+'brain_signal.png'
  512. # plt.savefig(plot_filename)
  513. # plt.show()
  514. # This is the good general everything plot, if I want something informational and not pretty.
  515. # fig = plt.figure(figsize=(8,6))
  516. # ax = fig.add_subplot(511)
  517. # plt.plot(frequencies,fft_acdc,'r')
  518. # plt.plot(frequencies,fft_ac,'k')
  519. # ax.set_xlim([0,600000])
  520. # ax2 = fig.add_subplot(512)
  521. # plt.plot(t,hac_emg_signal ,'k')
  522. # plt.plot(t,hacdc_emg_signal,'r')
  523. # ax3 = fig.add_subplot(513)
  524. # plt.plot(t,ac_emg_signal ,'k')
  525. # ax3.set_xlim([0,duration])
  526. # ax3.set_ylim([-150,150])
  527. # ax4 = fig.add_subplot(514)
  528. # plt.plot(t,acdc_emg_signal ,'r')
  529. # ax4.set_xlim([0,duration])
  530. # ax4.set_ylim([-150,150])
  531. # ax5 = fig.add_subplot(515)
  532. # plt.plot(t,ac_rfsignal,'k')
  533. # ax5.set_xlim([0,duration])
  534. # plt.tight_layout()
  535. # # # plot_filename = outpath+'v_fft_signal.png'
  536. # # # plt.savefig(plot_filename)
  537. # plt.show()

temp_extract.py at commit 382a551, under Apache-2.0 · at the source

Overview

Authors: Jean L. Rintoul1, Christopher Butler2, Robin O. Cleveland3, Nir Grossman1
  1. Department of Brain Sciences, Imperial College London,London, UK
  2. The George Institute for Global Health, School of Public Health, Imperial College London,London, UK
  3. Institute of Biomedical Engineering, University of Oxford,Oxford, UK
Institutions: Imperial College London (United Kingdom); University of Oxford (United Kingdom)
Journal: Nature communications, volume 17, issue 1, article 5073
Dates: received 16 November 2025; accepted 21 May 2026; published online 17 June 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41467-026-73826-2 · PMID 42310018 · PMCID PMC13276402 · OpenAlex W4415871612
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: other (modality), mouse (organism)
Methods: Spectral & time-frequency, Graphs, Physiology & signal measures, Machine learning
Keywords: Biomedical engineering, Electrophysiology
MeSH: Acoustic Stimulation*, Brain*, Ultrasonic Waves*, Animals, Electric Stimulation, Mice (* major topic)
Topic: Ultrasound and Hyperthermia Applications (Biomedical Engineering, Engineering), according to OpenAlex
Citations: not cited yet (Europe PMC); 50 references in the paper

Abstract

Non-invasive brain stimulation offers therapeutic potential without surgery, yet existing electrical approaches lack spatial precision due to the long wavelengths of electric fields. Here we demonstrate acoustoelectric neuromodulation, a nonlinear interaction between applied acoustic and electric fields that generates spatially localised, low-frequency electric fields at the ultrasound focus. Using in vitro and in vivo mouse electrophysiology, we show motor-evoked responses that depend on both the amplitude and frequency of the acoustoelectric field, with controls excluding purely acoustic or electrical origins. In vivo measurements show acoustoelectric potentials of ≈9 mV, corresponding to estimated focal electric fields of ~6 V/m at 500 kHz and 1 MPa acoustic pressure, with ~1.5 mm extrema spacing demonstrated in phantom experiments. Importantly, we identify an acoustoelectric contribution to conventional ultrasound stimulation, arising from interactions between ultrasound-induced electrical signals and propagating acoustic waves, establishing acoustoelectric neuromodulation as a distinct mechanism influencing ultrasound-based brain stimulation.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

doi:10.6084/m9.figshare.c.7909283

License: none: the authors keep all their rights
State: unreachable at the last attempt, verified on 24 October 2026
Evidence: found in the paper
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 20 checks, the latest on 24 October 2026: unreachable at the last attempt (HTTP 202)
  • 24 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)
  • 19 October 2026: unreachable at the last attempt (HTTP 202)

Acoustoelectric/Acoustoelectric_neuromodulation_and_its_contribution_to_US_stimulation

License: Apache-2.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 382a551c4c6d902b583cbc5356f0e7dff3348ead, 5 May 2026
Languages: Python (29)
Size: 62 files, 29 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, license file, CITATION.cff, environment (requirements.txt), tests
Not found: continuous integration, documentation
Tools: Matplotlib (29 files), NumPy (29 files), SciPy (29 files), pandas (27 files), statsmodels (11 files), seaborn (7 files), scikit-learn (3 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
31 files

Code availability

Code supporting the findings in this article is available at https://github.com/Acoustoelectric/Acoustoelectric_neuromodulation_and_its_contribution_to_US_stimulation, with 10.6084/m9.figshare.c.7909283.

Reproduced under the paper's license (CC BY), from the paper cited above.

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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 29 scripts, each with its path and the digest of its content;
  • 1 match 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.

Data availability

The data supporting the findings of this study are available within the paper, its Supplementary Information and the Source Data file. The time-series and analysed datasets have been deposited in Figshare under DOI: 10.6084/m9.figshare.c.7909283. Source data are provided in this paper.

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 2, 28 September 2026

  • Funding: added Alzheimer's Association; National Institute for Health and Care Research; Imperial College London; UK Dementia Research Institute; Medical Research Council; Engineering and Physical Sciences Research Council

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 2 keywords, 6 MeSH terms, 45 references.

Cite

This paper

Rintoul, J. L., Butler, C., Cleveland, R. O., & Grossman, N. (2026). Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation. Nature communications, 17(1), 5073. https://doi.org/10.1038/s41467-026-73826-2

BibTeX

@article{rintoul2026non,
author = {Rintoul, Jean L. and Butler, Christopher and Cleveland, Robin O. and Grossman, Nir},
title = {{Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {5073},
publisher = {Nature Portfolio},
issn = {2041-1723},
doi = {10.1038/s41467-026-73826-2},
url = {https://doi.org/10.1038/s41467-026-73826-2},
pmid = {42310018},
pmcid = {PMC13276402}
}

RIS

TY - JOUR
AU - Rintoul, Jean L.
AU - Butler, Christopher
AU - Cleveland, Robin O.
AU - Grossman, Nir
TI - Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/06/17
VL - 17
IS - 1
SP - 5073
SN - 2041-1723
PB - Nature Portfolio
DO - 10.1038/s41467-026-73826-2
UR - https://doi.org/10.1038/s41467-026-73826-2
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-73826-2",
"type": "article-journal",
"title": "Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation",
"container-title": "Nature communications",
"author": [
{
"family": "Rintoul",
"given": "Jean L."
},
{
"family": "Butler",
"given": "Christopher"
},
{
"family": "Cleveland",
"given": "Robin O."
},
{
"family": "Grossman",
"given": "Nir"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "5073",
"DOI": "10.1038/s41467-026-73826-2",
"PMID": "42310018",
"PMCID": "PMC13276402",
"ISSN": "2041-1723",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41467-026-73826-2",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
17
]
]
}
}

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.1038/s44172-026-00598-4 [code]
In vivo acoustoelectric neural recording in mice enabled by ultrasound-induced frequency mixing.
Journal: Communications engineering
In common: pandas, SciPy, Matplotlib, 1 other tool, other, mouse, 9 references, 2 authors
[2] doi:10.1038/s41467-024-48576-8 [code]
Transcranial focused ultrasound to V5 enhances human visual motion brain-computer interface by modulating feature-based attention.
Journal: Nature communications
In common: statsmodels, seaborn, pandas, 3 other tools, other, 6 references
[3] doi:10.1038/s41551-025-01449-x [code]
Holographic transcranial ultrasound neuromodulation enhances stimulation efficacy by cooperatively recruiting distributed brain circuits.
Journal: Nature biomedical engineering
In common: seaborn, pandas, SciPy, 2 other tools, other, 6 references
[4] doi:10.1016/j.isci.2023.108372
Effects of focused ultrasound in a "clean" mouse model of ultrasonic neuromodulation.
Journal: iScience
In common: other, mouse, 7 references
[5] doi:10.1016/j.isci.2021.103085 [code]
MorphoSONIC: A morphologically structured intramembrane cavitation model reveals fiber-specific neuromodulation by ultrasound.
Journal: iScience
In common: pandas, SciPy, Matplotlib, 1 other tool, other, 5 references
[6] doi:10.1162/imag.a.1294 [code]
Toward a transcriptomic framework for ultrasound neuromodulation: A perspective on gene expression and regional brain sensitivity.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: statsmodels, scikit-learn, pandas, 3 other tools, other, 4 references
[7] doi:10.1038/s41467-026-69853-8 [code]
Transcranial focused ultrasound induces source localizable cortical activation in resting state humans when applied concurrently with transcranial electric stimulation.
Journal: Nature communications
In common: statsmodels, pandas, SciPy, 1 other tool, other, 5 references
[8] doi:10.1038/s41467-022-28205-y [code]
Sonogenetic control of mammalian cells using exogenous Transient Receptor Potential A1 channels.
Journal: Nature communications
In common: seaborn, pandas, Matplotlib, 1 other tool, mouse, 5 references
[9] doi:10.1016/j.brs.2025.09.004 [code]
Transcranial ultrasound stimulation modulates neuronal membrane potentials across broad timescales in the awake mammalian brain.
Journal: Brain stimulation
In common: other, mouse, 6 references
[10] doi:10.1073/pnas.2300291120
The mechanosensitive ion channel Piezo1 contributes to ultrasound neuromodulation.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: other, mouse, 6 references

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.

Add the badge to the code's README

OSCR: the badge of this paper

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 -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-73826-2.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.