Example #1
0
import os

start_time = time.time()
strTime = time.strftime("%Y" "%m" "%d" "%H" "%M" "%S", time.gmtime())


iterations=10
NoiseVariances=np.float32([1e-1, 0.5e-1, 1e-2, 0.5e-2, 1e-3, 0.5e-3])


dfile='ModelGenValidation_{}'.format(strTime)

AppOutput=[]

#------------------- following code myst be in all scripts--------------------
lta = Lta("127.0.0.1",60100)    # all scripts must create  an Lta object
try:
    lta.connect()                   # connect to the Labview Host
    lta.s.settimeout(30) 

#---------------------Script code goes here------------------------------------
#-------------------  Create output files -------------------------------------    
    Settings = lta.__get__('settings')
    out_dir = Settings['Directories']['RootDir']+'\\'+Settings['Directories']['OutDir']+'\\'
    output_python_path = ( out_dir + dfile + '.pkl')
    output_matlab_path = ( out_dir + dfile + '.mat')
    output_python = open(output_python_path, 'wb')
    output_matlab = open(output_matlab_path, 'wb')  
    AppOut_arr = np.zeros((len(NoiseVariances)*iterations,), dtype=np.object)
#-----------------------  Get App Config -------------------------------------    
    AppCfg = lta.__get__('app.config')
Example #2
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
from lta_err import Lta_Error

#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
try:
    lta.connect()  # connect to the Labview Host
    #---------------------Script code goes here------------------------------------
    EvtCfg = lta.__get__('bus1.event.config')
    EvtCfg['clEvtConfig']['Fs'] = 60
    lta.__set__('bus1.event.config', EvtCfg)
    lta.__run__()
    EvtCfg = lta.__get__('bus1.event.config')
    EvtCfg['clEvtConfig']['Fs'] = 30
    lta.__set__('bus1.event.config', EvtCfg)
    lta.__run__()
    EvtCfg = lta.__get__('bus1.event.config')
    EvtCfg['clEvtConfig']['Fs'] = 20
    lta.__set__('bus1.event.config', EvtCfg)
    lta.__run__()

#------------------all scripts should send their errors to labview------------
except Exception as ex:
    err = Lta_Error(ex, sys.exc_info())  #format a labview error
    lta.send_error(err, 3, 'Abort')  #send the error to labview for display
    lta.close()
    print err
Example #3
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
from lta_err import Lta_Error
import numpy as np
import time

#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
try:
    lta.connect()  # connect to the Labview Host
    #---------------------Script code goes here------------------------------------
    UsrTimeout = lta.s.gettimeout()

    freq_list = [5000, 2000, 1000, 500, 200, 100, 80, 60, 50, 40]

    for freq in freq_list:
        dlyTime = -.150

        AnalysisConfig = lta.__get__('Analysis.Config')
        AnalysisConfig[None]['F0'] = np.uint32(freq)
        lta.__set__('Analysis.Config', AnalysisConfig)

        # after setting the clock properties, the Sync module becomes unlocked.  Wait until it re-locks

        while (dlyTime <= .175):

            ClkProperties = lta.__get__('Sync.ClockProperties')
            for element in ClkProperties[None]:
                if element['clClocks']['Name'] == "Pgm_PPS":
                    element['clClocks']['Frequency'] = float(
Example #4
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
from lta_err import Lta_Error
import time
import math

#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
try:
    lta.connect()  # connect to the Labview Host
    #---------------------Script code goes here------------------------------------
    UsrTimeout = lta.s.gettimeout()

    # index offsets to function params
    amplitude = 0
    dcOffset = 1
    dutyCycle = 2
    frequency = 3
    phase = 4
    waveform = 5

    #    freq_list = [5000, 2000, 1000, 500, 200, 100, 50]
    #    freq_list = [200, 180, 160, 140, 120, 100, 80, 70, 60, 50, 40]
    freq_list = [200, 160, 100, 80, 50, 40]

    for freq in freq_list:
        #        dlyTime = -.600    # microseconds

        #
        #        while (dlyTime < .325):
Example #5
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
from lta_err import Lta_Error

#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1",60100)    # all scripts must create  an Lta object
try:
    lta.connect()                   # connect to the Labview Host
#---------------------Script code goes here------------------------------------
    #lta.__run__()
    WfrmParam=lta.__get__('Sync.LockStatus')
    #lta.__set__('test.wfrm.params',WfrmParam)
    #lta.__run__()

#------------------all scripts should send their errors to labview------------
except Exception as ex:
    err = Lta_Error(ex,sys.exc_info())  #format a labview error
    lta.send_error(err,3,'Abort')       #send the error to labview for display
    lta.close()
    print err

Example #6
0
                    lta.s.settimeout(10)                       
                except Exception as ex:
                    print (Error)
                    raise type(ex)(str(iteration)+ex.message) 
                    
                stepTime += incr
                iteration += -1
                
        except Exception as ex:
            raise type(ex) ("Step Change Test Failure:"+ex.message)
                    
           

# ------------------ MAIN SCRIPT ---------------------------------------------
#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1",60100)    # all scripts must create  an Lta object

try:
    lta.connect()                   # connect to the Labview Host
#---------------------Script code goes here------------------------------------

    print lta

    UsrTimeout = lta.s.gettimeout()
    
    Duration = 1    # Analysis.Duration
    
    # Analysis.Config
    Config = OrderedDict()      
    Config['F0'] = np.uint32(50) 
    Config['SettlingTime']= 0.0
Example #7
0
import pickle
from scipy.io import savemat
import numpy as np
import time

start_time = time.time()

iterations = 20

dfile = 'data_{}'.format(int(time.time()))

AppOutput = []
AppOut_arr = np.zeros((iterations, ), dtype=np.object)

#------------------- following code myst be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
try:
    lta.connect()  # connect to the Labview Host
    lta.s.settimeout(30)

    #---------------------Script code goes here------------------------------------
    #-------------------  Create output files -------------------------------------
    Settings = lta.__get__('settings')
    out_dir = Settings['Directories']['RootDir'] + '\\' + Settings[
        'Directories']['OutDir'] + '\\'
    output_python_path = (out_dir + dfile + '.pkl')
    output_matlab_path = (out_dir + dfile + '.mat')
    output_python = open(output_python_path, 'wb')
    output_matlab = open(output_matlab_path, 'wb')
    #-------------------  Get events params ---------------------------------------
    EventInput = lta.__get__('bus1.event.reports')
Example #8
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
from lta_err import Lta_Error

#------------------- following code must be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
try:
    lta.connect()  # connect to the Labview Host
    #---------------------Script code goes here------------------------------------
    #lta.__run__()
    Param = lta.__get__('Analysis.Duration')
    print Param
    Param[None] = float(1.0)
    lta.__set__('Analysis.Duration', Param)
    #lta.__set__('test.wfrm.params',WfrmParam)
    #lta.__run__()

#------------------all scripts should send their errors to labview------------
except Exception as ex:
    err = Lta_Error(ex, sys.exc_info())  #format a labview error
    lta.send_error(err, 3, 'Abort')  #send the error to labview for display
    lta.close()
    print err
Example #9
0
# -*- coding: utf-8 -*-
from lta import Lta
import sys
import numpy as np
from lta_err import Lta_Error

#------------------- following code myst be in all scripts--------------------
lta = Lta("127.0.0.1", 60100)  # all scripts must create  an Lta object
lta.connect()  # connect to the Labview Host
#-----------------------------------------------------------------------------
try:
    #--------------- here is where your code goes-----------------------------
    CommsData = lta.__get__('TestCluster')
    CommsData['TestCluster']['EmbeddedCl_2']['TrueOrFalse'] = not CommsData[
        'TestCluster']['EmbeddedCl_2']['TrueOrFalse']
    CommsData['TestCluster']['EmbeddedCl_1']['NumDbl'] += np.float32(1)
    CommsData['TestCluster']['DoeADeer'][0][0] = 'WRITTEN'
    lta.__set__('TestCluster', CommsData)
    lta.close()
    #-------------------------------------------------------------------------

#------------------all scripts should send their errors to labview------------
except Exception as ex:
    err = Lta_Error(ex, sys.exc_info())  #format a labview error
    lta.send_error(err, 3, 'Abort')  #send the error to labview for display
    lta.close()