Differences between revisions 4 and 18 (spanning 14 versions)
Revision 4 as of 2009-02-23 02:28:37
Size: 1753
Editor: YoichiAso
Comment:
Revision 18 as of 2009-02-23 07:05:46
Size: 9026
Editor: YoichiAso
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
A bunch of python modules and scripts for communicating with GPIB devices over TCP/IP networks are written.
These files are collectively called netgpib package.
This page explains the usage of the package.
netgpib is a collection of python modules and scripts for communicating with GPIB devices over TCP/IP networks. This page explains the usage of the package.
Line 5: Line 4:
=== Where is it ? === == Table of Contents ==
 * [#whereIsIt Where is it ?]
 * [#WhatCanIdo What can I do with it ?]
 * [#Installation Installation]
 * [#Usage Usage]
  * [#netgpibdata.py netgpibdata.py]
  * [#plotgpibdata.py plotgpibdata.py]
  * [#TFSR785.py TFSR785.py]
 * [#MatplotlibTrick matplotlib trick for CentOS5]

<<Anchor(WhereIsIt)>>
== Where is it ? ==
Line 8: Line 18:
The latest version of the package is in the 40m svn repository ( https://nodus.ligo.caltech.edu:30889/svn/trunk/getgpibdata/netgpibdata/ ).
Actually, /cvs/cds/caltech/scripts/general/netgpibdata/ is a working copy of the repository. So you can type `svn up` to synchronize the directory with the repository.
The latest version of the package is in the 40m svn repository ( https://nodus.ligo.caltech.edu:30889/svn/trunk/getgpibdata/netgpibdata/ ). Actually, /cvs/cds/caltech/scripts/general/netgpibdata/ is a working copy of the repository. So you can type {{{svn up}}} to synchronize the directory with the repository.
Line 11: Line 20:
=== What can I do with it === <<Anchor(WhatCanIdo)>>
== What can I do with it ==
Line 14: Line 24:
||Command || Description||
||netgpibdata.py ||Download and save data from a GPIB device. Optionally, it can plot the downloaded data.||
||plotgpibdata.py||Plot the data downloaded by netgpibdata.py||
||TFSR785.py||Perform a transfer function measurement with an SR785. Then download the results from it.||
||SPSR785.py||Perform a spectral measurement with an SR785. Then download the results from it.||
||resetSR785.py||Remotely reset an SR785.||
||Command || Description ||
||netgpibdata.py ||Download and save data from a GPIB device. Optionally, it can plot the downloaded data. ||
||plotgpibdata.py ||Plot the data downloaded by netgpibdata.py ||
||TFSR785.py ||Perform a transfer function measurement with an SR785. Then download the results from it. ||
||SPSR785.py ||Perform a spectral measurement with an SR785. Then download the results from it. ||
||resetSR785.py ||Remotely reset an SR785. ||
Line 23: Line 34:
||Module name||Description||
||netgpib.py||Provide a class to access a network-GPIB converter.||
||gpibplot.py||Provide parsing of the parameter files and plot functions.||
||SR785.py ||A module containing SR785 specific functions for downloading data.||
||AG4395A.py||A module containing AG4395A specific functions for downloading data.||
||termstatus.py||A small utility class for showing status information on a terminal.||
||Module name ||Description ||
||netgpib.py ||Provide a class to access a network-GPIB converter. ||
||gpibplot.py ||Provide parsing of the parameter files and plot functions. ||
||SR785.py ||A module containing SR785 specific functions for downloading data. ||
||AG4395A.py ||A module containing AG4395A specific functions for downloading data. ||
||termstatus.py ||A small utility class for showing status information on a terminal. ||


<<Anchor(Installation)>>
== Installation ==
If you want to install the package in your computer, just copy or check-out the {{{netgpibdata}}} directory into somewhere. You may want to add this directory to your $PATH environmental variable. Of course you need to have [http://www.python.org/ python] installed in your system. The minimum version of python confirmed to work is v2.4. If you want to plot the downloaded data, you need [http://matplotlib.sourceforge.net/ matplotlib] and [http://numpy.scipy.org/ numpy] modules installed. In most cases, these modules are available from your distribution's package system.

<<Anchor(Usage)>>
== Usage ==
For all the commands listed above, you can get a quick help by invoking them with {{{-h}}} option. This will show a list of available options with some descriptions.


<<Anchor(netgpibdata.py)>>
=== netgpibdata.py ===
{{{
Usage: netgpibdata.py [options]

Options:
  -h, --help show this help message and exit
  -f FILENAME, --file=FILENAME
                        Output file name without an extension
  -d DEVICENAME, --device=DEVICENAME
                        A GPIB device name. Default = SR785.
  -a GPIBADDRESS, --address=GPIBADDRESS
                        GPIB device address
  -i IPADDRESS, --ip=IPADDRESS
                        IP address/Host name
  --plot Plot the downloaded data.
  --xlin Plot with linear x axis
  --ylin Plot with linear y axis
  --xlog Plot with logarithmic x axis
  --ylog Plot with logarithmic y axis
}}}

This command will connect and download data from a network-GPIB conversion box specified by {{{-i}}} option.[[BR]] The IPADDRESS can be either numerical ip address or a host name.[[BR]] The GPIB address of the device connected to the network-GPIB box is specified by {{{-a}}} option.[[BR}} {{{-f FILENAME}}} specifies the name of a file (without extension) to which the retrieved data should be saved.[[BR]] The downloaded data will be saved to {{{FILENAME.dat}}} and the measurement parameters will be saved to {{{FILENAME.par}}}.[[BR]] {{{-d}}} option specifies the type of the device connected to the network-GPIB box. Currently supported options are {{{SR785}}} or {{{AG4395A}}}.[[BR]]

{{{--plot}}} option tells the command to plot the retrieved data. This option currently only works with SR785. You need matplotlib and numpy installed for this option to work.[[BR]] {{{--xlin, --ylin, --xlog, --ylog}}} options specify the scaling of plot axes. {{{--ylog}}} option will be ignored if the data contain negative values.

<<Anchor(plotgpibdata.py)>>
=== plotgpibdata.py ===
{{{
Usage: plotgpibdata.py [options]
Plot the data downloaded by netgpibdata.py.
Data is read from FILENAME.dat and the associated parameters are read from FILENAME.par.
You can start an ipython session after a plot is generated. This enables one to change annotations/appearance of the plot.


Options:
  -h, --help show this help message and exit
  -f FILENAME, --file=FILENAME
                        Filename without an extension from which the data and
                        parameters are read.
  -i, --ipython Invoke ipython to interactively change the plot
  --xlin Plot with linear x axis
  --ylin Plot with linear y axis
  --xlog Plot with logarithmic x axis
  --ylog Plot with logarithmic y axis
}}}

This command is used to quickly plot the downloaded data, read from FILENAME.dat.[[BR]]
By using -i option, you can run an ipython session after a plot is generated. In this ipython session, a list object `ax` is available.
Members of the list is matplotlib.axes objects of the created plot. The matplotlib.figure object for the generated plot is available as `fig`.[[BR]]
For example, you can change the title of the first axes by
{{{
ax[0].set_title('New title')
}}}
After you change properties of the figure, you have to refresh the figure window by
{{{
fig.show()
}}}

<<Anchor(TFSR785.py)>>
=== TFSR785.py ===
{{{
Usage: TFSR785.py [options]

This program executes a transfer function measurement using SR785.
Various measurement conditions can be set using options.
The measurement result will be saved in FILENAME.dat and the measurement parameters in FILENAME.par.
Optionally, it can plot the retrieved data. You need matplotlib and numpy modules to plot the data.


Options:
  -h, --help show this help message and exit
  -f FILENAME, --file=FILENAME
                        Output file name without an extension
  -i IPADDRESS, --ip=IPADDRESS
                        IP address/Host name
  -a GPIBADDRESS, --address=GPIBADDRESS
                        GPIB device address
  -s STARTFREQ, --startfreq=STARTFREQ
                        Start frequency. Units can be mHz, Hz or kHz.
  -e STOPFREQ, --stopfreq=STOPFREQ
                        Stop frequency. Units can be mHz, Hz or kHz.
  -n NUMOFPOINTS, --numpoints=NUMOFPOINTS
                        Number of frequency points
  --sweep=SWEEPTYPE Sweep type: Log or Linear
  -x EXCAMP, --excamp=EXCAMP
                        Excitation amplitude
  -c SETTLECYCLES, --settlecycle=SETTLECYCLES
                        Settle cycles
  -t INTCYCLES, --intcycle=INTCYCLES
                        Integration cycles
  --ic1=INPUTCOUPLING1 CH1 input coupling. DC or AC
  --ic2=INPUTCOUPLING2 CH2 input coupling. DC or AC
  --ig1=INPUTGND1 CH1 input grounding. Float or Ground
  --ig2=INPUTGND2 CH2 input grounding. Float or Ground
  --armode=ARMODE Auto range mode: UpOnly or Tracking
  --plot Plot the downloaded data.
}}}

This command remotely executes a transfer function measurement using an SR785 analyzer.
For example, the next command will execute a transfer function measurement with an SR785 connect to a network-GPIB box named `teofila` (hostname of the box).
{{{
TFSR785.py -f TF1 -i teofila -a 10 -s 50kHz -e 100Hz -n 100 --sweep Log -x 100mV -c 10 -t 50 --ic1 AC --ic2 DC --ig1 Float --ig2 GND --armode UpOnly --plot
}}}
In this example, the GPIB address of the SR785 is 10. The downloaded data will be saved to TF1.dat and the measurement parameters will be saved to TF1.par.[[BR]]
The measurement will be logarithmic sweep from 50kHz down to 100Hz at 100 points with an excitation amplitude 100mV.[[BR]]
At each frequency point, the analyzer waits for 10 cycles for settling of the DUT (device under test) and integrates for 50 cycles.[[BR]]
The input coupling of CH1 is AC and CH2 is DC. The grounding is "Float" for CH1 and "Grounded" for CH2. The auto range mode is "up only".[[BR]]
After the measurement is done, the result will be plotted.
 
<<Anchor(MatplotlibTrick)>>
== matplotlib trick on CentOS ==
On CentOS5, the default installation of matplotlib does not work properly.[[BR]]
You have to edit /usr/lib64/python2.4/site-packages/matplotlib/mpl-data/matplotlibrc and change the backend to TkAgg.

netgpib package

netgpib is a collection of python modules and scripts for communicating with GPIB devices over TCP/IP networks. This page explains the usage of the package.

Table of Contents

  • [#whereIsIt Where is it ?]
  • [#WhatCanIdo What can I do with it ?]

  • [#Installation Installation]
  • [#Usage Usage]
    • [#netgpibdata.py netgpibdata.py]
    • [#plotgpibdata.py plotgpibdata.py]
    • [#TFSR785.py TFSR785.py]
  • [#MatplotlibTrick matplotlib trick for CentOS5]

Where is it ?

On the 40m martian machines, the package is installed in /cvs/cds/caltech/scripts/general/netgpibdata/. This directory is included in $PATH by default.

The latest version of the package is in the 40m svn repository ( https://nodus.ligo.caltech.edu:30889/svn/trunk/getgpibdata/netgpibdata/ ). Actually, /cvs/cds/caltech/scripts/general/netgpibdata/ is a working copy of the repository. So you can type svn up to synchronize the directory with the repository.

What can I do with it

Here is the list of commands included in the package.

Command

Description

netgpibdata.py

Download and save data from a GPIB device. Optionally, it can plot the downloaded data.

plotgpibdata.py

Plot the data downloaded by netgpibdata.py

TFSR785.py

Perform a transfer function measurement with an SR785. Then download the results from it.

SPSR785.py

Perform a spectral measurement with an SR785. Then download the results from it.

resetSR785.py

Remotely reset an SR785.

Here is the list of modules provided by the package.

Module name

Description

netgpib.py

Provide a class to access a network-GPIB converter.

gpibplot.py

Provide parsing of the parameter files and plot functions.

SR785.py

A module containing SR785 specific functions for downloading data.

AG4395A.py

A module containing AG4395A specific functions for downloading data.

termstatus.py

A small utility class for showing status information on a terminal.

Installation

If you want to install the package in your computer, just copy or check-out the netgpibdata directory into somewhere. You may want to add this directory to your $PATH environmental variable. Of course you need to have [http://www.python.org/ python] installed in your system. The minimum version of python confirmed to work is v2.4. If you want to plot the downloaded data, you need [http://matplotlib.sourceforge.net/ matplotlib] and [http://numpy.scipy.org/ numpy] modules installed. In most cases, these modules are available from your distribution's package system.

Usage

For all the commands listed above, you can get a quick help by invoking them with -h option. This will show a list of available options with some descriptions.

netgpibdata.py

Usage: netgpibdata.py [options]

Options:
  -h, --help            show this help message and exit
  -f FILENAME, --file=FILENAME
                        Output file name without an extension
  -d DEVICENAME, --device=DEVICENAME
                        A GPIB device name. Default = SR785.
  -a GPIBADDRESS, --address=GPIBADDRESS
                        GPIB device address
  -i IPADDRESS, --ip=IPADDRESS
                        IP address/Host name
  --plot                Plot the downloaded data.
  --xlin                Plot with linear x axis
  --ylin                Plot with linear y axis
  --xlog                Plot with logarithmic x axis
  --ylog                Plot with logarithmic y axis

This command will connect and download data from a network-GPIB conversion box specified by -i option.BR The IPADDRESS can be either numerical ip address or a host name.BR The GPIB address of the device connected to the network-GPIB box is specified by -a option.BR}} {{{-f FILENAME}}} specifies the name of a file (without extension) to which the retrieved data should be saved.[[BR The downloaded data will be saved to FILENAME.dat and the measurement parameters will be saved to FILENAME.par.BR -d option specifies the type of the device connected to the network-GPIB box. Currently supported options are SR785 or AG4395A.BR

--plot option tells the command to plot the retrieved data. This option currently only works with SR785. You need matplotlib and numpy installed for this option to work.BR --xlin, --ylin, --xlog, --ylog options specify the scaling of plot axes. --ylog option will be ignored if the data contain negative values.

plotgpibdata.py

Usage: plotgpibdata.py [options]
Plot the data downloaded by netgpibdata.py.
Data is read from FILENAME.dat and the associated parameters are read from FILENAME.par.
You can start an ipython session after a plot is generated. This enables one to change annotations/appearance of the plot.


Options:
  -h, --help            show this help message and exit
  -f FILENAME, --file=FILENAME
                        Filename without an extension from which the data and
                        parameters are read.
  -i, --ipython         Invoke ipython to interactively change the plot
  --xlin                Plot with linear x axis
  --ylin                Plot with linear y axis
  --xlog                Plot with logarithmic x axis
  --ylog                Plot with logarithmic y axis

This command is used to quickly plot the downloaded data, read from FILENAME.dat.BR By using -i option, you can run an ipython session after a plot is generated. In this ipython session, a list object ax is available. Members of the list is matplotlib.axes objects of the created plot. The matplotlib.figure object for the generated plot is available as fig.BR For example, you can change the title of the first axes by

ax[0].set_title('New title')

After you change properties of the figure, you have to refresh the figure window by

fig.show()

TFSR785.py

Usage: TFSR785.py [options]

This program executes a transfer function measurement using SR785.
Various measurement conditions can be set using options.
The measurement result will be saved in FILENAME.dat and the measurement parameters in FILENAME.par.
Optionally, it can plot the retrieved data. You need matplotlib and numpy modules to plot the data.


Options:
  -h, --help            show this help message and exit
  -f FILENAME, --file=FILENAME
                        Output file name without an extension
  -i IPADDRESS, --ip=IPADDRESS
                        IP address/Host name
  -a GPIBADDRESS, --address=GPIBADDRESS
                        GPIB device address
  -s STARTFREQ, --startfreq=STARTFREQ
                        Start frequency. Units can be mHz, Hz or kHz.
  -e STOPFREQ, --stopfreq=STOPFREQ
                        Stop frequency. Units can be mHz, Hz or kHz.
  -n NUMOFPOINTS, --numpoints=NUMOFPOINTS
                        Number of frequency points
  --sweep=SWEEPTYPE     Sweep type: Log or Linear
  -x EXCAMP, --excamp=EXCAMP
                        Excitation amplitude
  -c SETTLECYCLES, --settlecycle=SETTLECYCLES
                        Settle cycles
  -t INTCYCLES, --intcycle=INTCYCLES
                        Integration cycles
  --ic1=INPUTCOUPLING1  CH1 input coupling. DC or AC
  --ic2=INPUTCOUPLING2  CH2 input coupling. DC or AC
  --ig1=INPUTGND1       CH1 input grounding. Float or Ground
  --ig2=INPUTGND2       CH2 input grounding. Float or Ground
  --armode=ARMODE       Auto range mode: UpOnly or Tracking
  --plot                Plot the downloaded data.

This command remotely executes a transfer function measurement using an SR785 analyzer. For example, the next command will execute a transfer function measurement with an SR785 connect to a network-GPIB box named teofila (hostname of the box).

TFSR785.py -f TF1 -i teofila -a 10 -s 50kHz -e 100Hz -n 100 --sweep Log -x 100mV -c 10 -t 50 --ic1 AC --ic2 DC --ig1 Float --ig2 GND --armode UpOnly --plot

In this example, the GPIB address of the SR785 is 10. The downloaded data will be saved to TF1.dat and the measurement parameters will be saved to TF1.par.BR The measurement will be logarithmic sweep from 50kHz down to 100Hz at 100 points with an excitation amplitude 100mV.BR At each frequency point, the analyzer waits for 10 cycles for settling of the DUT (device under test) and integrates for 50 cycles.BR The input coupling of CH1 is AC and CH2 is DC. The grounding is "Float" for CH1 and "Grounded" for CH2. The auto range mode is "up only".BR After the measurement is done, the result will be plotted.

matplotlib trick on CentOS

On CentOS5, the default installation of matplotlib does not work properly.BR You have to edit /usr/lib64/python2.4/site-packages/matplotlib/mpl-data/matplotlibrc and change the backend to TkAgg.

netGPIB (last edited 2019-07-30 23:05:51 by NathanhollandATligoDOTorg)