Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-TaborDriver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
QuTech
python-TaborDriver
Commits
f456ace2
Commit
f456ace2
authored
Jan 17, 2017
by
Simon Sebastian Humpohl
Browse files
Options
Downloads
Patches
Plain Diff
Rename to pytabor to resolve conflicts with existing pyte package (a terminal emulator)
parent
913021a7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pytabor/__init__.py
+2
-2
2 additions, 2 deletions
pytabor/__init__.py
pytabor/pytabor16.py
+21
-21
21 additions, 21 deletions
pytabor/pytabor16.py
setup.py
+4
-4
4 additions, 4 deletions
setup.py
teawg/__init__.py
+6
-6
6 additions, 6 deletions
teawg/__init__.py
with
33 additions
and
33 deletions
pyt
e
/__init__.py
→
pyt
abor
/__init__.py
+
2
−
2
View file @
f456ace2
...
@@ -2,7 +2,7 @@ from pyvisa import __version__ as pyvisa_version
...
@@ -2,7 +2,7 @@ from pyvisa import __version__ as pyvisa_version
from
distutils.version
import
StrictVersion
from
distutils.version
import
StrictVersion
if
StrictVersion
(
pyvisa_version
)
>=
StrictVersion
(
'
1.6
'
):
if
StrictVersion
(
pyvisa_version
)
>=
StrictVersion
(
'
1.6
'
):
from
.pyt
e
16
import
*
from
.pyt
abor
16
import
*
__all__
=
pyt
e
16
.
__all__
__all__
=
pyt
abor
16
.
__all__
else
:
else
:
raise
ImportError
(
'
Unsupported pyvisa version: {} (should be an
"
easy
"
fix)
'
.
format
(
pyvisa_version
))
raise
ImportError
(
'
Unsupported pyvisa version: {} (should be an
"
easy
"
fix)
'
.
format
(
pyvisa_version
))
This diff is collapsed.
Click to expand it.
pyt
e/pyte
16.py
→
pyt
abor/pytabor
16.py
+
21
−
21
View file @
f456ace2
...
@@ -289,14 +289,14 @@ def open_session(resource_name = None, title_msg = None, vi_rsc_mgr = None, extr
...
@@ -289,14 +289,14 @@ def open_session(resource_name = None, title_msg = None, vi_rsc_mgr = None, extr
Example:
Example:
>>>
import
pyt
e
>>>
import
pyt
abor
>>>
>>>
>>>
# Connect to Arbitrary-Wave-Generator Instrument through TCPIP
>>>
# Connect to Arbitrary-Wave-Generator Instrument through TCPIP
>>>
# (the user will be asked to enter the instrument's IP-Address):
>>>
# (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:
>>>
# 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
vi
.
ask
(
'
*IDN?
'
)
>>>
print
dmm
.
ask
(
'
*IDN?
'
)
>>>
print
dmm
.
ask
(
'
*IDN?
'
)
...
@@ -509,18 +509,18 @@ def download_binary_data(vi, pref, bin_dat, dat_size, paranoia_level=1):
...
@@ -509,18 +509,18 @@ def download_binary_data(vi, pref, bin_dat, dat_size, paranoia_level=1):
:returns: written-bytes count.
:returns: written-bytes count.
Example:
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
(
'
*RST; *CLS; *OPC?
'
)
# reset the instrument
>>>
_
=
vi
.
ask
(
'
:FUNC:MODE USER; *OPC?
'
)
# select arbirary-wave mode
>>>
_
=
vi
.
ask
(
'
:FUNC:MODE USER; *OPC?
'
)
# select arbirary-wave mode
>>>
_
=
vi
.
ask
(
'
:FREQ::RAST 2GHz; *OPC?
'
)
# Set sampling-rate = 2GHz
>>>
_
=
vi
.
ask
(
'
:FREQ::RAST 2GHz; *OPC?
'
)
# Set sampling-rate = 2GHz
>>>
>>>
>>>
# build sine-wave (single cycle) of 1024-points:
>>>
# 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:
>>>
# 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
>>>
_
=
vi
.
ask
(
'
:OUTP ON; *OPC?
'
)
# turn on the active channel
>>>
print
vi
.
ask
(
'
:SYST:ERR?
'
)
>>>
print
vi
.
ask
(
'
:SYST:ERR?
'
)
...
@@ -589,26 +589,26 @@ def download_binary_file(vi, pref, file_path, offset=0, data_size=None, paranoia
...
@@ -589,26 +589,26 @@ def download_binary_file(vi, pref, file_path, offset=0, data_size=None, paranoia
:returns: written-bytes count.
:returns: written-bytes count.
Example:
Example:
>>>
import
pyt
e
>>>
import
pyt
abor
>>>
import
os
>>>
import
os
>>>
file_path
=
os
.
path
.
expanduser
(
'
~
'
)
>>>
file_path
=
os
.
path
.
expanduser
(
'
~
'
)
>>>
file_path
=
os
.
path
.
join
(
file_path
,
'
Documents
'
)
>>>
file_path
=
os
.
path
.
join
(
file_path
,
'
Documents
'
)
>>>
file_path
=
os
.
path
.
join
(
file_path
,
'
sin.wav
'
)
>>>
file_path
=
os
.
path
.
join
(
file_path
,
'
sin.wav
'
)
>>>
>>>
>>>
# build sine-wave (single cycle) of 1024-points:
>>>
# 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:
>>>
# write it to binary file:
>>>
sin_wav
.
tofile
(
file_path
)
>>>
sin_wav
.
tofile
(
file_path
)
>>>
>>>
>>>
# Later on ..
>>>
# 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
(
'
*RST; *CLS; *OPC?
'
)
# reset the instrument
>>>
_
=
vi
.
ask
(
'
:FUNC:MODE USER; *OPC?
'
)
# select arbirary-wave mode
>>>
_
=
vi
.
ask
(
'
:FUNC:MODE USER; *OPC?
'
)
# select arbirary-wave mode
>>>
_
=
vi
.
ask
(
'
:FREQ::RAST 2GHz; *OPC?
'
)
# Set sampling-rate = 2GHz
>>>
_
=
vi
.
ask
(
'
:FREQ::RAST 2GHz; *OPC?
'
)
# Set sampling-rate = 2GHz
>>>
>>>
>>>
# write wave-data from file to the active segment of the active channel:
>>>
# 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
>>>
_
=
vi
.
ask
(
'
:OUTP ON; *OPC?
'
)
# turn on the active channel
>>>
print
vi
.
ask
(
'
:SYST:ERR?
'
)
>>>
print
vi
.
ask
(
'
:SYST:ERR?
'
)
...
@@ -773,11 +773,11 @@ def download_segment_lengths(vi, seg_len_list, pref=':SEGM:DATA', paranoia_level
...
@@ -773,11 +773,11 @@ def download_segment_lengths(vi, seg_len_list, pref=':SEGM:DATA', paranoia_level
>>>
_
=
vi
.
ask
(
'
:TRACe:SELect 1; *OPC?
'
)
>>>
_
=
vi
.
ask
(
'
:TRACe:SELect 1; *OPC?
'
)
>>>
>>>
>>>
# Download the wave-data of all segments:
>>>
# 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:
>>>
# Download the appropriate segment-lengths list:
>>>
seg_lengths
=
[
1024
,
1024
,
384
,
4096
,
8192
]
>>>
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
isinstance
(
seg_len_list
,
np
.
ndarray
):
if
seg_len_list
.
ndim
!=
1
:
if
seg_len_list
.
ndim
!=
1
:
...
@@ -814,7 +814,7 @@ def download_sequencer_table(vi, seq_table, pref=':SEQ:DATA', paranoia_level=1):
...
@@ -814,7 +814,7 @@ def download_sequencer_table(vi, seq_table, pref=':SEQ:DATA', paranoia_level=1):
>>>
_
=
vi
.
ask
(
'
:SEQ:SELect 1; *OPC?
'
)
>>>
_
=
vi
.
ask
(
'
:SEQ:SELect 1; *OPC?
'
)
>>>
>>>
>>>
# Download the sequencer-table:
>>>
# 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=
...
@@ -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
)
>>>
adv_sequencer_table
=
zip
(
repeats
,
seq_nb
,
jump
)
>>>
>>>
>>>
# Download it to instrument
>>>
# 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
)
tbl_len
=
len
(
adv_seq_table
)
...
@@ -882,8 +882,8 @@ def download_fast_pattern_table(vi, patt_table, pref=':PATT:COMP:FAST:DATA', par
...
@@ -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`.
Optionally set the point-time-resolution manually to `1/sclk`.
Example:
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
'
)
>>>
>>>
>>>
# Create fast-pulse pattern table:
>>>
# Create fast-pulse pattern table:
>>>
volt_levels
=
[
0.0
,
0.1
,
0.5
,
0.1
,
-
0.1
,
-
0.5
,
-
0.1
,
-
0.05
]
>>>
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
...
@@ -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?
'
)
>>>
_
=
vi
.
ask
(
'
:PATT:COMP:RES:TYPE USER; :PATT:COMP:RES 0.5e-9; *OPC?
'
)
>>>
>>>
>>>
# Download the pattern-table to instrument:
>>>
# 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
()
>>>
vi
.
close
()
'''
'''
...
@@ -940,8 +940,8 @@ def download_linear_pattern_table(vi, patt_table, start_level, pref=':PATT:COMP:
...
@@ -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`.
Optionally set the point-time-resolution manually to `1/sclk`.
Example:
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
'
)
>>>
>>>
>>>
# Create fast-pulse pattern table:
>>>
# Create fast-pulse pattern table:
>>>
start_level
=
0.0
>>>
start_level
=
0.0
...
@@ -956,7 +956,7 @@ def download_linear_pattern_table(vi, patt_table, start_level, pref=':PATT:COMP:
...
@@ -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?
'
)
>>>
_
=
vi
.
ask
(
'
:PATT:COMP:RES:TYPE USER; :PATT:COMP:RES 0.5e-9; *OPC?
'
)
>>>
>>>
>>>
# Download the pattern-table to instrument:
>>>
# 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
()
>>>
vi
.
close
()
'''
'''
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
4
−
4
View file @
f456ace2
from
distutils.core
import
setup
from
distutils.core
import
setup
setup
(
setup
(
name
=
'
pyt
e
'
,
name
=
'
pyt
abor
'
,
version
=
''
,
version
=
'
0.0.1
'
,
packages
=
[
'
pyt
e
'
,
'
teawg
'
],
packages
=
[
'
pyt
abor
'
,
'
teawg
'
],
package_dir
=
{
'
pyt
e
'
:
'
pyt
e
'
,
'
teawg
'
:
'
teawg
'
},
package_dir
=
{
'
pyt
abor
'
:
'
pyt
abor
'
,
'
teawg
'
:
'
teawg
'
},
url
=
''
,
url
=
''
,
license
=
''
,
license
=
''
,
author
=
'
Tabor electronics
'
,
author
=
'
Tabor electronics
'
,
...
...
This diff is collapsed.
Click to expand it.
teawg/__init__.py
+
6
−
6
View file @
f456ace2
...
@@ -7,7 +7,7 @@ import struct
...
@@ -7,7 +7,7 @@ import struct
import
copy
import
copy
import
numpy
as
np
import
numpy
as
np
import
warnings
import
warnings
import
pyt
e
import
pyt
abor
# WX2184 Properties
# WX2184 Properties
_wx2184_properties
=
{
_wx2184_properties
=
{
...
@@ -151,7 +151,7 @@ class TEWXAwg(object):
...
@@ -151,7 +151,7 @@ class TEWXAwg(object):
self
.
_set_instr_address
(
instr_addr
)
self
.
_set_instr_address
(
instr_addr
)
if
self
.
_instr_addr
is
not
None
:
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
:
if
self
.
_visa_inst
is
not
None
:
idn
=
self
.
_visa_inst
.
ask
(
'
*IDN?
'
)
idn
=
self
.
_visa_inst
.
ask
(
'
*IDN?
'
)
...
@@ -230,7 +230,7 @@ class TEWXAwg(object):
...
@@ -230,7 +230,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
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
):
def
send_query
(
self
,
query_str
):
'''
Send the given query to the instrument and read the response
'''
Send the given query to the instrument and read the response
...
@@ -255,7 +255,7 @@ class TEWXAwg(object):
...
@@ -255,7 +255,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
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
):
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.
"""
Load binary data from the specified file and send it to instrument.
...
@@ -274,7 +274,7 @@ class TEWXAwg(object):
...
@@ -274,7 +274,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
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
):
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.
"""
Load wave data from binary wav file created by the ArbConnection, normalize and it to instrument.
...
@@ -288,7 +288,7 @@ class TEWXAwg(object):
...
@@ -288,7 +288,7 @@ class TEWXAwg(object):
if
paranoia_level
is
None
:
if
paranoia_level
is
None
:
paranoia_level
=
self
.
_paranoia_level
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
):
def
download_segment_lengths
(
self
,
seg_len_list
,
pref
=
'
:SEGM:DATA
'
,
paranoia_level
=
None
):
'''
Download Segments-Lengths Table to Instrument
'''
Download Segments-Lengths Table to Instrument
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment