Embodiments of a method for removal and replacement of artifacts in electrophysiological data from muscular activity in the gastrointestinal tract of a patient are disclosed. The approach includes setting an artifact identification threshold based on the parameters of the data, assessing the full extent of the artifact in time, and replacing the values with ones that are neutral in the time series and minimizing the effect on a power spectrum of the data. More particularly, the method includes steps of identifying artifacts within the raw time series data, eliminating the identified artifacts, and replacing the artifacts with any of interpolated points or constant value points to create a clean time series data set representing valid gastrointestinal tract EMG signals.