| Title: | TMS and Peripheral Motor Neurophysiology Analysis |
|---|---|
| Description: | Provides transcranial magnetic stimulation (TMS) and peripheral motor-neurophysiology analysis for PhysioExperiment objects. Includes motor-evoked-potential amplitude and latency, Boltzmann recruitment curves, H-reflex recruitment and Hmax/Mmax metrics, F-wave persistence and latency, paired-pulse inhibition and facilitation, cortical silent-period timing, TMS-EEG pulse removal, source-informed SSP-SIR and SOUND cleaning, TMS-evoked-potential summaries, the PREP2 upper-limb stroke-prognosis algorithm, and a governed TMS pulse and intensity metadata schema. |
| Authors: | Yusuke Matsui [aut, cre] |
| Maintainer: | Yusuke Matsui <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.4.1 |
| Built: | 2026-10-03 13:41:47 UTC |
| Source: | https://github.com/x-biosignal/PhysioNeurophys |
Detects sustained suppression and recovery of rectified tonic EMG after a TMS pulse using a baseline-relative threshold.
corticalSilentPeriod( x, search_window_ms = c(50, 400), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_fraction = 0.25, min_silence_ms = 10, min_return_ms = 5, channel = 1, assay_name = NULL )corticalSilentPeriod( x, search_window_ms = c(50, 400), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_fraction = 0.25, min_silence_ms = 10, min_return_ms = 5, channel = 1, assay_name = NULL )
x |
An epoched tonic-EMG |
search_window_ms |
Post-stimulus CSP search window. |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
baseline_window_ms |
Optional quiet-reference interval. The default uses all pre-stimulus samples. |
threshold_fraction |
Fraction of median rectified baseline below which EMG is considered silent. |
min_silence_ms |
Required duration of suppression. |
min_return_ms |
Required duration of recovered activity. |
channel |
One channel label or 1-based index. |
assay_name |
Optional assay name. |
A data frame with onset, offset, and duration for each trial.
Rossini PM, Burke D, Chen R, et al. (2015). Non-invasive electrical and magnetic stimulation of the brain, spinal cord, roots and peripheral nerves: basic principles and procedures for routine clinical and research application. Clinical Neurophysiology, 126:1071-1107. doi:10.1016/j.clinph.2015.02.001
data <- array(rep(c(-1, 1), 250), c(500, 1, 1)) data[181:330, 1, 1] <- 0 pe <- PhysioExperiment( assays = list(raw = data), samplingRate = 1000 ) corticalSilentPeriod(pe, epoch_start_ms = -100)data <- array(rep(c(-1, 1), 250), c(500, 1, 1)) data[181:330, 1, 1] <- 0 pe <- PhysioExperiment( assays = list(raw = data), samplingRate = 1000 ) corticalSilentPeriod(pe, epoch_start_ms = -100)
Measures late F-wave peak-to-peak amplitude and onset latency after peripheral stimulation, then reports persistence, latency dispersion, and the mean F/M amplitude ratio.
fWaveDetect( x, f_window_ms = c(20, 60), m_window_ms = c(2, 12), epoch_start_ms = 0, amplitude_threshold = 0.04, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 0.5, channel = 1, assay_name = NULL )fWaveDetect( x, f_window_ms = c(20, 60), m_window_ms = c(2, 12), epoch_start_ms = 0, amplitude_threshold = 0.04, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 0.5, channel = 1, assay_name = NULL )
x |
A |
f_window_ms |
F-wave search window relative to the stimulus, in milliseconds. |
m_window_ms |
Direct M-wave window relative to the stimulus, in milliseconds. |
epoch_start_ms |
Time of the first epoch sample relative to the stimulus. |
amplitude_threshold |
Minimum F-wave peak-to-peak amplitude in the assay's native unit. |
baseline_window_ms |
Optional latency baseline interval. The default uses all pre-stimulus samples. |
threshold_sd |
Baseline standard-deviation multiplier for onset. |
min_consecutive_ms |
Required onset-threshold duration. |
channel |
One channel label or 1-based index. |
assay_name |
Optional assay name. |
An f_wave_result list containing per-trial waves, a one-row
summary, and analysis settings.
Fisher MA (2007). F-waves: physiology and clinical uses. TheScientificWorldJournal, 7:144-160. doi:10.1100/tsw.2007.49
pe <- make_mep(n_trials = 5, mep_latency_ms = 25, seed = 3) fWaveDetect( pe, m_window_ms = c(10, 18), f_window_ms = c(20, 60), epoch_start_ms = -20 )pe <- make_mep(n_trials = 5, mep_latency_ms = 25, seed = 3) fWaveDetect( pe, m_window_ms = c(10, 18), f_window_ms = c(20, 60), epoch_start_ms = -20 )
Retrieve TMS pulse metadata
getTMSpulses(x)getTMSpulses(x)
x |
A |
A six-column data frame with one row per stored pulse, or a typed zero-row table when TMS metadata are absent.
getTMSpulses(make_mep(n_trials = 3))getTMSpulses(make_mep(n_trials = 3))
Calculate the Hmax/Mmax ratio
hMaxMMax(recruitment)hMaxMMax(recruitment)
recruitment |
An H-reflex recruitment table returned by
|
A one-row data frame containing observed maxima, their lowest tied intensities, and the dimensionless Hmax/Mmax ratio.
recruitment <- data.frame( intensity = c(10, 20, 30), h_p2p = c(0.2, 1, 0.8), m_p2p = c(0.5, 1.5, 2) ) hMaxMMax(recruitment)recruitment <- data.frame( intensity = c(10, 20, 30), h_p2p = c(0.2, 1, 0.8), m_p2p = c(0.5, 1.5, 2) ) hMaxMMax(recruitment)
Uses the baseline-standard-deviation threshold and persistent-run detector
from mepLatency() within an H-reflex-specific search window.
hReflexLatency( x, h_window_ms = c(20, 45), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 1, channel = 1, assay_name = NULL )hReflexLatency( x, h_window_ms = c(20, 45), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 1, channel = 1, assay_name = NULL )
x |
A |
h_window_ms |
H-reflex window relative to the stimulus, in milliseconds. |
epoch_start_ms |
Time of the first epoch sample relative to the stimulus. |
baseline_window_ms |
Optional baseline interval. The default uses all pre-stimulus samples. |
threshold_sd |
Baseline standard-deviation multiplier. |
min_consecutive_ms |
Required duration of a threshold crossing. |
channel |
One channel label or 1-based index. |
assay_name |
Optional assay name. |
A data frame containing onset sample and stimulus-relative H-reflex latency for each trial.
pe <- make_mep(n_trials = 3, mep_latency_ms = 25, seed = 2) hReflexLatency(pe, epoch_start_ms = -20)pe <- make_mep(n_trials = 3, mep_latency_ms = 25, seed = 2) hReflexLatency(pe, epoch_start_ms = -20)
Measures peak-to-peak direct motor (M) and Hoffmann-reflex (H) responses in separate post-stimulus windows for each trial.
hReflexRecruitment( x, intensity, m_window_ms = c(2, 12), h_window_ms = c(20, 45), epoch_start_ms = 0, channel = 1, assay_name = NULL )hReflexRecruitment( x, intensity, m_window_ms = c(2, 12), h_window_ms = c(20, 45), epoch_start_ms = 0, channel = 1, assay_name = NULL )
x |
A |
intensity |
Finite stimulation intensity, one value per trial. Values remain in the caller's native stimulator unit. |
m_window_ms |
Direct M-wave window relative to the stimulus, in milliseconds. |
h_window_ms |
H-reflex window relative to the stimulus, in milliseconds. |
epoch_start_ms |
Time of the first epoch sample relative to the stimulus. |
channel |
One channel label or 1-based index. |
assay_name |
Optional assay name. |
A data frame with one row per trial and M/H peak-to-peak amplitudes and fiducial samples.
Palmieri RM, Ingersoll CD, Hoffman MA (2004). The Hoffmann reflex: methodologic considerations and applications for use in sports medicine and athletic training research. Journal of Athletic Training, 39:268-277.
pe <- make_mep(n_trials = 3, intensities = c(30, 40, 50), seed = 1) hReflexRecruitment( pe, c(10, 20, 30), m_window_ms = c(10, 18), h_window_ms = c(20, 60), epoch_start_ms = -20 )pe <- make_mep(n_trials = 3, intensities = c(30, 40, 50), seed = 1) hReflexRecruitment( pe, c(10, 20, 30), m_window_ms = c(10, 18), h_window_ms = c(20, 60), epoch_start_ms = -20 )
Finds the lowest stimulation intensity whose mean H amplitude reaches an absolute cutoff or a fraction of the observed Mmax.
hReflexThreshold(recruitment, criterion = 0.05, scale = c("mmax", "absolute"))hReflexThreshold(recruitment, criterion = 0.05, scale = c("mmax", "absolute"))
recruitment |
An H-reflex recruitment table returned by
|
criterion |
Non-negative absolute amplitude, or a fraction in |
scale |
Whether |
A one-row data frame containing the first qualifying intensity, applied cutoff, and scale.
recruitment <- data.frame( intensity = c(10, 20, 30), h_p2p = c(0.1, 0.5, 1), m_p2p = c(0.2, 0.8, 2.5) ) hReflexThreshold(recruitment, criterion = 0.2)recruitment <- data.frame( intensity = c(10, 20, 30), h_p2p = c(0.1, 0.5, 1), m_p2p = c(0.2, 0.8, 2.5) ) hReflexThreshold(recruitment, criterion = 0.2)
Generates biphasic MEP waveforms with known latency and a Boltzmann amplitude-intensity relationship.
make_mep( n_time = 600, n_channels = 1, n_trials = 12, sr = 5000, epoch_start_ms = -20, intensities = NULL, plateau = 2, s50 = 50, k = 5, mep_latency_ms = 20, mep_dur_ms = 10, baseline_sd = 0.02, seed = NULL )make_mep( n_time = 600, n_channels = 1, n_trials = 12, sr = 5000, epoch_start_ms = -20, intensities = NULL, plateau = 2, s50 = 50, k = 5, mep_latency_ms = 20, mep_dur_ms = 10, baseline_sd = 0.02, seed = NULL )
n_time |
Number of samples per epoch. |
n_channels |
Number of MEP channels. |
n_trials |
Number of TMS trials. |
sr |
Sampling rate in Hz. |
epoch_start_ms |
Time of the first sample relative to the TMS pulse. |
intensities |
Per-trial stimulation intensity in |
plateau, s50, k
|
Boltzmann recruitment parameters. |
mep_latency_ms |
Planted MEP onset latency. |
mep_dur_ms |
Duration of the one-cycle biphasic waveform. |
baseline_sd |
Gaussian baseline-noise standard deviation. |
seed |
Optional random seed. |
An epoched PhysioExperiment with TMS pulse metadata.
pe <- make_mep(n_trials = 5, seed = 1) dim(SummarizedExperiment::assay(pe)) getTMSpulses(pe)pe <- make_mep(n_trials = 5, seed = 1) dim(SummarizedExperiment::assay(pe)) getTMSpulses(pe)
Calculates peak-to-peak MEP amplitude within a response window for every selected channel and trial.
mepAmplitude( x, response_window_ms = c(10, 60), epoch_start_ms = 0, channels = NULL, assay_name = NULL )mepAmplitude( x, response_window_ms = c(10, 60), epoch_start_ms = 0, channels = NULL, assay_name = NULL )
x |
A |
response_window_ms |
Two response-window limits relative to the TMS pulse, in milliseconds. |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
channels |
Optional channel labels or 1-based indices. |
assay_name |
Optional assay name. |
A data frame with one row per selected channel and trial.
Rossini PM, Burke D, Chen R, et al. (2015). Non-invasive electrical and magnetic stimulation of the brain, spinal cord, roots and peripheral nerves: basic principles and procedures for routine clinical and research application. Clinical Neurophysiology, 126:1071-1107. doi:10.1016/j.clinph.2015.02.001
pe <- make_mep(n_trials = 4, seed = 1) mepAmplitude(pe, epoch_start_ms = -20)pe <- make_mep(n_trials = 4, seed = 1) mepAmplitude(pe, epoch_start_ms = -20)
Detects the first persistent signed deviation from the baseline mean above a multiple of the baseline standard deviation.
mepLatency( x, response_window_ms = c(5, 50), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 1, channels = NULL, assay_name = NULL )mepLatency( x, response_window_ms = c(5, 50), epoch_start_ms = 0, baseline_window_ms = NULL, threshold_sd = 3, min_consecutive_ms = 1, channels = NULL, assay_name = NULL )
x |
A |
response_window_ms |
Search window relative to the TMS pulse. |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
baseline_window_ms |
Optional baseline interval. The default uses all pre-stimulus samples. |
threshold_sd |
Baseline standard-deviation multiplier. |
min_consecutive_ms |
Required duration of a threshold crossing. |
channels |
Optional channel labels or 1-based indices. |
assay_name |
Optional assay name. |
A data frame containing onset sample and latency for each selected channel and trial.
pe <- make_mep(n_trials = 4, intensities = rep(65, 4), seed = 2) mepLatency(pe, epoch_start_ms = -20)pe <- make_mep(n_trials = 4, intensities = rep(65, 4), seed = 2) mepLatency(pe, epoch_start_ms = -20)
Compares conditioned motor-evoked-potential amplitudes with the aggregate unconditioned test response at each interstimulus interval (ISI).
pairedPulse( x, condition, isi_ms, response_window_ms = c(10, 60), epoch_start_ms = 0, channel = 1, assay_name = NULL, aggregate = c("mean", "median") )pairedPulse( x, condition, isi_ms, response_window_ms = c(10, 60), epoch_start_ms = 0, channel = 1, assay_name = NULL, aggregate = c("mean", "median") )
x |
An epoched |
condition |
Per-trial labels, exactly |
isi_ms |
Per-trial interstimulus interval in milliseconds. Use |
response_window_ms |
MEP response window relative to the test pulse. |
epoch_start_ms |
Time of the first epoch sample relative to the test pulse. |
channel |
One channel label or 1-based index. |
assay_name |
Optional assay name. |
aggregate |
Whether to summarize amplitudes by the mean or median. |
A data frame with one row per conditioned ISI and conditioned/test amplitudes, their ratio, inhibition, and facilitation.
Kujirai T, Caramia MD, Rothwell JC, et al. (1993). Corticocortical inhibition in human motor cortex. Journal of Physiology, 471:501-519. doi:10.1113/jphysiol.1993.sp019912
pe <- make_mep( n_trials = 6, intensities = rep(50, 6), baseline_sd = 0, seed = 1 ) pairedPulse( pe, condition = c("test", "test", rep("conditioned", 4)), isi_ms = c(NA, NA, 2, 2, 10, 10), epoch_start_ms = -20 )pe <- make_mep( n_trials = 6, intensities = rep(50, 6), baseline_sd = 0, seed = 1 ) pairedPulse( pe, condition = c("test", "test", rep("conditioned", 4)), isi_ms = c(NA, NA, 2, 2, 10, 10), epoch_start_ms = -20 )
Implements the day-3 PREP2 decision tree from SAFE score, age, motor-evoked potential status, and NIH Stroke Scale score.
prep2(safe_score, age, mep_status = NULL, nihss = NULL)prep2(safe_score, age, mep_status = NULL, nihss = NULL)
safe_score |
Shoulder Abduction and Finger Extension MRC sum, an integer from 0 to 10. |
age |
Age in years. |
mep_status |
Optional MEP status: logical, |
nihss |
Optional day-3 NIHSS total, an integer from 0 to 42. |
A prep2_result containing category, decision pathway, inputs, and
a clinical description.
Stinear CM, Byblow WD, Ackerley SJ, Smith MC, Stinear JW, Barber PA (2017). PREP2: A biomarker-based algorithm for predicting upper limb function after stroke. Annals of Clinical and Translational Neurology, 4:811-820. doi:10.1002/acn3.488
prep2(safe_score = 8, age = 65) prep2(2, 70, mep_status = "absent", nihss = 5)prep2(safe_score = 8, age = 65) prep2(2, 70, mep_status = "absent", nihss = 5)
Fits peak-to-peak MEP amplitude against stimulator intensity with a three-parameter logistic curve.
recruitmentCurve( x, channel = 1, response_window_ms = c(10, 60), epoch_start_ms = 0, intensity = NULL, assay_name = NULL )recruitmentCurve( x, channel = 1, response_window_ms = c(10, 60), epoch_start_ms = 0, intensity = NULL, assay_name = NULL )
x |
An epoched MEP |
channel |
One channel label or 1-based index. |
response_window_ms |
MEP response window in milliseconds. |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
intensity |
Optional per-trial stimulation intensity in |
assay_name |
Optional assay name. |
A recruitment_curve object with fitted parameters, predictions,
fit quality, and the underlying nls model.
Devanne H, Lavoie BA, Capaday C (1997). Input-output properties and gain changes in the human corticospinal pathway. Experimental Brain Research, 114:329-338. doi:10.1007/PL00005641
pe <- make_mep(n_trials = 15, baseline_sd = 0.001, seed = 3) recruitmentCurve(pe, epoch_start_ms = -20)pe <- make_mep(n_trials = 15, baseline_sd = 0.001, seed = 3) recruitmentCurve(pe, epoch_start_ms = -20)
Replaces sample-exact closed pulse/recharge intervals by a linear or cubic
Hermite bridge, or blanks them to zero or a trial-specific baseline.
The selected input assay is preserved unless overwrite = TRUE.
removeTMSpulse( x, pulse_window_ms = c(-2, 10), recharge_windows_ms = NULL, method = c("cubic", "linear", "blank"), support_ms = 2, blank_value = c("baseline", "zero"), baseline_window_ms = c(-200, -20), epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_pulse_clean", overwrite = FALSE )removeTMSpulse( x, pulse_window_ms = c(-2, 10), recharge_windows_ms = NULL, method = c("cubic", "linear", "blank"), support_ms = 2, blank_value = c("baseline", "zero"), baseline_window_ms = c(-200, -20), epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_pulse_clean", overwrite = FALSE )
x |
A |
pulse_window_ms |
Increasing pulse-window limits in milliseconds. |
recharge_windows_ms |
Optional increasing pair or n x 2 matrix. |
method |
Exactly |
support_ms |
One positive derivative-support duration for cubic interpolation, in milliseconds. |
blank_value |
Exactly |
baseline_window_ms |
Closed baseline interval in milliseconds. |
epoch_start_ms |
Time of the first sample relative to the pulse. |
assay_name |
Optional input assay name. |
output_assay |
Output assay name. |
overwrite |
Whether to overwrite the selected input assay. |
Closed intervals use
round((time_ms - epoch_start_ms) / 1000 * sampling_rate) + 1.
Overlapping or sample-adjacent pulse/recharge intervals are merged. Linear
and cubic methods require real samples on both sides and never bridge across
a second removed interval. Baseline settings do not affect interpolation or
zero blanking. Baseline blanking requires at least two samples wholly outside
every removed interval. The audit metadata contains the complete altered
mask, merged sample ranges, continuity jumps, and robust baseline noise.
A modified PhysioExperiment with an appended TMS-EEG audit step.
Rogasch NC, Sullivan C, Thomson RH, et al. (2017). Analysing concurrent transcranial magnetic stimulation and electroencephalographic data. NeuroImage, 147:934-951. doi:10.1016/j.neuroimage.2016.10.031
Stores one pulse row per trial without replacing other experiment metadata.
Intensity and resting motor threshold are expressed as percent of maximum
stimulator output (%MSO).
setTMSpulses( x, intensity_pct_mso, target = NA_character_, coil = NA_character_, rmt_pct_mso = NA_real_, onset_sec = NA_real_ )setTMSpulses( x, intensity_pct_mso, target = NA_character_, coil = NA_character_, rmt_pct_mso = NA_real_, onset_sec = NA_real_ )
x |
A |
intensity_pct_mso |
Numeric stimulation intensity, one value per trial. |
target |
Cortical target or target-muscle label. |
coil |
Coil descriptor. |
rmt_pct_mso |
Resting motor threshold in |
onset_sec |
Pulse onset in the source continuous recording, in seconds. |
The modified PhysioExperiment.
pe <- make_mep(n_trials = 3, intensities = c(40, 50, 60)) pe <- setTMSpulses(pe, c(40, 50, 60), target = "M1_FDI") getTMSpulses(pe)pe <- make_mep(n_trials = 3, intensities = c(40, 50, 60)) pe <- setTMSpulses(pe, c(40, 50, 60), target = "M1_FDI") getTMSpulses(pe)
Summarize short-interval inhibition and intracortical facilitation
siciIcf(paired, sici_range_ms = c(1, 5), icf_range_ms = c(7, 20))siciIcf(paired, sici_range_ms = c(1, 5), icf_range_ms = c(7, 20))
paired |
A table returned by |
sici_range_ms |
Closed SICI ISI range in milliseconds. |
icf_range_ms |
Closed ICF ISI range in milliseconds. |
A one-row data frame with conditioned-trial-weighted SICI and ICF ratios, percentages, and trial counts.
paired <- data.frame( isi_ms = c(2, 3, 10, 15), n_conditioned = rep(2L, 4), ratio = c(0.4, 0.5, 1.5, 1.4) ) siciIcf(paired)paired <- data.frame( isi_ms = c(2, 3, 10, 15), n_conditioned = rep(2L, 4), ratio = c(0.4, 0.5, 1.5, 1.4) ) siciIcf(paired)
Implements simultaneous leave-one-sensor noise estimation followed by the source-space Wiener reconstruction of the SOUND algorithm.
soundClean( x, forward_model, lambda = 0.1, iterations = 10L, tolerance = 0.01, reference = "average", analysis_window_ms = NULL, epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_sound", overwrite = FALSE )soundClean( x, forward_model, lambda = 0.1, iterations = 10L, tolerance = 0.01, reference = "average", analysis_window_ms = NULL, epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_sound", overwrite = FALSE )
x |
A pulse-cleaned |
forward_model |
A list containing a finite channel-matched |
lambda |
Positive source-reconstruction regularization. |
iterations |
Maximum number of complete simultaneous updates. |
tolerance |
Non-negative maximum relative noise change for convergence. |
reference |
Currently exactly |
analysis_window_ms |
Optional closed noise-estimation interval. |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
assay_name |
Optional pulse-cleaned input assay. |
output_assay |
Output assay name. |
overwrite |
Whether to overwrite the selected input assay. |
SOUND assumes diagonal sensor noise, an approximate channel-matched lead field, and i.i.d. source amplitudes for its regularized reconstruction. All channel noise estimates are updated simultaneously from the preceding round, and one final cleaning matrix is applied to every sample and trial. Pulse samples are excluded from noise estimation. Regularization is not a significance threshold and is not optimized against the reported TEP peaks.
A modified PhysioExperiment with the fixed SOUND cleaning matrix,
complete noise history, and convergence diagnostics.
Mutanen TP, Metsomaa J, Liljander S, Ilmoniemi RJ (2018). Automatic and robust noise suppression in EEG and MEG: The SOUND algorithm. NeuroImage, 166:135-151. doi:10.1016/j.neuroimage.2017.10.021
Baseline-corrects every trial and channel before a mean or trimmed mean, then finds signed peaks independently in each requested channel.
tepAverage( x, components = c("N15", "P30", "N45", "P60", "N100", "P180"), windows_ms = NULL, channels = NULL, baseline_window_ms = c(-200, -20), epoch_start_ms = 0, average = c("mean", "trimmed"), trim = 0.2, assay_name = NULL )tepAverage( x, components = c("N15", "P30", "N45", "P60", "N100", "P180"), windows_ms = NULL, channels = NULL, baseline_window_ms = c(-200, -20), epoch_start_ms = 0, average = c("mean", "trimmed"), trim = 0.2, assay_name = NULL )
x |
A |
components |
Exact canonical component names in requested order. |
windows_ms |
Optional named component x 2 override matrix. |
channels |
Optional exact labels or 1-based indices. |
baseline_window_ms |
Closed baseline interval. |
epoch_start_ms |
Time of the first sample relative to the pulse. |
average |
Exactly |
trim |
Trim fraction in |
assay_name |
Optional assay name. |
Default signed peak windows are N15 (10–20 ms), P30 (20–40 ms), N45 (35–55 ms), P60 (50–75 ms), N100 (80–140 ms), and P180 (140–220 ms). Exact ties use the earliest sample and a peak on a window endpoint is marked as a boundary diagnostic. Canonical names define measurement windows only. Auditory and somatosensory responses can remain, and no component is evidence of a verified cortical source.
A tms_tep list with waveform, component, and settings tables.
Rogasch NC, Sullivan C, Thomson RH, et al. (2017). Analysing concurrent transcranial magnetic stimulation and electroencephalographic data. NeuroImage, 147:934-951. doi:10.1016/j.neuroimage.2016.10.031
Estimates one deterministic artifact subspace across trials and reconstructs the retained activity through a channel-matched lead field.
tmsSSPSIR( x, forward_model, artifact_window_ms = c(5, 50), n_artifact = NULL, variance_fraction = 0.9, lambda = 0.05, reference = "average", epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_sspsir", overwrite = FALSE )tmsSSPSIR( x, forward_model, artifact_window_ms = c(5, 50), n_artifact = NULL, variance_fraction = 0.9, lambda = 0.05, reference = "average", epoch_start_ms = 0, assay_name = NULL, output_assay = "tms_sspsir", overwrite = FALSE )
x |
A pulse-cleaned |
forward_model |
A list containing a finite channel-matched |
artifact_window_ms |
Closed artifact-training interval. |
n_artifact |
Optional exact number of artifact components. |
variance_fraction |
Cumulative artifact variance target when
|
lambda |
Positive source-reconstruction regularization. |
reference |
Currently exactly |
epoch_start_ms |
Time of the first epoch sample relative to the pulse. |
assay_name |
Optional pulse-cleaned input assay. |
output_assay |
Output assay name. |
overwrite |
Whether to overwrite the selected input assay. |
The pulse must already be removed or hardware absence must be explicitly
declared in metadata(x)$tms_eeg$pulse_absent. Both data and lead field are
average referenced with the same matrix. The returned data use the fixed
source-informed reconstruction Lr G P, not the plain SSP projection P.
SSP-SIR can attenuate neural signal when the artifact and neural subspaces
overlap; a lead field is an approximate physical model, not proof that a
retained deflection is cortical.
A modified PhysioExperiment with fixed SSP-SIR reconstruction
metadata.
Mutanen TP, Kukkonen M, Nieminen JO, et al. (2016). Recovering TMS-evoked EEG responses masked by muscle artifacts. NeuroImage, 139:157-166. doi:10.1016/j.neuroimage.2016.05.028