Superfast qE Model¶

This is a test

In [ ]:
import delta_psi_py as psi
import superFastqE as sfq
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
In [ ]:
def exp_decay(x, a, b, c):
    return a * np.exp(-b * x) + c

def add_random_noise(y, scale=0.1):
    noise = np.random.normal(0, scale, len(y))
    return y + noise

def add_sine_noise(time, y, freq, amp):
    y_noise = amp * np.sin(2 * np.pi * freq * time)
    return y_noise + y
In [ ]:
# time in ms
step = 1
time_bl = 50
time_exp = 80
time_rec = 60
total_time = time_bl + time_exp + time_rec
time = np.arange(0, total_time, step)

time_bl = np.arange(0, time_bl, step)
time_decay = np.arange(0, time_exp, step)
time_rec = np.arange(0, time_rec, step)

y_bl = np.zeros(len(time_bl))
y_decay = exp_decay(time_decay, 1, 0.1, -1)
y_rec = exp_decay(time_rec, -1, 0.1, 0)
y = np.concatenate((y_bl, y_decay, y_rec))

y_sin = add_sine_noise(time, y, 0.2, 0.02)
y_noise = add_random_noise(y_sin, scale=0.03)


plt.figure(figsize=(8,6))
plt.plot(time, y)
plt.plot(time, y_noise)
plt.plot(time, y_sin)
plt.xlim(0, len(y))
plt.grid(alpha=0.3)
plt.show()
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: