card¶
Here contained is the Card class.
-
class
wavgen.card.Card[source]¶ Class designed for Opening, Configuring, & Running the Spectrum AWG card.
-
cls.hCard¶ Handle to card device. See spectrum.pyspcm.py
- Type
Class object
-
ChanReady¶ Indicates channels are setup.
- Type
bool
-
BufReady¶ Indicates the card buffer is configured & loaded with waveform data.
- Type
bool
-
Sequence¶ Indicates whether Sequential (
load_sequence()) mode has been selected most recently.- Type
Bool
-
Wave¶ Object containing a trap configuration’s
Superpositionobject. Used when optimizing the waveform’s magnitude parameters for homogeneous trap intensity.- Type
-
__init__()[source]¶ Establishes connection to Spectrum card. The returned object is a handle to that connection.
-
setup_channels(amplitude=210, ch0=False, ch1=True, use_filter=False)[source]¶ Performs a Standard Initialization for designated Channels & Trigger.
- Parameters
amplitude (float, optional) – Sets the Output Amplitude RANGE: [80 - 2000](mV) inclusive
ch0 (bool, optional) – To Activate Channel0
ch1 (bool, optional) – To Activate Channel1
use_filter (bool, optional) – To Activate Output Filter
Notes
Todo
Complete ability to configure triggers.
Todo
Add support for simultaneous use of both channels.
-
load_waveforms(wavs, offset=0)[source]¶ Writes a set of waveforms as a single block to card.
Note
This operation will wipe any waveforms that were previously on the card.
- Parameters
wavs (
Waveform, list ofWaveform) – The given waves will be transferred to board memory in order.offset (int, optional) – If data already exists on the board, you can partially overwrite it by indicating where to begin writing (in bytes from the mem start). You cannot exceed the set size of the pre-existing data
-
load_sequence(waveforms=None, steps=None)[source]¶ Transfers sequence waveforms and/or transition steps to board.
- Parameters
waveforms (list of
Waveform, list of (int,Waveform)) – Waveform objects to each be written to a board segment. If each is paired with an index, then the corresponding segment indices are overwritten. You can only overwrite if an initial sequence is present on board.steps (list of
Step) – Transition steps which define looping & order of segment playback.
See also
Examples
Transferring an initial sequence:
hCard # Opened & configured Board handle myWaves = [wav0, wav2, wav3] mySteps = [step1, step3] # A hCard.load_sequence(myWaves, mySteps) hCard.load_sequence(myWaves) hCard.load_sequence(steps=mySteps)
-
wiggle_output(duration=None, cam=None, block=True)[source]¶ Performs a Standard Output for configured settings.
- Parameters
duration (int, float) – straight mode only Pass an integer to loop waveforms said number of times. Pass a float to loop waveforms for said number of milliseconds. Defaults to looping an infinite number of times.
cam (bool, optional) – Indicates whether to use Camera GUI. True or False selects Pre- or Post- chamber cameras respectively.
block (bool, optional) – Stops the card on function exit?
- Returns
WAVES! (This function itself actually returns void)
- Return type
None
-
stabilize_intensity(wav, cam=None, which_cam=None)[source]¶ Balances power across traps.
Applies an iterative update to the magnitude vector (corresponding to the trap array) upon image analysis. Converges to homogeneous intensity profile across traps.
Example
You could access this algorithm by passing a waveform object:
myWave = Superposition([79, 80, 81]) # Define a waveform hCard.stabilize_intensity(myWave) # Pass it into the optimizer
or through the GUI, offering camera view during the process:
# Define a wave & load the board memory. hCard.wiggle_output(self, cam=True) # Use button on GUI
- Parameters
wav (
Superposition) – The waveform object whose magnitudes will be optimized.which_cam (bool, optional) – True or False selects Pre- or Post- chamber cameras respectively.
cam (
instrumental.drivers.cameras.uc480) – The camera object opened byinstrumentalmodule.
-
_error_check(halt=True, print_err=True)[source]¶ Checks the Error Register.
- Parameters
halt (bool, optional) – Will halt program on discovery of error code.
print_err (bool, optional) – Will print the error code.
-
_transfer_sequence(wavs, indices)[source]¶ Tries to write each waveform, from a set, to an indicated board memory segment.
- Parameters
wavs (list of
Waveform) – Waveforms to write.indices (list of int, None) – The segment indices corresponding to the waveforms.
-
_write_segment(wavs, pv_buf, pn_buf, offset=0)[source]¶ Writes set of waveforms consecutively into a single segment of board memory. Breaks down the transfer into manageable chunks.
- Parameters
wavs (list of
Waveform) – Waveforms to be written to the current segment.pv_buf (
ctypes.Array) – Local contiguous PC buffer for transferring to Board.pn_buf (
ctypes.Pointer(int16)) – Usable pointer to buffer, cast as correct data type.offset (int, optional) – Passed from
load_waveforms(), see description there.
-
_transfer_steps(steps)[source]¶ Writes all sequence steps passed, potentially overwriting.
- Parameters
steps (list of
wavgen.utilities.Step) – Sequence steps to write.
-
_setup_clock()[source]¶ Tries to achieve requested sampling frequency (see global parameter
SAMP_FREQ)
-
_update_magnitudes(wav)[source]¶ Turns off card, modifies each tone’s magnitude, then lights it back up.
- Parameters
wav (
wavgen.waveform.Superposition) – Waveform with updated magnitudes.
-
_run_cam(which_cam=None)[source]¶ Fires up the camera stream (ThorLabs UC480)
- Parameters
which_cam (bool) – Chooses between displaying the Pre- or Post- chamber ThorCams. Passing nothing returns a camera object for silent use (not displaying).
- Returns
Only returns if no selection for which_cam is made.
- Return type
instrumental.drivers.cameras.uc480, None
Notes
Todo
Integrate button for saving optimized waveforms.
-