Non-invasive in vivo acoustoelectric neuromodulation and its contribution to ultrasound stimulation.
The 1 match
- [1] § Results › In vivo acoustoelectric DC neuromodulation ↔ Fig5/Temperature_confound/temp_extract.py, lines 144–203 · score 0.50 · EMG height, low pass filtered, peak, ratios, Hilbert, RF
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
Python · 557 lines · 20 KB · Apache-2.0 · 1 match
- import numpy as np
- import matplotlib.pyplot as plt
- from scipy.fft import fft,fftshift
- from scipy import signal
- import pandas as pd
- from scipy.signal import iirfilter,sosfiltfilt
- from scipy.stats import ttest_ind
- from scipy.signal import hilbert
- from scipy.signal import find_peaks
- import scipy.stats
- from scipy.stats import pearsonr
- import pandas as pd
- from scipy import signal
- import os
- from scipy.signal import hilbert
- from os import listdir
- from os.path import isfile, join
- import re
- import heapq
- from scipy.integrate import simpson
- from numpy import trapz
- import gc
- #
- #
- # Plotting:
- plt.rc('font', family='serif')
- plt.rc('font', serif='Arial')
- plt.rcParams['axes.linewidth'] = 2
- fonts = 18
- #
- # File organization for key pictures:
- filepath = '/Volumes/extras/temperature_test/temp_study/'
- outpath = '/Users/jeanrintoul/Desktop/PhD/analysis/ae_neuromodulation/temperature/temperature_data/'
- #
- #
- dirlist = [ item for item in os.listdir(filepath) if os.path.isdir(os.path.join(filepath, item)) ]
- dirlist = sorted(dirlist)
- print ('num files in directory: ',len(dirlist))
- # print (dirlist)
- brain_gains = 10*np.ones(len(dirlist))
- # print ('brain gains',brain_gains)
- emg_gains = 500*np.ones(len(dirlist))
- #
- # brain_gains = [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]
- # emg_gains = [500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500]
- #
- # It would be better if I had the gains listed in each directory somehow.
- #
- # print (len(brain_gains),len(emg_gains))
- #
- Fs = 5e6
- timestep = 1/Fs
- m_channel = 0
- rf_channel = 4
- v_channel = 6
- i_channel = 5
- emg_channel = 2
- cut = 1000
- sos_low_band = iirfilter(17, [10], rs=60, btype='lowpass',
- analog=False, ftype='cheby2', fs=Fs,
- output='sos')
- sos_emg_band = iirfilter(17, [100,cut], rs=60, btype='bandpass',
- analog=False, ftype='cheby2', fs=Fs,
- output='sos')
- #
- # sos_emg_band = iirfilter(17, [cut], rs=60, btype='lowpass',
- # analog=False, ftype='cheby2', fs=Fs,
- # output='sos')
- #
- sos_emg_hilbert = iirfilter(17, [10], rs=60, btype='lowpass',
- analog=False, ftype='cheby2', fs=Fs,
- output='sos')
- #
- mains_fs = np.arange(50,1000,50)
- # print('mains:',mains_fs)
- def mains_stop(signal):
- mains = mains_fs
- # mains = [50]
- for i in range(len(mains)):
- sos_mains_stop = iirfilter(17, [mains[i]-4,mains[i]+4], rs=60, btype='bandstop',
- analog=False, ftype='cheby2', fs=Fs,
- output='sos')
- signal = sosfiltfilt(sos_mains_stop, signal)
- return signal
- #
- #
- def find_nearest(array, value):
- idx = min(range(len(array)), key=lambda i: abs(array[i]-value))
- return idx
- def metrics(filetoload,filename,typefile):
- ae_data = np.load(filetoload)
- brain_gain = brain_gains[i]
- emg_gain = emg_gains[i]
- ae_fsignal = (1e6*ae_data[m_channel]/brain_gain)
- duration = int(len(ae_fsignal)/Fs)
- N = int(duration*Fs)
- t = np.linspace(0, duration, N, endpoint=False)
- ae_emgsignal = (1e6*ae_data[emg_channel]/emg_gain)
- ae_rfsignal = 10*ae_data[rf_channel]
- ae_vsignal = 10*ae_data[v_channel]
- ae_isignal = -5 *ae_data[i_channel]/50
- rf_pp = np.max(ae_rfsignal) - np.min(ae_rfsignal)
- v_pp = np.max(ae_vsignal) - np.min(ae_vsignal)
- i_pp = np.max(ae_isignal) - np.min(ae_isignal)
- # print ('rf pp, v pp, i pp:',rf_pp,v_pp,i_pp)
- ae_low_signal = sosfiltfilt(sos_low_band, ae_fsignal)
- ae_emg_signal = sosfiltfilt(sos_emg_band, ae_emgsignal)
- ae_emg_signal = mains_stop(ae_emg_signal)
- h_ae_emg = abs(hilbert(ae_emg_signal))
- hae_emg_signal = sosfiltfilt(sos_emg_hilbert, h_ae_emg)
- #
- # FFT CODE.
- # start_pause = int(0*Fs)
- # end_pause = int(duration*Fs)
- # xf = np.fft.fftfreq( (end_pause-start_pause), d=timestep)[:(end_pause-start_pause)//2]
- # frequencies = xf[1:(end_pause-start_pause)//2]
- # fft_ae = fft(ae_fsignal[start_pause:end_pause])
- # fft_ae = np.abs(2.0/(end_pause-start_pause) * (fft_ae))[1:(end_pause-start_pause)//2]
- # #
- # fft_ae_hemg = fft(hae_emg_signal[start_pause:end_pause])
- # fft_ae_hemg = np.abs(2.0/(end_pause-start_pause) * (fft_ae_hemg))[1:(end_pause-start_pause)//2]
- # #
- # f_end_idx = find_nearest(frequencies, 10)
- # f_1hz_idx = find_nearest(frequencies, 1)
- #
- # sub_fft_ae = fft_ae[0:f_end_idx]
- # sub_fft_ae_hemg = fft_ae_hemg[0:f_end_idx]
- # sub_freqs = frequencies[0:f_end_idx]
- # h_amp_1hz = fft_ae_hemg[f_1hz_idx]
- # b_amp_1hz = fft_ae[f_1hz_idx]
- #
- front_gap = 0.5
- # SNR metric based on hilbert transformed EMG.
- null_times = [0.1]
- null_start_time = int ((null_times[0])*Fs)
- null_end_time = int((null_times[0]+front_gap)*Fs)
- h_null_amplitude = np.mean(hae_emg_signal[null_start_time:null_end_time])
- # do it this way to skip the filter artefact at the start.
- h_amplitude = np.mean(hae_emg_signal[int(front_gap*Fs):int((duration-0.5)*Fs) ])
- print ('h amplitude',h_amplitude,h_null_amplitude)
- h_snr = 20*np.log(h_amplitude/h_null_amplitude)
- if h_snr < 0:
- h_snr = 0
- # print ('h snr:',h_snr)
- # Calculate the area under the hilbert transformed, low pass filtered EMG curve.
- emg_area = np.round(trapz(hae_emg_signal)/Fs)
- emg_height = abs(np.max(hae_emg_signal) - np.min(hae_emg_signal))
- # print ('emg area =', emg_area )
- # calculate the area under the brain signal curve
- brain_height = abs(np.max(ae_low_signal) - np.min(ae_low_signal))
- brain_area = np.abs(np.round(trapz(ae_low_signal)/Fs))
- # print ('brain area =',brain_area)
- ratio = brain_area/emg_area
- #
- # print ('ratio:',ratio)
- #
- # emg_max_ind= np.argmax(hae_emg_signal[int(0.5*Fs):])
- # emg_max_ind = emg_max_ind + int(0.5*Fs)
- #
- # print ('max ind:', max_ind)
- # emg_height = np.round(hae_emg_signal[emg_max_ind],2 )
- # emg_max_time = np.round(t[emg_max_ind],2)
- # print ('emg height, time: ', emg_height,emg_max_time )
- # #
- # brain_max_ind = np.argmax(abs(ae_low_signal[int(0.5*Fs):] ) )
- # brain_max_ind = brain_max_ind + int(0.5*Fs)
- # brain_height = np.round(ae_low_signal[brain_max_ind],2 )
- # brain_max_time = np.round(t[brain_max_ind],2)
- # print ('max brain height, time: ', brain_height,brain_max_time )
- # So the brain max metric is messed up...
- # the emg max metric is good.
- # for pressure only, it occurs at the end of the ramp, which is correlated to the max in the brain signal.
- #
- # Find the peaks
- x = hae_emg_signal[int(front_gap*Fs):]
- peaks, _ = find_peaks(x, distance=int(front_gap*Fs),prominence=1)
- peaks = peaks +int(front_gap*Fs)
- print ('emg peaks',peaks)
- emg_peaks = peaks
- #
- x = ae_low_signal[int(front_gap*Fs):]
- #
- start_height = np.mean(ae_low_signal[0:int(front_gap*Fs)])
- mid_height = np.mean(ae_low_signal[int(front_gap*Fs):])
- print ('start and mid height:',start_height,mid_height)
- # if mid_height < start_height: # invert the signal, so they are all up the same way.
- # print ('inverted the brain signal for find peaks')
- # x = -x
- # ae_low_signal = -ae_low_signal
- # attempt to center around zero.
- ae_low_signal = ae_low_signal - np.min(ae_low_signal)
- x = x - np.min(x)
- #
- brain_peaks, _ = find_peaks(x, distance=int(front_gap*Fs),prominence=100)
- brain_peaks = brain_peaks +int(front_gap*Fs)
- print ('brain peaks',brain_peaks)
- # values = ae_low_signal[brain_peaks]
- # sorted_vals = np.sort(values)
- #
- metric_results = [h_snr,emg_area,brain_area,ratio,rf_pp,v_pp,i_pp,emg_height,brain_height]
- emg_arrays = emg_peaks
- brain_arrays = brain_peaks
- #
- # Sub-sample, and save out the brain signal, the hilbert transformed EMG signal, and the original EMG signal.
- # Downsampling.
- new_Fs = 10000
- downsampling_factor = int(Fs/new_Fs)
- print('downsampling factor: ',downsampling_factor)
- downsampling_filter = iirfilter(17, [new_Fs], rs=60, btype='lowpass',
- analog=False, ftype='cheby2', fs=Fs,
- output='sos')
- #
- # downsample for easier plotting.
- dae_emg_signal = sosfiltfilt(downsampling_filter, ae_emg_signal)
- # Now downsample the data.
- brain_signal = ae_low_signal[::downsampling_factor]
- dt = t[::downsampling_factor]
- d_emg = dae_emg_signal[::downsampling_factor]
- d_hemg = hae_emg_signal[::downsampling_factor]
- h_rf = abs(hilbert(ae_rfsignal))
- h_rf = sosfiltfilt(downsampling_filter, h_rf)
- d_rf = h_rf[::downsampling_factor]
- h_v = abs(hilbert(ae_vsignal))
- h_v = sosfiltfilt(downsampling_filter, h_v)
- d_v = h_v[::downsampling_factor]
- h_i = abs(hilbert(ae_isignal))
- h_i = sosfiltfilt(downsampling_filter, h_i)
- d_i = h_i[::downsampling_factor]
- #
- #
- fig = plt.figure(figsize=(6,6))
- ax = fig.add_subplot(321)
- plt.plot(dt,d_emg,'k')
- plt.legend(['emg peaks'],loc='upper right')
- ax2 = fig.add_subplot(322)
- plt.plot(dt,d_rf,'k')
- plt.plot(dt,d_v,'r')
- ax3 = fig.add_subplot(323)
- plt.plot(dt,d_hemg,'b')
- ax4 = fig.add_subplot(324)
- plt.plot(dt,d_i,'g')
- ax5 = fig.add_subplot(325)
- plt.plot(dt,d_hemg/np.max(d_hemg),'r')
- plt.plot(dt,brain_signal/np.max(brain_signal),'k' )
- plt.plot(dt,d_rf/np.max(d_rf),'b' )
- ax6 = fig.add_subplot(326)
- plt.plot(dt,brain_signal,'k')
- ax.spines['right'].set_visible(False)
- ax.spines['top'].set_visible(False)
- ax2.spines['right'].set_visible(False)
- ax2.spines['top'].set_visible(False)
- ax3.spines['right'].set_visible(False)
- ax3.spines['top'].set_visible(False)
- ax4.spines['right'].set_visible(False)
- ax4.spines['top'].set_visible(False)
- ax5.spines['right'].set_visible(False)
- ax5.spines['top'].set_visible(False)
- ax6.spines['right'].set_visible(False)
- ax6.spines['top'].set_visible(False)
- plt.tight_layout()
- plot_filename = outpath+'images/'+filename+ '_'+typefile+'.png'
- plt.savefig(plot_filename)
- plt.close()
- # plt.closefig(plot_filename)
- # plt.show()
- data = [dt,d_rf,d_v,d_i,d_emg,d_hemg,brain_signal]
- #
- # large variable garbage collection
- del ae_data, ae_fsignal, ae_emgsignal, ae_rfsignal, ae_vsignal, ae_isignal,ae_low_signal,ae_emg_signal
- gc.collect()
- #
- return metric_results,data
- #
- #
- for i in range(len(dirlist)):
- # for i in range(1):
- # i = 2
- if i >= 0:
- print ('i',i)
- path = filepath + dirlist[i]
- print ('dir path:',dirlist[i])
- print ('snr, emg area, brain area, ratio, rfpp, vpp, ipp, emg height, brain height, emg height, h emg amp 1hz, brain amp 1hz')
- file_list = [f for f in listdir(path) if isfile(join(path, f))]
- # print ('file list:', file_list, len(file_list))
- #
- outfile = dirlist[i]+ '.npz'
- #
- # deal with AE file.
- sub = 'tae_'
- filename = next((s for s in file_list if sub in s), None)
- # print ('filename',filename)
- filetoload = path + '/'+filename
- # print ('file',filetoload)
- ae_results,aedata = metrics(filetoload,dirlist[i],'ae')
- print ('ae results:',ae_results)
- # deal with P file.
- sub = 'tp_'
- filename = next((s for s in file_list if sub in s), None)
- # print ('filename',filename)
- filetoload = path + '/'+filename
- # print ('file',filetoload)
- p_results,pdata = metrics(filetoload,dirlist[i],'p')
- print ('p_results:',p_results)
- #
- # voltage only file.
- sub = 'tv_'
- filename = next((s for s in file_list if sub in s), None)
- # print ('filename',filename)
- filetoload = path + '/'+filename
- # print ('file',filetoload)
- v_results,vdata = metrics(filetoload,dirlist[i],'v')
- print ('v_results:',v_results)
- # Save out all the data.
- np.savez(outpath+outfile,ae_results=ae_results,p_results=p_results,v_results=v_results,aedata=aedata,pdata=pdata,vdata=vdata)
- print ('saved out a data file!')
- #
- #
- #
- # What are the group statistics we want here?
- #
- # for i in range(len(file_list)):
- # #
- # # if file_list[i]
- # r = re.compile("\s+|_")
- # stuff = r.split(file_list[i])
- # c1 = ac_filename_1
- # c2 = acdc_filename_1
- # #
- # #
- #
- # # load the acoustically connected file.
- # start_idx = int(0*Fs)
- # end_idx = int(duration*Fs)
- # #
- # ac_data = np.load(c1)
- # ac_fsignal = (1e6*ac_data[m_channel]/brain_gain)
- # ac_emgsignal = (1e6*ac_data[emg_channel]/emg_gain)
- # ac_rfsignal = 10*ac_data[rf_channel]
- # ac_low_signal = sosfiltfilt(sos_low_band, ac_fsignal)
- # ac_emg_signal = sosfiltfilt(sos_emg_band, ac_emgsignal)
- # # ac_emg_signal = mains_stop(ac_emg_signal)
- # #
- # # load the acoustically disconnected file.
- # acdc_data = np.load(c2)
- # acdc_fsignal = (1e6*acdc_data[m_channel]/brain_gain)
- # acdc_emgsignal = (1e6*acdc_data[emg_channel]/emg_gain)
- # acdc_rfsignal = 10*acdc_data[rf_channel]
- # acdc_low_signal = sosfiltfilt(sos_low_band, acdc_fsignal)
- # acdc_emg_signal = sosfiltfilt(sos_emg_band, acdc_emgsignal)
- # # acdc_emg_signal = mains_stop(acdc_emg_signal)
- # #
- # #
- # #
- # start_pause = int(0.85*Fs)
- # end_pause = int(1.3*Fs)
- # xf = np.fft.fftfreq( (end_pause-start_pause), d=timestep)[:(end_pause-start_pause)//2]
- # frequencies = xf[1:(end_pause-start_pause)//2]
- # #
- # # carrier frequency.
- # carrier_frequency = 500000
- # df_idx = find_nearest(frequencies,carrier_frequency)
- # #
- # #
- # fft_ac = fft(ac_fsignal[start_pause:end_pause])
- # fft_ac = np.abs(2.0/(end_pause-start_pause) * (fft_ac))[1:(end_pause-start_pause)//2]
- # fft_acdc = fft(acdc_fsignal[start_pause:end_pause])
- # fft_acdc = np.abs(2.0/(end_pause-start_pause) * (fft_acdc))[1:(end_pause-start_pause)//2]
- # #
- # #
- # fft_ac_emg = fft(ac_emgsignal[start_pause:end_pause])
- # fft_ac_emg = np.abs(2.0/(end_pause-start_pause) * (fft_ac_emg))[1:(end_pause-start_pause)//2]
- # fft_acdc_emg = fft(acdc_emgsignal[start_pause:end_pause])
- # fft_acdc_emg = np.abs(2.0/(end_pause-start_pause) * (fft_acdc_emg))[1:(end_pause-start_pause)//2]
- # #
- # print('500khz amplitudes ac/dc:',fft_ac[df_idx],fft_acdc[df_idx])
- # #
- # #
- # # Hilbert transform of EMG signals.
- # h_emg_acdc = abs(hilbert(acdc_emg_signal))
- # h_emg_ac = abs(hilbert(ac_emg_signal))
- # hac_emg_signal = sosfiltfilt(sos_emg_hilbert, h_emg_ac)
- # hacdc_emg_signal = sosfiltfilt(sos_emg_hilbert, h_emg_acdc)
- # #
- # # Then I want to save the hilbert amplitudes.
- # pulse_times = [1,3,5]
- # null_times = [0.1]
- # #
- # #
- # null_start_time = int ((null_times[0])*Fs)
- # null_end_time = int((null_times[0]+0.5)*Fs)
- # hac_null_amplitude = np.max(hac_emg_signal[null_start_time:null_end_time])
- # hacdc_null_amplitude = np.max(hacdc_emg_signal[null_start_time:null_end_time])
- # #
- # #
- # hamps = []
- # hacdc_amps = []
- # for i in range(len(pulse_times)):
- # start_time = int ((pulse_times[i]-0.5 )*Fs)
- # end_time = int((pulse_times[i]+1)*Fs)
- # #
- # #
- # hac_amplitude = np.max(hac_emg_signal[start_time:end_time])
- # hacdc_amplitude = np.max(hacdc_emg_signal[start_time:end_time])
- # #
- # #
- # hac_snr = 20*np.log(hac_amplitude/hac_null_amplitude)
- # hacdc_snr = 20*np.log(hacdc_amplitude/hacdc_null_amplitude)
- # hamps.append(hac_snr)
- # hacdc_amps.append(hacdc_snr)
- # #
- # #
- # print ('h ac snr:',hamps)
- # print ('h acdc snr:',hacdc_amps)
- # #
- # #
- # #
- # acamp = fft_ac[df_idx]
- # acdcamp = fft_acdc[df_idx]
- # #
- # # Save out all the data.
- # # np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning)
- # np.savez(outpath+outfile,acamp=acamp,acdcamp=acdcamp,hamps=hamps,hacdc_amps=hacdc_amps)
- # print ('saved out a data file!')
- # #
- # #
- # fig = plt.figure(figsize=(3,3))
- # ax = fig.add_subplot(111)
- # plt.plot(frequencies/1000,fft_acdc,'r')
- # plt.plot(frequencies/1000,fft_ac,'k')
- # ax.spines['right'].set_visible(False)
- # ax.spines['top'].set_visible(False)
- # ax.set_xlim([500-1,500+1])
- # plt.xticks([carrier_frequency/1000],fontsize=fonts)
- # plt.yticks(fontsize=fonts)
- # plt.tight_layout()
- # plot_filename = outpath+'fft_comparison.png'
- # plt.savefig(plot_filename)
- # plt.show()
- # #
- # #
- # #
- # fig = plt.figure(figsize=(6,2))
- # ax = fig.add_subplot(111)
- # plt.plot(t,acdc_rfsignal,'r')
- # plt.plot(t,ac_rfsignal,'k')
- # ax.set_xlim([0,duration])
- # # plt.yticks([])
- # # plt.xticks([])
- # ax.spines['right'].set_visible(False)
- # ax.spines['top'].set_visible(False)
- # ax.spines['left'].set_visible(False)
- # ax.spines['bottom'].set_visible(False)
- # plt.tight_layout()
- # plot_filename = outpath+'rfsignal.png'
- # plt.savefig(plot_filename)
- # plt.show()
- # #
- # #
- # #
- # fig = plt.figure(figsize=(6,2))
- # ax = fig.add_subplot(111)
- # plt.plot(t,ac_emg_signal ,'k')
- # plt.plot(t,acdc_emg_signal ,'r')
- # # plt.plot(t,hac_emg_signal ,'-k')
- # # plt.plot(t,hacdc_emg_signal,'-r')
- # ax.set_ylim([-130,130])
- # ax.set_xlim([0,duration])
- # # plt.yticks([])
- # # plt.xticks([])
- # ax.spines['right'].set_visible(False)
- # ax.spines['top'].set_visible(False)
- # ax.spines['left'].set_visible(False)
- # ax.spines['bottom'].set_visible(False)
- # plt.tight_layout()
- # plot_filename = outpath+'emg_signal.png'
- # plt.savefig(plot_filename)
- # plt.show()
- # fig = plt.figure(figsize=(6,2))
- # ax = fig.add_subplot(111)
- # # plt.plot(t,ac_emg_signal ,'k')
- # # plt.plot(t,acdc_emg_signal ,'r')
- # plt.plot(t,hac_emg_signal ,'-k')
- # plt.plot(t,hacdc_emg_signal,'-r')
- # ax.set_ylim([0,60])
- # ax.set_xlim([0,duration])
- # # plt.yticks([])
- # # plt.xticks([])
- # ax.spines['right'].set_visible(False)
- # ax.spines['top'].set_visible(False)
- # ax.spines['left'].set_visible(False)
- # ax.spines['bottom'].set_visible(False)
- # plt.tight_layout()
- # plot_filename = outpath+'emg_hilbert_signal.png'
- # plt.savefig(plot_filename)
- # plt.show()
- # fig = plt.figure(figsize=(6,2))
- # ax = fig.add_subplot(111)
- # # plt.plot(t,ac_emg_signal ,'k')
- # # plt.plot(t,acdc_emg_signal ,'r')
- # plt.plot(t,ac_low_signal ,'-k')
- # plt.plot(t,acdc_low_signal,'-r')
- # # ax.set_ylim([0,60])
- # ax.set_xlim([0,duration])
- # plt.yticks([])
- # plt.xticks([])
- # ax.spines['right'].set_visible(False)
- # ax.spines['top'].set_visible(False)
- # ax.spines['left'].set_visible(False)
- # ax.spines['bottom'].set_visible(False)
- # plt.tight_layout()
- # plot_filename = outpath+'brain_signal.png'
- # plt.savefig(plot_filename)
- # plt.show()
- # This is the good general everything plot, if I want something informational and not pretty.
- # fig = plt.figure(figsize=(8,6))
- # ax = fig.add_subplot(511)
- # plt.plot(frequencies,fft_acdc,'r')
- # plt.plot(frequencies,fft_ac,'k')
- # ax.set_xlim([0,600000])
- # ax2 = fig.add_subplot(512)
- # plt.plot(t,hac_emg_signal ,'k')
- # plt.plot(t,hacdc_emg_signal,'r')
- # ax3 = fig.add_subplot(513)
- # plt.plot(t,ac_emg_signal ,'k')
- # ax3.set_xlim([0,duration])
- # ax3.set_ylim([-150,150])
- # ax4 = fig.add_subplot(514)
- # plt.plot(t,acdc_emg_signal ,'r')
- # ax4.set_xlim([0,duration])
- # ax4.set_ylim([-150,150])
- # ax5 = fig.add_subplot(515)
- # plt.plot(t,ac_rfsignal,'k')
- # ax5.set_xlim([0,duration])
- # plt.tight_layout()
- # # # plot_filename = outpath+'v_fft_signal.png'
- # # # plt.savefig(plot_filename)
- # plt.show()
temp_extract.py at commit 382a551, under Apache-2.0 · at the source
Overview
- Department of Brain Sciences, Imperial College London,London, UK
- The George Institute for Global Health, School of Public Health, Imperial College London,London, UK
- Institute of Biomedical Engineering, University of Oxford,Oxford, UK
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/
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
Availability: 5 checks, the latest on 29 September 2026: unreachable at the last attempt (HTTP 202)
- 29 September 2026: unreachable at the last attempt (HTTP 202)
- 28 September 2026: unreachable at the last attempt (HTTP 202)
- 28 September 2026: unreachable at the last attempt (HTTP 202)
- 27 September 2026: unreachable at the last attempt (HTTP 202)
- 27 September 2026: unreachable at the last attempt (HTTP 202)
Acoustoelectric/Acoustoelectric_neuromodulation_and_its_contribution_to_US_stimulation
382a551c4c6d902b583cbc5356f0e7dff3348ead, 5 May 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
31 files
- Fig2/
mouse_trends.py , Python, 101 lines - Fig2/
t4_saline_trend.py , Python, 89 lines - Fig2/
t7_representative_plot.p , Python, 134 linesy - Fig3/
aedc_chi_squared.py , Python, 310 lines - Fig3/
control_study_ffts.py , Python, 371 lines - Fig3/
loo_test.py , Python, 545 lines - Fig3/
order_analysis.py , Python, 130 lines - Fig4/
ae1hz_chi_squared.py , Python, 306 lines - Fig4/
ae_frequency_comparison. , Python, 399 linespy - Fig4/
control_study_1hz_ffts.p , Python, 395 linesy - Fig4/
loo_test.py , Python, 595 lines - Fig4/
order_analysis.py , Python, 123 lines - Fig5/
Temperature_confound/ , Python, 598 linesloo_test.py - Fig5/
Temperature_confound/ , Python, 557 lines, 1 matchtemp_extract.py - Fig5/
Temperature_confound/ , Python, 216 linestemperature_stats.py - Fig5/
Temperature_confound/ , Python, 629 linestime_series_correlation. py - Fig6/
chi_squared.py , Python, 273 lines - Fig6/
f21_representatives_full , Python, 197 lines.py - Fig6/
f21_stats.py , Python, 457 lines - Fig6/
f21_stats_new.py , Python, 456 lines - Fig6/
order_analysis.py , Python, 72 lines - Fig7/
acdc_representatives_ful , Python, 212 linesl.py - Fig7/
acdc_stats.py , Python, 540 lines - Fig7/
chi_squared.py , Python, 272 lines - Fig7/
order_analysis.py , Python, 68 lines - Supp9/
b/ , Python, 165 linest1_1000prf_look.py - Supp9/
c/ , Python, 111 linesmake_map_image.py - Supp9/
d/ , Python, 119 linesmap_look_F21.py - Supp9/
simulation_PRF_mixing.py , Python, 141 lines - LICENSE, License, 201 lines
- README.md, Text, 44 lines
Code availability
Code supporting the findings in this article is available at https://
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/
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://
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 Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
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/
VL - 17
IS - 1
SP - 5073
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"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":
"volume": "17",
"issue": "1",
"page": "5073",
"DOI": "10.1038/
"PMID": "42310018",
"PMCID": "PMC13276402",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"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/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 communicationsIn common: statsmodels, pandas, SciPy, 1 other tool, other, 5 references
- [2] 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
- [3] doi:10.1002/advs.202524341 [code]
- Temporal Interference Stimulation Enhances Neural Regeneration.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: SciPy, Matplotlib, NumPy, mouse, 2 references, author Nir Grossman
- [4] doi:10.1038/s41531-026-01354-3 [code]
- Neuromodulation-induced normalization of cortical metastable dynamics signatures in Parkinson's disease.Journal: NPJ Parkinson's diseaseIn common: statsmodels, seaborn, scikit-learn, 4 other tools, 1 reference
- [5] doi:10.1093/braincomms/fcag253 [code]
- Disease detection and classification in temporal lobe epilepsy: step-wise versus simultaneous AI decision models in a multisite neuroimaging study.Journal: Brain communicationsIn common: seaborn, scikit-learn, pandas, 3 other tools, 1 reference
- [6] doi:10.1093/brain/awaf317 [code]
- High-resolution electrophysiological mapping of effective connectivity of lateral prefrontal cortex.Journal: Brain : a journal of neurologyIn common: statsmodels, pandas, SciPy, 2 other tools, 1 reference
- [7] doi:10.1038/s41467-026-74779-2 [code]
- TRPC4/
TRPC5 are critical for neuronal modulation by transcranial focused ultrasound in retrosplenial cortex in male mice. Journal: Nature communicationsIn common: other, mouse, 3 references - [8] doi:10.1038/s41378-026-01391-1
- High pressure transcranial focused ultrasound stimulation induces parameter-dependent cell-type specific effects.Journal: Microsystems & nanoengineeringIn common: other, 3 references
- [9] doi:10.1038/s41467-026-75826-8
- Transcranial focused ultrasound modulates spiking, LFP, and BOLD activity in the primate thalamus.Journal: Nature communicationsIn common: other, 3 references
- [10] doi:10.1007/s00429-026-03163-z [code]
- Toward reliable thalamic segmentation: an evaluation of automated methods for structural MRI.Journal: Brain structure & functionIn common: author Christopher R. Butler
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: 2 repositories of the authors' code, each at its verified commit and with its license, 29 scripts, and 1 match 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:fe195b58e38dc70d…
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.
