last_second_0 = simulation[0, current_indices[0] - 1]
last_second_1 = simulation[1, current_indices[1] - 1]
last_second = max(last_second_0, last_second_1)

# Number of points at which the intensity will be computed between
# 0 and last_second
resolution = 1000
target_index = 0

# Computation of the intensity of the first component
targets_0 = np.linspace(0.0, last_second, resolution) # Instants at which the intensity will be computed
jumps_0 = simulation[target_index, :current_indices[target_index]]
intensities_0 = Intensity_wrapper.get_intensities(simulation,
                                         targets_0,
                                         target_index,
                                         current_indices,
                                         mus,
                                         alphas,
                                         betas)

# Computation of the intensity if the second component
target_index = 1
targets_1 = np.linspace(0, last_second, resolution) # Instants at which the intensity will be computed
jumps_1 = simulation[target_index, :current_indices[target_index]]
intensities_1 = Intensity_wrapper.get_intensities(simulation,
                                         targets_1,
                                         target_index,
                                         current_indices,
                                         mus,
                                         alphas,
                                         betas)
last_second_3 = simulation[2, current_indices[2] - 1]
last_second_4 = simulation[3, current_indices[3] - 1]
last_second = max(last_second_1, last_second_2, last_second_3, last_second_3)

# Number of points between 0 and last_second for which the intensities
# will be computed
resolution = 1000

# Compute the intensity of the first component
target_index = 0
targets_1 = np.linspace(
    0.0, last_second,
    resolution)  # Instants at which the intensity will be computed
jumps_1 = simulation[target_index, :current_indices[target_index]]
intensities_1 = Intensity_wrapper.get_intensities(simulation, targets_1,
                                                  target_index,
                                                  current_indices, mus, alphas,
                                                  betas)

# Compute the intensity of the second component
target_index = 1
targets_2 = np.linspace(
    0, last_second,
    resolution)  # Instants at which the intensity will be computed
jumps_2 = simulation[target_index, :current_indices[target_index]]
intensities_2 = Intensity_wrapper.get_intensities(simulation, targets_2,
                                                  target_index,
                                                  current_indices, mus, alphas,
                                                  betas)

# Compute the intensity of the third component
target_index = 2
current_indices = example_sim['current_indices'] # Last indices of valid jumps

# Print the number of jumps of each component
print current_indices

# Compute the intensity of the first component
last_second_0 = simulation[0, current_indices[0] - 1] # Trimming
last_second = last_second_0
resolution = 1000
target_index = 0
targets_0 = np.linspace(0.0, last_second, resolution) # Instants at which the intensity will be computed
jumps_0 = simulation[target_index, :current_indices[target_index]] # Trimming
intensities_0 = Intensity_wrapper.get_intensities(simulation,
                                         targets_0,
                                         target_index,
                                         current_indices,
                                         mus,
                                         alphas,
                                         betas)

# Plot the intensity and the jumps
plt.plot(targets_0, exact_mu * np.ones(len(targets_0)), c = 'b', linestyle = '--')
plt.plot(targets_0, intensities_0, c = 'g')
plt.plot(jumps_0, 0.35 * np.ones(len(jumps_0)), linestyle = 'None', marker = '^', c = 'g')
plt.title('Self-exciting Point Process')
plt.xlabel('t')
plt.legend(('Constant mu', 'Intensity', 'Jumps'))
plt.ylim(0, 0.4)
fig = plt.gcf()
fig.set_size_inches((12, 8))
plt.savefig('1dimension.png', dpi = 300)