コード例 #1
0
ファイル: DefaultScript.py プロジェクト: usnistgov/PARTF
# -*- 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
コード例 #2
0
        #        dlyTime = -.600    # microseconds

        #
        #        while (dlyTime < .325):

        #            sleepTime = 5
        #            while (sleepTime > 0):
        #                print sleepTime
        #                time.sleep(1)
        #                sleepTime = sleepTime-1

        print 'freq:', freq, 'hz'  #,'delay:',dlyTime,'us'

        time.sleep(2.5)

        fcnParams = lta.__get__(
            'FGen.FunctionParams')  # get the array of signal parameters

        for param in fcnParams[None]:
            param[frequency] = float(freq)

        lta.__set__('FGen.FunctionParams', fcnParams)

        ClkProperties = lta.__get__('Sync.ClockProperties')
        for element in ClkProperties[None]:

            # For Equivalent Time Sampling, move the digitizer trigger
            #                if element['clClocks']['Name'] == "Pgm_PPS":
            #                    element['clClocks']['Delay'] = float(dlyTime)          #Set initial Pgm_Pps delay time

            # set the PRS frequency:
            if element['clClocks']['Name'] == 'PRS':
コード例 #3
0
ファイル: GMVMonteCarlo.py プロジェクト: usnistgov/PARTF
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')
    AppCfg['ModelValidationConfig']['NoiseVariance']=NoiseVariances[0]
    lta.__set__('app.config',AppCfg) 
 #-----------------------  Set Impairments ------------------------------------  
#    EventConfig = lta.__get__('bus1.event.config')
#    EventConfig['clEvtConfig']['bPosSeq']= bool(0)
#    lta.__set__('bus1.event.config',EventConfig)
#---------------------  Set PMU impairment ------------------------------------  
コード例 #4
0
ファイル: PRS_sweep.py プロジェクト: usnistgov/PMUCal
    for freq in freq_list:
        dlyTime = .4  # microseconds

        while (dlyTime > -1):

            #            sleepTime = 5
            #            while (sleepTime > 0):
            #                print sleepTime
            #                time.sleep(1)
            #                sleepTime = sleepTime-1

            print 'freq:', freq, 'hz', 'delay:', dlyTime, 'us'

            time.sleep(2.5)

            fcnParams = lta.__get__('FGen.FunctionParams')
            fcnParams[None][frequency] = freq
            lta.__set__('FGen.FunctionParams', fcnParams)

            lta.__set__('FGen.FunctionParams', fcnParams)

            ClkProperties = lta.__get__('Sync.ClockProperties')
            for element in ClkProperties[None]:

                # For Equivalent Time Sampling, move the digitizer trigger
                if element['clClocks']['Name'] == "PRS":
                    element['clClocks']['Delay'] = float(
                        dlyTime)  #Set initial Pgm_Pps delay time

                # set the PRS frequency:
                if element['clClocks']['Name'] == 'PRS':
コード例 #5
0
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(
                        freq)  # Set Pgm_Pps Freuency
                    element['clClocks']['Delay'] = float(
                        dlyTime)  #Set initial Pgm_Pps delay time
            lta.__set__('Sync.ClockProperties', ClkProperties)
コード例 #6
0
ファイル: DefaultScript.py プロジェクト: usnistgov/PMUCal
# -*- 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

コード例 #7
0
ファイル: PgmPPS_Delayed.py プロジェクト: usnistgov/PMUCal
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]    

    for freq in freq_list:    
        dlyTime = -2.0   # microseconds

        
        while (dlyTime < 2.0):
            print dlyTime

            ClkProperties=lta.__get__('Sync.ClockProperties')
            for element in ClkProperties[None]:
                if element['clClocks']['Name'] == "Digi_Trigger":
                    #element['clClocks']['Frequency'] = float(freq)   # Set Pgm_Pps Freuency
                    element['clClocks']['Delay'] = float(dlyTime)          #Set initial Pgm_Pps delay time
            lta.__set__('Sync.ClockProperties',ClkProperties)

            timeout = 5        
            while(timeout > 0): 
                time.sleep(10)
                locked = lta.__get__('Sync.LockStatus')
                print dlyTime
                if locked[None] == True:
                    lta.s.settimeout(90)               
                    lta.__run__() 
                    lta.s.settimeout(UsrTimeout)
コード例 #8
0
ファイル: RingdownMonteCarlo.py プロジェクト: usnistgov/PARTF
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')
    data_size = len(EventInput['clEvtReportArray'])
    EventTime_arr = np.zeros((data_size, ), dtype=np.object)
    for h in range(data_size):
        EventTime_arr[h] = EventInput['clEvtReportArray'][h]['clReportArg'][
            'Timestamp']
    EventParams = lta.__get__('bus1.event.params')
    #--------------------  Perform several runs -----------------------------------
コード例 #9
0
#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()
    count=20
    
    while (count > 0):
        timeout = 5
        while(timeout > 0): 
                time.sleep(1)
                locked = lta.__get__('Sync.LockStatus')
                print count
                if locked[None] == True:
                    lta.s.settimeout(1000)               
                    lta.__run__() 
                    lta.s.settimeout(UsrTimeout)
                    break
                timeout = timeout - 1
        count = count - 1

                
        if locked[None] != True:
            raise Exception ('Sync module is not locked')
                
   
#------------------all scripts should send their errors to labview------------
コード例 #10
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
コード例 #11
0
from scipy.io import savemat
import numpy as np
import time

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

#------------------- 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')
    #-----------------------  Set Evt Config -------------------------------------
    EventInput = lta.__get__('bus1.event.reports')
    data_size = len(EventInput['clEvtReportArray'])
    EventTime_arr = np.zeros((data_size, ), dtype=np.object)
    for h in range(data_size):
        EventTime_arr[h] = EventInput['clEvtReportArray'][h]['clReportArg'][
            'Timestamp']
    EventParams = lta.__get__('bus1.event.params')
コード例 #12
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()