Skip to content

Commit

Permalink
remove pulse tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hhorii committed Aug 1, 2023
1 parent 07d9aea commit cd2324b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 119 deletions.
49 changes: 0 additions & 49 deletions test/terra/backends/pulse_sim_independent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import numpy as np
from scipy.linalg import expm
from qiskit_aer.pulse.de.DE_Methods import ScipyODE
from qiskit_aer.pulse.de.DE_Options import DE_Options

I = np.eye(2, dtype=complex)
X = np.array([[0.0, 1.0], [1.0, 0.0]])
Expand Down Expand Up @@ -66,53 +64,6 @@ def generator_in_frame(drift, control_ops, chan_vals, diag_frame, t):

return np.diag(U_inv) @ G @ np.diag(U)


def simulate_system(y0, drift, control_ops, channel_freqs, channel_samples, dt, diag_frame):
"""Simulate the DE y' = G(t) @ y, where G(t) = drift + a0(t) * A0 + ... + ak(t) Ak, where
control_ops = [A0, ..., Ak], and the aj(t) are the values of the signals specified
by channel_freqs, channel_samples, and dt
Args:
y0 (array): initial state
drift (array): 2d drift generator
control_ops (array): 3d array representing a list of control operators
channel_freqs (array): 1d array of channel frequencies
channel_samples (array): 2d array of channel samples, the first index being time step and
the second index indexing channel
dt (float): size of each sample
diag_frame (array): 1d array representing an already diagonalized frame operator
assumed to be purely imaginary
Returns:
array: final state of the DE
"""

# if all channel freqs are 0 simulate using matrix exponentiation
if all(channel_freqs == 0):
yf = y0
for t_idx in range(len(channel_samples)):
yf = expm(generator(drift, control_ops, channel_samples[t_idx]) * dt) @ yf

return yf

# else, simulate using standard ODE solver
else:
# set up rhs function in frame
def rhs(t, y):
chan_vals = channel_values(channel_freqs, channel_samples, dt, t)
gen = generator_in_frame(drift, control_ops, chan_vals, diag_frame, t)
return gen @ y

de_options = DE_Options(method="RK45")
ode_method = ScipyODE(t0=0.0, y0=y0, rhs=rhs, options=de_options)

T = len(channel_samples) * dt
ode_method.integrate(T)
yf = np.exp(diag_frame * T) * ode_method.y

return yf


def simulate_1q_model(y0, q_freq, r, drive_freqs, drive_samples, dt):
"""Simulate a basic 1 qubit model H(t) = 2 pi q_freq Z / 2 + 2 pi r D(t) * X / 2,
where D(t) is the drive signal given by drive_freqs, drive_samples and dt
Expand Down
70 changes: 0 additions & 70 deletions test/terra/test_python_to_cpp.py

This file was deleted.

0 comments on commit cd2324b

Please sign in to comment.