def z_score(PE_data, baseline=None):
	"""
	Will perform z-score normalization on the peri-event data in PE_data. PE_data
	should be a Dataframe with the trials as columns and a timeline as index.
	The mean and std will be calculated over the baseline (T<0) unless a specific
	baseline is given.

	Examples:

		>>> PE_norm = z_score(PE_data, baseline = [-10, -5])
		>>> # This will use the interval from T=-10 to T=-5 as the baseline.

	"""

	# Baseline
	if baseline == None:
		baseline = PE_data.index<0
	else:
		baseline = (PE_data.index>=baseline[0]) & (PE_data.index<baseline[1])

	# Perform z-score normalization
	new_data = PE_data.copy()
	new_data = new_data - new_data.iloc[baseline, :].mean(axis=0)
	new_data = new_data/new_data.iloc[baseline, :].std(axis=0)
	new_data.signal_type = 'Signal (Z-score)'

	return new_data