def set_pfg_wt(self, I_out, length=None, is_seq=0, trigger=4):
	"""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"""
	dac_value=dac.conv(I_out)
	if length==None:
	    length=42*9e-8
	self.state_list.append('<state time="%s"><analogout id="1" dac_value="%i"/><ttlout value="%s"/></state>\n' %(repr(length), dac_value, trigger))
	if is_seq == 0:
	    self.state_list.append('<state time="%s"><analogout id="1" dac_value="0"/><ttlout value="%s"/></state>\n' %(repr(42*9e-8),trigger) )
    def set_pfg_wt(self, I_out=None, dac_value=None, length=None, is_seq=0, trigger=4):
	"""This sets the value for the PFG (plus trigger, default=2**2), it also sets it back automatically.
	If you don't whish to do so (i.e. line shapes)  set is_seq=1"""
	if I_out == None and dac_value == None:
	    dac_value=0
	if I_out != None and dac_value == None:
	    dac_value=dac.conv(I_out)
	if I_out == None and dac_value != None:
	    dac_value=dac_value
	if I_out !=None and dac_value != None:
	    dac_value = 0
	    print "WARNING: You can't set both, I_out and dac_value! dac_value set to 0"
	if length==None:
	    length=42*9e-8
	self.state_list.append('<state time="%s"><analogout id="1" dac_value="%i"/><ttlout value="%s"/></state>\n' %(repr(length), dac_value, trigger))
	if is_seq == 0:
	    self.state_list.append('<state time="%s"><analogout id="1" dac_value="0"/><ttlout value="%s"/></state>\n' %(repr(42*9e-8),trigger) )
    def set_pfg(self, I_out=None, dac_value=None, length=None, is_seq=0):
        """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 I_out == None and dac_value == None:
            dac_value = 0
        if I_out != None and dac_value == None:
            dac_value = dac.conv(I_out)
        if I_out == None and dac_value != None:
            dac_value = dac_value
        if I_out != None and dac_value != None:
            dac_value = 0
            print "WARNING: You can't set both, I_out and dac_value! dac_value set to 0"
        if length == None:
            # mimimum length
            length = 42 * 9e-8
        s_content = '<analogout id="1" dac_value="%i"/>' % dac_value
        self.state_list.append(StateSimple(length, s_content))
        if is_seq == 0:
            s_content = '<analogout id="1" dac_value="0"/>'
            self.state_list.append(StateSimple(42 * 9e-8, s_content))
    def set_pfg_wt(self, I_out=None, dac_value=None, length=None, is_seq=0, trigger=4):
        """
        This sets the value for the PFG (plus trigger, default=2**2), it also sets it back automatically.
        If you don't whish to do so (i.e. line shapes)  set is_seq=1
        """
#        raise DeprecationWarning, "to be removed in future, use set_pfg instead"
        if I_out == None and dac_value == None:
            dac_value=0
        if I_out != None and dac_value == None:
            dac_value=dac.conv(I_out)
        if I_out == None and dac_value != None:
            dac_value=dac_value
        if I_out !=None and dac_value != None:
            dac_value = 0
            print "WARNING: You can't set both, I_out and dac_value! dac_value set to 0"
        if length==None:
            length=42*9e-8
        s_content = '<analogout id="1" dac_value="%i"/><ttlout value="%s"/>' \
            % (dac_value, trigger)
        self.state_list.append(StateSimple(length, s_content))
        if is_seq == 0:
            s_content = '<analogout id="1" dac_value="0"/><ttlout value="%s"/>' \
                % trigger
            self.state_list.append(StateSimple(42*9e-8, s_content))