• SCPI query issue

    Every once in a while I would get issues like this. 
        lst = [float(self.query(f"MEASUrement:MEAS{meas}:mean?")),
    ValueError: could not convert string to float: 'TEKTRONIX,MSO44,B026208,CF:91.1CT FV:1.34.8.1078\n'

    So I'm trying to query "MEASUrement:MEAS1:mean?"
    When I use tek scope utility (console tab) using that exact string, I get 44.9869573289624, as expected. 
    but in the above automation script (where meas = 1), I received a string of 'TEKTRONIX,MSO44,B026208,CF:91.1CT FV:1.34.8.1078\n' (which is the IDN) instead. 
    Why would the scope return IDN when I'm trying to query "MEASUrement:MEAS1:mean?". And it's not specific to "MEASUrement:MEAS1:mean?". I've seen scope returning IDN for other queries too. 
    See pic too. 
     
  • SCPI/programming: Is there a way to simply retrieve the scope screen shot as a file object

    Hi, 
    Is there a way to retrieve scope screen shot without saving the image file on the scope local drive, specify the location, read it back to the host PC, and then delete it from the scope local drive (this is because I'm doing this a lot and without deleting it will overflow the drive space)? Please see below code. 

    Is there a way to simply retrieve the scope screen shot as a file object without going thru the above steps? If not, please help with the below issue. 


    An issue with the below scripts is that I randomly get stuck with erros (at random lines of codes, more likely for line "read_raw(1920 * 1080)") "pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed."

    what I have noticed is that by plugging in/out USB, or power cycling the scope/PC sometimes resolve these timeout errors. Any insights?

    def get_screenshot(self):
        now = str(datetime.datetime.now()).replace(":", "-")
        # print(now)
        self.write(f'SAVE:IMAGe \"C:/{now}.png\"')
        self.query("*OPC?")
        self.write(f'FILESystem:READFile \"C:/{now}.png\"')
        imgData = self.inst.read_raw(1920 * 1080)
        cwd = os.getcwd()
        full_path = cwd + "\\scope screenshots"
    
        Path(full_path).mkdir(exist_ok=True)
    
        filepath = full_path + "\\" + now + ".jpg"
        file = open(filepath, "wb")
        file.write(imgData)
        file.close()
        self.write(f'FILESystem:DELEte \"C:/{now}.png\"')
        return filepath
  • RE: meas for phase delay from pos edge of chan1 to pos edge of chan2?

    I'm trying to get the phase delay of 2 channels using SCPI programming. 
    I know how to do this manually. See attached pic. 
    I want to know how to do this automatically by:
    1. adding a meas stat badge so I can get the stats of the delay. 
    2. getting an instantaneous value 

  • meas for phase delay from pos edge of chan1 to pos edge of chan2? 

    Hi Tek support,
    How do I add a meas for phase delay from pos edge of chan1 to pos edge of chan2? Found below info but it doesn't tell me how to specify delay from pos edge of chan1 to pos edge of chan2. 

    From Manual: 

    "PDUTY (Positive Duty Cycle) is the ratio of the Positive Pulse Width to the Period.
    This measurement is made on each cycle in the record.
    Positive Duty Cycle = (Positive Width)/Period × 100%
    PERIOD is the time required to complete a cycle. A cycle is the time between
    two adjacent (same direction) crossings of the Mid reference level (RM). This
    measurement is made on each cycle in the record.
    PHASE is the ratio of the Skew between two sources to the Period of the first
    source. This measurement is made on each cycle in the record.
    PHASENOISE (Phase Noise) is the RMS magnitude of all integrated jitter falling
    within a user specified offset range of the fundamental clock frequency. This
    measurement is made across the entire record. This measurement is not available
    on a 4 Series MSO instrument."

  • RE: MSO44 scope SCPI query avg voltage question

    What do you mean by free DVM? 

  • MSO44 scope SCPI query avg voltage question

    Is there an easy way to query the average voltage of say channel 3 without having to add a meas badge and the query the stat mean of it?
    It works but I'll have to keep track of how many meas are already on the scope (say I have 5 already) and I'll need to add a badge and then query meas6's mean to get it. I know how to query all available meas but I was just wondering if there's an easier SCPI cmd to do so. 
     

  • MSO44 scope SCPI trigger questions

    TRIGger:{A|B}:LOGIc:DELTatime

    What's the difference between Trigger "A" and "B" above?


    How do I change the trigger source to say Ch3 with level "set to 50%"?

  • RE: MSO44 scope SCPI questions

    Very helpful. 
    What's the difference between Trigger "A" and "B"?

    TRIGger:{A|B}:LOGIc:DELTatime
  • MSO44 scope SCPI questions

    I was able to add a meas by sending the below cmd which defaults to CH1. 
    self.inst.write('MEASUrement:addmeas pduty')
    

    How do I change the source to CH2? I have tried a few things, 2 which are as shown below. 
    Also, how do I check "show stats badge" and turn population limit on to 100? see below also. 
     
    self.inst.write('MEASUrement:addmeas pduty:CH2')
    self.inst.write('MEASUrement:CH2:addmeas pduty')
    def limit_population(self, N=100):
        self.inst.write('MEASUrement: POPUlation:LIMIT: ON')
        self.inst.write('MEASUrement: POPUlation:LIMIT: VALue ' + str(N))