40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  40m Log  Not logged in ELOG logo
Entry  Mon Apr 13 18:57:03 2009, Alberto, Frogs, Computers, GPIB/ETH Interface Troubles sweepfrequencyPRC.pyHP8590PRC.py
    Reply  Tue Apr 14 12:10:11 2009, Alberto, Frogs, Computers, GPIB/ETH Interface Troubles 
Message ID: 1479     Entry time: Mon Apr 13 18:57:03 2009     Reply to this: 1481
Author: Alberto 
Type: Frogs 
Category: Computers 
Subject: GPIB/ETH Interface Troubles 

I really don't understand why my programs that I used to use to get data from the HP Spectrum Analyzer and the Marconi frequency generator don't work anymore.

I spent hours trying to debug the code but I can't sort the problem out.

The main problem seem to be with the function recv from the socket library. Somehow it can't anymore get any data from the instruments. The thing I can't understand, though, is that if called directly from the python terminal it works fine!

In particular the problem is with the following lines in my code:

netSock.send("++read eoi\n")
tmp = netSock.recv(1024)

Tried a lot of tickering but it didn't work.

I attach the two scripts I've been using. One (sweepfrequencyPRC.py) calls the other (HP4395PRC.py).

They worked egregiously for weeks in the past. Don't know what happened since then.

Attachment 1: sweepfrequencyPRC.py  1 kB  | Hide | Hide all
## sweepfrequency.py [-f filename] [-i ip_address] [-a startFreq] [-z endFreq] [-s stepFreq] [-m numAvg]
## This script sweeps the frequency of a Marconi local oscillator, within the range
## delimited by startFreq and endFreq, with a step set by stepFreq. An arbitary
## signal is monitored on a HP8590 spectrum analyzer and the scripts records the
## amplitude of the spectrum at the frequency injected by the Marconi at the moment.

## The GPIB address of the Marconi is assumed to be 17, that of the HP Spectrum Analyzer to be 18

## Alberto Stochino, October 2008
... 53 more lines ...
Attachment 2: HP8590PRC.py  2 kB  | Hide | Hide all
# This function provides the measuremeent of the peak amplitude on the spectrum analyzer
# HP8590 analyzer while sweeping the excitation frequency on the function generator.
# Alberto Stochino 2008

import re
import sys
import math
from optparse import OptionParser
from socket import *
... 70 more lines ...
ELOG V3.1.3-