Download a saved vector from the board. \begin{DoxyVerb}import optoMDC
mre2 = optoMDC.connect()

start_address, num_elements = 0, 1024
vector = mre2.VectorPatternMemory.GetPatternSegment(start_address, num_elements)
\end{DoxyVerb}
 Set a DC output. \begin{DoxyVerb}import optoMDC
mre2 = optoMDC.connect()

# pick some value for current
amplitude_A = 0.250

static = mre2.Mirror.Channel_0.StaticInput
static.SetAsInput()
static.SetCurrent(amplitude_A)
\end{DoxyVerb}
 Output an impulse on one axis/channel. \begin{DoxyVerb}import optoMDC
mre2 = optoMDC.connect()

# pick a channel, amplitude, and impulse duration
channel = 1
amplitude_A = 0.07
duration_ms = 1.0

sig_gen = mre2.channel[channel].SignalGenerator
sig_gen.SetAsInput()
sig_gen.SetShape(optoMDC.WaveformShape.PULSE)
sig_gen.SetFrequency(1 / (2 * duration_ms / 1000))  # /1000 to convert to seconds
sig_gen.SetAmplitude(amplitude_A)
sig_gen.SetDutyCycle(0.5)
sig_gen.SetCycles(1)
sig_gen.SetUnit(optoMDC.UnitType.CURRENT)
sig_gen.Run()
\end{DoxyVerb}
 Upload a trapezoidal vector to the board. \begin{DoxyVerb}import numpy as np
import optoMDC
mre2 = optoMDC.connect()

# The hard part... building a vector.
# ----------------------------------
# pick a frequency, trans time, amplitude, and phase
frequency_Hz = 50
time_transition_ms = 2
amplitude_A = 0.1
phase_deg = 0.0
# calculate number of samples
period = 1 / frequency_Hz
num_samples = period * optoMDC.SAMPLING_FREQ
# we want an even number of samples per period, so it can be divided in two halves
num_samples = round(num_samples / 2.0) * 2
half_num_samples = num_samples // 2
# samples in transition and holding time
nsamples_tr = round(time_transition_ms / 1000 * optoMDC.SAMPLING_FREQ)
nsamples_hold = half_num_samples - nsamples_tr
# linspace takes both start and stop points, we need to discard the stop point and add one more sample point,
# so we use nsamples+1 and discard the last element of the vector [:-1]
vector = list(np.linspace(start=-amplitude_A, stop=amplitude_A, num=nsamples_tr + 1)[:-1]) \
         + [amplitude_A] * nsamples_hold \
         + list(np.linspace(start=amplitude_A, stop=-amplitude_A, num=nsamples_tr + 1)[:-1]) \
         + [-amplitude_A] * nsamples_hold
break_idx = round(phase_deg / 360.0 * len(vector))
vector = vector[break_idx:] + vector[:break_idx]

# now the easy part, send vector to the board!
# ----------------------------------
mre2.VectorPatternMemory.SetPattern(index=0, vector=vector)
\end{DoxyVerb}
 Run a saved vector on one axis/channel. \begin{DoxyVerb}import optoMDC
mre2 = optoMDC.connect()

vpu = mre2.Mirror.Channel_0.VectorPatternUnit
vpu.SetAsInput()
vpu.SetStart(0)
vpu.SetEnd(len(vector) - 1)
vpu.SetFreqSampleSpeed(optoMDC.SAMPLING_FREQ)
vpu.SetUnit(optoMDC.UnitType.CURRENT)
vpu.Run()
\end{DoxyVerb}
 