Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
qutech
python-TaborDriver
Commits
f456ace2
Commit
f456ace2
authored
Jan 17, 2017
by
Simon Sebastian Humpohl
Browse files
Rename to pytabor to resolve conflicts with existing pyte package (a terminal emulator)
parent
913021a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
pyt
e
/__init__.py
→
pyt
abor
/__init__.py
View file @
f456ace2
...
...
@@ -2,7 +2,7 @@ from pyvisa import __version__ as pyvisa_version
from
distutils.version
import
StrictVersion
if
StrictVersion
(
pyvisa_version
)
>=
StrictVersion
(
'1.6'
):
from
.pyt
e
16
import
*
__all__
=
pyt
e
16
.
__all__
from
.pyt
abor
16
import
*
__all__
=
pyt
abor
16
.
__all__
else
:
raise
ImportError
(
'Unsupported pyvisa version: {} (should be an "easy" fix)'
.
format
(
pyvisa_version
))
pyt
e/pyte
16.py
→
pyt
abor/pytabor
16.py
View file @
f456ace2
...
...
@@ -289,14 +289,14 @@ def open_session(resource_name = None, title_msg = None, vi_rsc_mgr = None, extr
Example:
>>> import pyt
e
>>> import pyt
abor
>>>
>>> # Connect to Arbitrary-Wave-Generator Instrument through TCPIP
>>> # (the user will be asked to enter the instrument's IP-Address):
>>> vi = pyt
e
.open_session(resource_name='TCPIP', title_msg='Connect to AWG Instrument')
>>> vi = pyt
abor
.open_session(resource_name='TCPIP', title_msg='Connect to AWG Instrument')
>>>
>>> # Connect to Digital-Multimeter through USB:
>>> dmm = pyt
e
.open_session(resource_name='USB', extra_init=False)
>>> dmm = pyt
abor
.open_session(resource_name='USB', extra_init=False)
>>>
>>> print vi.ask('*IDN?')
>>> print dmm.ask('*IDN?')
...
...
@@ -509,18 +509,18 @@ def download_binary_data(vi, pref, bin_dat, dat_size, paranoia_level=1):
:returns: written-bytes count.
Example:
>>> import pyt
e
>>> import pyt
abor
>>>
>>> vi = pyt
e
.open_session('192.168.0.170')
>>> vi = pyt
abor
.open_session('192.168.0.170')
>>> _ = vi.ask('*RST; *CLS; *OPC?') # reset the instrument
>>> _ = vi.ask(':FUNC:MODE USER; *OPC?') # select arbirary-wave mode
>>> _ = vi.ask(':FREQ::RAST 2GHz; *OPC?') # Set sampling-rate = 2GHz
>>>
>>> # build sine-wave (single cycle) of 1024-points:
>>> sin_wav = pyt
e
.build_sine_wave(cycle_len=1024)
>>> sin_wav = pyt
abor
.build_sine_wave(cycle_len=1024)
>>>
>>> # download it to the active segment of the active channel:
>>> pyt
e
.download_binary_data(vi, 'TRAC:DATA', sin_wav, 1024 * 2)
>>> pyt
abor
.download_binary_data(vi, 'TRAC:DATA', sin_wav, 1024 * 2)
>>>
>>> _ = vi.ask(':OUTP ON; *OPC?') # turn on the active channel
>>> print vi.ask(':SYST:ERR?')
...
...
@@ -589,26 +589,26 @@ def download_binary_file(vi, pref, file_path, offset=0, data_size=None, paranoia
:returns: written-bytes count.
Example:
>>> import pyt
e
>>> import pyt
abor
>>> import os
>>> file_path = os.path.expanduser('~')
>>> file_path = os.path.join(file_path, 'Documents')
>>> file_path = os.path.join(file_path, 'sin.wav')
>>>
>>> # build sine-wave (single cycle) of 1024-points:
>>> sin_wav = pyt
e
.build_sine_wave(cycle_len=1024)
>>> sin_wav = pyt
abor
.build_sine_wave(cycle_len=1024)
>>> # write it to binary file:
>>> sin_wav.tofile(file_path)
>>>
>>> # Later on ..
>>>
>>> vi = pyt
e
.open_session('192.168.0.170')
>>> vi = pyt
abor
.open_session('192.168.0.170')
>>> _ = vi.ask('*RST; *CLS; *OPC?') # reset the instrument
>>> _ = vi.ask(':FUNC:MODE USER; *OPC?') # select arbirary-wave mode
>>> _ = vi.ask(':FREQ::RAST 2GHz; *OPC?') # Set sampling-rate = 2GHz
>>>
>>> # write wave-data from file to the active segment of the active channel:
>>> pyt
e
.download_binary_file(vi, file_path, 'TRAC:DATA')
>>> pyt
abor
.download_binary_file(vi, file_path, 'TRAC:DATA')
>>>
>>> _ = vi.ask(':OUTP ON; *OPC?') # turn on the active channel
>>> print vi.ask(':SYST:ERR?')
...
...
@@ -773,11 +773,11 @@ def download_segment_lengths(vi, seg_len_list, pref=':SEGM:DATA', paranoia_level
>>> _ = vi.ask(':TRACe:SELect 1; *OPC?')
>>>
>>> # Download the wave-data of all segments:
>>> pyt
e
.download_binary_data(vi, ':TRACe:DATA', wave_data, total_size)
>>> pyt
abor
.download_binary_data(vi, ':TRACe:DATA', wave_data, total_size)
>>>
>>> # Download the appropriate segment-lengths list:
>>> seg_lengths = [ 1024, 1024, 384, 4096, 8192 ]
>>> pyt
e
.download_segment_lengths(vi, seg_lengths)
>>> pyt
abor
.download_segment_lengths(vi, seg_lengths)
'''
if
isinstance
(
seg_len_list
,
np
.
ndarray
):
if
seg_len_list
.
ndim
!=
1
:
...
...
@@ -814,7 +814,7 @@ def download_sequencer_table(vi, seq_table, pref=':SEQ:DATA', paranoia_level=1):
>>> _ = vi.ask(':SEQ:SELect 1; *OPC?')
>>>
>>> # Download the sequencer-table:
>>> pyt
e
.download_sequencer_table(vi, sequencer_table)
>>> pyt
abor
.download_sequencer_table(vi, sequencer_table)
'''
...
...
@@ -848,7 +848,7 @@ def download_adv_seq_table(vi, adv_seq_table, pref=':ASEQ:DATA', paranoia_level=
>>> adv_sequencer_table = zip(repeats, seq_nb, jump)
>>>
>>> # Download it to instrument
>>> pyt
e
.download_adv_seq_table(vi, adv_sequencer_table)
>>> pyt
abor
.download_adv_seq_table(vi, adv_sequencer_table)
'''
tbl_len
=
len
(
adv_seq_table
)
...
...
@@ -882,8 +882,8 @@ def download_fast_pattern_table(vi, patt_table, pref=':PATT:COMP:FAST:DATA', par
Optionally set the point-time-resolution manually to `1/sclk`.
Example:
>>> import pyt
e
>>> vi = pyt
e
.open_session('192.168.0.170')
>>> import pyt
abor
>>> vi = pyt
abor
.open_session('192.168.0.170')
>>>
>>> # Create fast-pulse pattern table:
>>> volt_levels = [0.0 , 0.1 , 0.5 , 0.1 , -0.1, -0.5, -0.1, -0.05]
...
...
@@ -897,7 +897,7 @@ def download_fast_pattern_table(vi, patt_table, pref=':PATT:COMP:FAST:DATA', par
>>> _ = vi.ask(':PATT:COMP:RES:TYPE USER; :PATT:COMP:RES 0.5e-9; *OPC?')
>>>
>>> # Download the pattern-table to instrument:
>>> pyt
e
.download_fast_pattern_table(vi, pattern_table)
>>> pyt
abor
.download_fast_pattern_table(vi, pattern_table)
>>>
>>> vi.close()
'''
...
...
@@ -940,8 +940,8 @@ def download_linear_pattern_table(vi, patt_table, start_level, pref=':PATT:COMP:
Optionally set the point-time-resolution manually to `1/sclk`.
Example:
>>> import pyt
e
>>> vi = pyt
e
.open_session('192.168.0.170')
>>> import pyt
abor
>>> vi = pyt
abor
.open_session('192.168.0.170')
>>>
>>> # Create fast-pulse pattern table:
>>> start_level = 0.0
...
...
@@ -956,7 +956,7 @@ def download_linear_pattern_table(vi, patt_table, start_level, pref=':PATT:COMP:
>>> _ = vi.ask(':PATT:COMP:RES:TYPE USER; :PATT:COMP:RES 0.5e-9; *OPC?')
>>>
>>> # Download the pattern-table to instrument:
>>> pyt
e
.download_linear_pattern_table(vi, pattern_table, start_level)
>>> pyt
abor
.download_linear_pattern_table(vi, pattern_table, start_level)
>>>
>>> vi.close()
'''
...
...
setup.py
View file @
f456ace2
from
distutils.core
import
setup
setup
(
name
=
'pyt
e
'
,
version
=
''
,
packages
=
[
'pyt
e
'
,
'teawg'
],
package_dir
=
{
'pyt
e
'
:
'pyt
e
'
,
'teawg'
:
'teawg'
},
name
=
'pyt
abor
'
,
version
=
'
0.0.1
'
,
packages
=
[
'pyt
abor
'
,
'teawg'
],
package_dir
=
{
'pyt
abor
'
:
'pyt
abor
'
,
'teawg'
:
'teawg'
},
url
=
''
,
license
=
''
,
author
=
'Tabor electronics'
,
...
...
teawg/__init__.py
View file @
f456ace2
...
...
@@ -7,7 +7,7 @@ import struct
import
copy
import
numpy
as
np
import
warnings
import
pyt
e
import
pyt
abor
# WX2184 Properties
_wx2184_properties
=
{
...
...
@@ -151,7 +151,7 @@ class TEWXAwg(object):
self
.
_set_instr_address
(
instr_addr
)
if
self
.
_instr_addr
is
not
None
:
self
.
_visa_inst
=
pyt
e
.
open_session
(
self
.
_instr_addr
,
extra_init
=
True
)
self
.
_visa_inst
=
pyt
abor
.
open_session
(
self
.
_instr_addr
,
extra_init
=
True
)
if
self
.
_visa_inst
is
not
None
:
idn
=
self
.
_visa_inst
.
ask
(
'*IDN?'
)
...
...
@@ -230,7 +230,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
pyt
e
.
send_cmd
(
self
.
_visa_inst
,
cmd_str
,
paranoia_level
)
pyt
abor
.
send_cmd
(
self
.
_visa_inst
,
cmd_str
,
paranoia_level
)
def
send_query
(
self
,
query_str
):
'''Send the given query to the instrument and read the response
...
...
@@ -255,7 +255,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
pyt
e
.
download_binary_data
(
self
.
_visa_inst
,
pref
,
bin_dat
,
bin_dat
.
nbytes
,
paranoia_level
)
pyt
abor
.
download_binary_data
(
self
.
_visa_inst
,
pref
,
bin_dat
,
bin_dat
.
nbytes
,
paranoia_level
)
def
send_binary_file
(
self
,
file_path
,
pref
,
offset
=
0
,
data_size
=
None
,
paranoia_level
=
None
):
"""Load binary data from the specified file and send it to instrument.
...
...
@@ -274,7 +274,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
pyt
e
.
download_binary_file
(
self
.
_visa_inst
,
pref
,
file_path
,
offset
,
data_size
,
paranoia_level
)
pyt
abor
.
download_binary_file
(
self
.
_visa_inst
,
pref
,
file_path
,
offset
,
data_size
,
paranoia_level
)
def
send_arbcon_wav_file
(
self
,
file_path
,
pref
=
':TRAC:DATA'
,
bits_per_point
=
14
,
paranoia_level
=
None
):
"""Load wave data from binary wav file created by the ArbConnection, normalize and it to instrument.
...
...
@@ -288,7 +288,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
pyt
e
.
download_arbcon_wav_file
(
self
.
_visa_inst
,
file_path
,
pref
,
bits_per_point
,
paranoia_level
)
pyt
abor
.
download_arbcon_wav_file
(
self
.
_visa_inst
,
file_path
,
pref
,
bits_per_point
,
paranoia_level
)
def
download_segment_lengths
(
self
,
seg_len_list
,
pref
=
':SEGM:DATA'
,
paranoia_level
=
None
):
'''Download Segments-Lengths Table to Instrument
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment