> For the complete documentation index, see [llms.txt](https://nigelrogasch.gitbook.io/tesa-user-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nigelrogasch.gitbook.io/tesa-user-manual/find_and_mark_tms_pulse.md).

# Find and mark TMS pulses

To generate TMS-evoked potentials from EEG recordings, an accurate record of precisely when the TMS pulse was given is required. However, recording TMS triggers in EEG may not always be available due to the experimental arrangement or simply human error. TESA has several functions which use the large TMS pulse recording artifact to detect and mark when TMS pulses occur.

## Finding TMS pulses in continuous data

The [tesa\_findpulse](/tesa-user-manual/find_and_mark_tms_pulse/find_tms_pulse.md) function is useful when no trigger events have been recorded and searches for large rate changes in EEG amplitude during continuous EEG recordings.

&#x20;

![](/files/-LmJDGnfZZry9zh9OvHL)

**Example of TMS pulses found using tesa\_findpulse.** TMS events are now stored in the EEGLAB data structure.

## Correcting TMS event latencies

If TMS trigger events were recorded, however these triggers did not accurately mark the TMS pulse onset, the [tesa\_fixevent](/tesa-user-manual/find_and_mark_tms_pulse/fix_tms_pulse.md) function corrects TMS trigger event latency on epoched EEG data.

&#x20;

![](/files/-LmJDGnheLBlbL2M5w-q)

**Example of TMS event latencies corrected using tesa\_fixevent.** Original event latencies on the left were approximately 7 ms earlier than the actual TMS pulse. This latency was corrected by tesa\_fixevent on right.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
