import matplotlib.pyplot as plt
import numpy as np
from IPython import embed
time = np.arange(0.,10., 0.001)
x = np.random.randn(len(time))
f = np.ones(300)/300
x = np.convolve(x, f, mode='same')

selection = x[(time > 5.) & (time < 6.)]

fig = plt.figure()
fig.set_facecolor("white")
fig.set_size_inches(5.5, 2.5)

ax = fig.add_subplot(111)
ax.plot(time, x, label="data", lw=.5)
ax.plot(time[(time > 5.) & (time < 6.)], selection, color='r', lw=0.5, label="selection")
ax.spines["right"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')
ax.xaxis.linewidth=1.5
ax.yaxis.linewidth=1.5
ax.tick_params(direction="out", width=1.25)
ax.tick_params(direction="out", width=1.25)
ax.set_xlabel("time [s]")
ax.set_ylabel("intensity")
ax.legend(fontsize=8)
fig.tight_layout()
fig.savefig("logicalIndexingTime.pdf")


