# Remove and interpolate TMS pulse artifacts

The artifact resulting from the TMS pulse is several orders of magnitude larger than neural activity recorded with EEG. Fortunately, this artifact recovers within 2-10 ms. However, the large amplitude and high frequency of this artifact prevents the use of filters, the application of which can improve ICA decomposition. Furthermore, TMS-evoked muscle activity is also considerably larger than neural activity and occurs within 5 ms following the TMS pulse and lasts up to 50 ms. A simple approach to deal with the TMS pulse artifact is to remove the affected data, although if TMS-evoked muscle activity is present a large amplitde step will still exist in the data (see example 1). Interpolation of the missing data can minimise any ringing artifacts following the use of filters if used appropriately. TESA includes options to [remove the TMS pulse artifact](/tesa-user-manual/remove_interpolate/remove_tms_pulse.md) and to [interpolate the missing data](/tesa-user-manual/remove_interpolate/interpolate_removed_data.md). Below are two scenarios where this is useful: prior to downsampling (which requires a lowpass filter to prevent aliasing) and prior to bandpass filtering.

&#x20;

![](/files/-LmJDFhIkoky4Xlv30Uu)

**Example 1 - removing the TMS pulse artifact prior to downsampling.** The large amplitude TMS pulse artifact is removed (between -2 and 10 ms) and replaced with 0s (centre figure). The missing data is then interpolated using a linear fit prior to downsampling to minimise ringing artifacts resulting from the anti-aliasing filters.

&#x20;

![](/files/-LmJDFhKa1lYibqR8h-d)

**Example 2 - removing the TMS-evoked muscle artifact prior to bandpass filtering.** TESA offers several options to [remove TMS-evoked muscle activity](/tesa-user-manual/remove_minimise_tms_muscle_activity.md), such as FastICA. Prior to FastICA, interpolated data can be removed (-2 to 10 ms) to help identify components representing TMS-evoked muscle activity (top left). Although FastICA removes most of the TMS-evoked muscle artifact, a small residual artifact lasting up to 15 ms is still present (top middle). The removed data can be extended to account for this small artifact (-2 to 15 ms; top right). The missing data are then interpolated to prevent ringing artifacts following bandpass filtering (bottom figures).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nigelrogasch.gitbook.io/tesa-user-manual/remove_interpolate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
