parent
7f6839479c
commit
31d809a618
@ -169,7 +169,9 @@ class Experiment:
|
||||
# @param ttls Additional ttl channels
|
||||
def record(self, samples, frequency, timelength=None, sensitivity = None, ttls=None, channels = 3, offset = None, impedance = None):
|
||||
"""
|
||||
Records data with given number of samples, sampling frequency and sensitivity
|
||||
Records data with given number of samples, sampling frequency and sensitivity.
|
||||
Optionally, the time length of this state can be specified. If not specified **timelength** is
|
||||
deduced from **samples**/**frequency**:
|
||||
|
||||
:param int samples: Number of samples to record
|
||||
:param float frequency: Sampling frequency
|
||||
@ -265,36 +267,38 @@ class Experiment:
|
||||
if ttls != 0:
|
||||
s_content += '<ttlout value="0x%06x"/>' % ttls
|
||||
self.state_list.append(StateSimple(2e-6, s_content))
|
||||
|
||||
## Creates a, possibly shaped, pulsed gradient.
|
||||
# @param dac_value DAC value to set
|
||||
# @param length Duration of the state, minimum length is 42*90ns=3.78us (default)
|
||||
# @param shape Tuple of (shape, resolution/seconds), shape can be one of: rec (default), sin2, sin
|
||||
# @param is_seq If set to *True*, do NOT set DAC to zero after this state
|
||||
# @param trigger Additional ttl channels
|
||||
def set_pfg(self, dac_value=None, length=None, shape=('rec',0), trigger=4, is_seq=False):
|
||||
def set_pfg(self, dac_value=None, length=None, shape=('rec', 0), trigger=4, is_seq=False):
|
||||
"""
|
||||
This sets the value for the PFG, it also sets it back automatically.
|
||||
If you don't whish to do so (i.e. line shapes) set is_seq=1
|
||||
If you wnat to set a trigger, set trigger (default=4, i.e. channel 2)
|
||||
If you want to set a trigger, set trigger (default=4, i.e. channel 2)
|
||||
If you want shaped gradients: shape=(ashape, resolution), ashape can be rec, sin2, sin
|
||||
|
||||
The default DAC ID is hardcoded (id=1)!
|
||||
|
||||
:param int dac_value: DAC value to set
|
||||
:param float length: Duration of the state, minimum length is 42*90ns=3.78us (default)
|
||||
:param str shape: Tuple of (shape, resolution/seconds), shape can be one of: rec (default), sin2, sin
|
||||
:param bool is_seq: If set to *True*, do NOT set DAC to zero after this state
|
||||
:param tuple shape: Tuple of (shape, resolution/seconds), shape can be one of: rec (default), sin2, sin
|
||||
:param bool is_seq: If set to *True*, do *NOT* set DAC to zero at the end of this state
|
||||
:param int trigger: default=4, lines to set (integer)
|
||||
"""
|
||||
try:
|
||||
form, resolution = shape
|
||||
except:
|
||||
raise SyntaxError, "shape argument needs to be a tuple, i.e. ('shape',resolution), shape can be sin, sin2, rec"
|
||||
raise SyntaxError, "shape argument needs to be a tuple, i.e. ('shape',resolution), shape can be sin, sin2, rec"
|
||||
|
||||
if length == None:
|
||||
# mimimum length
|
||||
length=42*9e-8
|
||||
if resolution >= length:
|
||||
raise ValueError, "Resolution %.3e of shaped gradients can not be longer than total length %.3e"%(resolution, length)
|
||||
|
||||
if resolution < 42*9e-8:
|
||||
raise ValueError, "Resulution %.3e can not be smaller than %.3e"%(resolution, 42*9e-8)
|
||||
|
||||
@ -304,7 +308,7 @@ class Experiment:
|
||||
s_content = '<ttlout value="%s"/><analogout id="1" dac_value="%i"/>' % (trigger, dac_value)
|
||||
self.state_list.append(StateSimple(length, s_content))
|
||||
|
||||
if not is_seq and shape == None:
|
||||
if not is_seq:
|
||||
s_content = '<analogout id="1" dac_value="0"/>'
|
||||
self.state_list.append(StateSimple(42*9e-8, s_content))
|
||||
|
||||
@ -341,12 +345,12 @@ class Experiment:
|
||||
"""
|
||||
This sets the value for the DAC and if given the TTLs.
|
||||
It also sets it back to zero automatically.
|
||||
If you don't whish to set the value back to zero (i.e. line shapes) set is_seq=True
|
||||
If you don't wish to set the value back to zero (i.e. line shapes) set is_seq=True
|
||||
|
||||
The state length is at least 3.78 µs (is_seq=1) or 7.28µs (is_seq=0).
|
||||
|
||||
:param int dac_value: dac value, between -2**19-1 and +2**19
|
||||
:param int dac_id: default=1, which dac to control
|
||||
:param int dac_id: default=1, which DAC to control
|
||||
:param float length: default=None, length of this state in seconds. If *None* length=42*90ns=3.78µs
|
||||
:param bool is_seq: default=False, do not reset DAC to 0 (zero) if True
|
||||
:param int ttls: default=0, lines to set (integer)
|
||||
@ -389,10 +393,13 @@ class Experiment:
|
||||
def set_description(self, key, value):
|
||||
"""Sets a description which is carried via the back end result
|
||||
file to the result script in the front end. In the result script
|
||||
you can extract the description with get_description"""
|
||||
you can extract the description with get_description
|
||||
|
||||
:param str key: the key
|
||||
:param value: the value, its type is saved.
|
||||
"""
|
||||
if key in self.description.keys():
|
||||
print 'Warning: Overwriting existing description "%s" = "%s" with "%s"' % (key, self.description[key], value)
|
||||
|
||||
self.description[key] = value
|
||||
|
||||
## set the PTS310/PTS500 frequency source to local mode
|
||||
|
Loading…
Reference in New Issue
Block a user