For the parametrization, we choose a function model $M(\mathbf{p};x)$, which may be of the form
$$ M(\mathbf{p};x)=M(a, \mu, \sigma, \lambda; x)= \frac{a}{\sigma\sqrt{2\pi}} e^{\frac{-\left(x-\mu\right)^2}{2\sigma^2}} \left(1 + \text{erf}\left(\lambda\frac{x-\mu}{\sigma\sqrt{2}}\right)\right) $$with $\text{erf}(\cdot)$ as the error function and $\mathbf{p}=(a, \mu, \sigma, \lambda)$ as the fit coefficients.
import numpy as np
from scipy.special import erf
def asym_gaussian(p, x=0):
"""
Asymmetric Gaussian function model
"""
amp = p[0] / (p[2] * np.sqrt(2 * np.pi))
spread = np.exp((-(x - p[1]) ** 2.0) / (2 * p[2] ** 2.0))
skew = 1 + erf((p[3] * (x - p[1])) / (p[2] * np.sqrt(2)))
return amp * spread * skew
x = np.linspace(-5, 5, 1000)
norm, mean, sigm, skew = 10, -1, 2, 5
data = asym_gaussian([norm, mean, sigm, skew], x)
data_raw = data + .3 * np.random.randn(len(x))
%matplotlib inline
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 5))
plt.title('Synthetic data')
plt.plot(x, data_raw, label='raw signal')
[<matplotlib.lines.Line2D at 0x7fda9a8f9210>]