EEVblog® Electronics Community Forum
Products => Test Equipment => Topic started by: damien on January 21, 2024, 06:32:41 am
-
Hi all,
I've been working for a while on a python script for capturing screenshots from vintage instruments and would appreciate the community's feedback and help.
Here's a few samples to start with:
[attachimg=1]
[attachimg=2]
[attachimg=3]
86 devices are supported, but don't get too excited because 1) it's easy to reach this number with some instruments having many variants (like the HP85xx series of spectrum analyzers) and 2) not all devices have been tested, and I even boldly assumed that if it works for one instrument of a series then it works for all of them. You will notice that all instruments are from HP at the moment but there should be nothing preventing us from supporting devices from other manufacturers.
HP-53310A Modulation domain analyzer
HP-8990A and 8991A Peak power analyzers [untested]
HP-8992A Digital video power analyzer [untested]
HP-5450/1xA/B Digital oscilloscopes (54501A, 54503A, 54504A, 54505A/B, 54506B, 54510A/B, 54512B) [untested]
HP-5452/4xA Oscilloscopes (54520A, 54522A, 54540A, 54542A)
HP-54600 Oscilloscopes (54600A, 54601A, 54602A, 54600B, 54601B, 54602B, 54603B, 54610B, 54615B, 54616B, 54645A, 54645D)
HP-54620A Logic analyzer [untested]
HP-83475B Lightwave communication analyzer [untested]
HP-5461/2xA/D Oscilloscopes (54621A/D, 54622A/D, 54624A, 54641A/D, 54642A/D)
HP-4395A and HP-4396B Spectrum / network / impedance analyzers
HP-4286A RF LCR meter [untested]
HP-4291A/B Impedance / material analyzer [untested]
HP-4294A Precision impedance analyzer [untested]
HP-4352B VCO/PLL analyzer
HP-859xE Spectrum analyzers (8591E, 8593E, 8594E, 8595E, 8596E)
HP-859xEM EMC analyzers (8591EM, 8593EM, 8594EM, 8595EM, 8596EM)
HP-859xL Spectrum analyzers (8590L, 8592L)
HP-856xE Spectrum analyzers (8560E, 8561E, 8562E, 8563E, 8564E, 8565E)
HP-E444x PSA Signal analyzers (E4440A, E4443B, E4445A, E4446B, E4447A, E4448A) [tested]
HP-E440/1x ESA Spectrum analyzers (E4401B, E4402B, E4403B, E4404B, E4405B, E4407B, E4408B, E4411B) [tested]
HP-E4406A VSA Signal analyzer [untested]
HP-894xx Signal analyzers (89441A, 89440A, 89410A, 89441V, 89450A, 89451A) [untested]
The script is 100% python and is based on pyvisa, so if you're interested in giving it a spin you will need a working pyvisa setup. ImageMagick is the only other dependency. Visashot has been tested on Linux and Windows, but I don't have a Windows machine myself so support for this platform may be a little spotty.
Please consider contributing, for example by:
- testing with your instruments
- sharing sexy screenshots
- helping to support more devices
- testing on other platforms (mac?)
Project page for download and more information: https://damien.douxchamps.net/elec/visashot/
Developer site: https://sourceforge.net/projects/visashot/ (yeah, I know SF is old skool...)
A mailing list (https://sourceforge.net/projects/visashot/lists/visashot-discuss) is also available to facilitate testing and development discussions.
Cheers!
-
Tried on Windows with my E4407B:
.\visashot.py -d 18 -i 1 -o screen.png -g
Unsupported instrument ' E4407B'. Aborting.
ERROR:Empty screenshot buffer
After stripping the model string I got a Visa timeout instead. I have NI-Visa installed.
Full "*IDN?" response is: "Hewlett-Packard, E4407B, MY41440643, A.14.06"
This is what I use for screenshots: https://github.com/mankangustafsson/gpib_playground/blob/master/esa_screen.py (https://github.com/mankangustafsson/gpib_playground/blob/master/esa_screen.py)
-
Thanks for the feedback! Stripping is indeed required for more recent instruments.
The code I used for the E4400 is inspired from this repo https://github.com/angry-dad/E4407B-GPIB-Screen-Capture which has essentially the same ideas.
I've also increased the timeout to 10 seconds, if it doesn't work I suppose we could push it even further but it becomes a bit... strange? Ideally I'd like to find a way to do it without timeouts.
Git repo updated! :-)
-
Still get timeouts but I do not think the instrument is slow. My script takes 5-6 seconds to complete.
It seems like there are some bad commands sent, see picture.
[attach=1]
Also, you need to delete the file first.
-
I missed the different behavior for querying files on the E44xx. New updates in git!
Thanks again for the help, especially since you already have something working on your side <3
-
Damien, you are welcome. I can now confirm that revision dcd818 is working for me on my E4407B.
-
Excellent! I'm surprised I managed to get it right in only two iterations ;-)
Oh if you have a screenshot I could use on the project page that'd be awesome.
-
New release 1.20 is now available with confirmed support for E44xx signal analyzers!
Big thanks to @mankan for the feedback!
Here's a gratuitous extra screenshot to celebrate:
[attachimg=1]
-
This is just the tool I need for my 53310A ;D
But I have Zero knowledge with Python
I do run EZGPIB (pascal) with NI libraries, and have a NI USB interface
Can talk to the 53310A
IDN?: HEWLETT-PACKARD,53310A,0,3235
VERS?: 1990,0
OPT?: MEMORY,C,0,RF
But what do I need to download/install in order to use this tool?
-
This is just the tool I need for my 53310A ;D
But I have Zero knowledge with Python
I do run EZGPIB (pascal) with NI libraries, and have a NI USB interface
Can talk to the 53310A
IDN?: HEWLETT-PACKARD,53310A,0,3235
VERS?: 1990,0
OPT?: MEMORY,C,0,RF
But what do I need to download/install in order to use this tool?
It uses pyvisa for communication with the instrument, so you'll need to install and configure it. There are instructions for installing and information about the backends it can use (including NI) here (https://pyvisa.readthedocs.io/en/latest/introduction/getting.html).
-
It will be difficult to have automated regression testing for this, but I suggest you keep a database of example responses of different instruments. So you can document odd edge cases where e.g. different versions reply differently to *IDN etc. Otherwise I think it's easy to break previously-working support while fixing others...
-
It will be difficult to have automated regression testing for this, but I suggest you keep a database of example responses of different instruments. So you can document odd edge cases where e.g. different versions reply differently to *IDN etc. Otherwise I think it's easy to break previously-working support while fixing others...
Yes regressions are going to be hard to manage. As more people use the script my hope is that we'll have volunteers who can test their instruments before new releases. In the meantime your idea is great, I've started to list the IDN strings I know in an idn.txt file. I have also kept PCL buffers from various instruments for testing the parsing of that format, also in the repo now.
Here are the 5 IDNs strings I know. Note that serial numbers are partially blanked with zeros.
Please share your IDN if your instrument is supported!
HEWLETT-PACKARD,4396B,JP1KE00000,REV1.16
Hewlett-Packard, E4407B, MY41440000, A.14.06
HEWLETT-PACKARD,53310A,0,3235
HEWLETT-PACKARD,54542A,3400A00000,00.13,01.14,T3.33,01.01,0.001
AGILENT TECHNOLOGIES,54641D,MY42000000,A.02.31
-
Hi Damien,
I've been trying to run the Visashot script to capture from my Agilent 54642D, although 54642D stated "Remote Operation Completed", but I keep encountering error "FileNotFoundError: [WinError 2] The system cannot find the file specified". Has anyone here encountered this error?
I installed ImageMagick-6.9.13, PythonMagick 0.9.19, and tried inserting "shell=True" in subprocess code but has no luck in resolving this error.
Below are the console logs:
C:\Users\James\AppData\Local\Programs\Python\Python313\python.exe C:/Users/James/Downloads/visashot.py -s GPIB0::7::INSTR -o test.png
Traceback (most recent call last):
File "C:\Users\James\Downloads\visashot.py", line 934, in <module>
_main()
~~~~~^^
File "C:\Users\James\Downloads\visashot.py", line 892, in _main
rtn = capture(instr, output_filename, trim, margin, scale, recolor, foreground_color, background_color, swap_id_command_order)
File "C:\Users\James\Downloads\visashot.py", line 748, in capture
_execute_imagemagick([IMAGE_MAGICK_CONVERT, tmp_filename, filename])
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\James\Downloads\visashot.py", line 524, in _execute_imagemagick
stdout, stderr = subprocess.Popen(command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1036, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1548, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Process finished with exit code 1
-
Hi!
I don't have a windows machine so it's not easy to get things working on your platform. But let's try! ;D
I imagine that you found the possible solution "shell=True" here: https://stackoverflow.com/questions/73193119/python-filenotfounderror-winerror-2-the-system-cannot-find-the-file-specifie
It was the first hit on google for me :D The second one on that page could be useful too?
The first thing would be to try the latest version of visashot https://damien.douxchamps.net/elec/visashot/ but I doubt it will help becauseI've never heard about this issue before.
Next you could display the two filenames before the execution, adding just before line 760 (latest version):
logging.debug("tmp_filename: %s", tmp_filename)
logging.debug("filename: %s", filename)
If the execution fails the tmp_filename should still be present in your system and it should contain a valid image. I don't think this is the issue but at least we could be certain.
Could you also share the full logs? (using the -g option)
-
Hi Damien, I'm not too sure why but I somehow managed to get it working.
Last night I uninstalled ImageMagick-6.9.13 and installed the latest version ImageMagick-7.1.1-39-Q16-HDRI-x64, but still couldn't get it working.
Just now after seeing your post I tried again, it works! I didn't restart my computer or change any settings, so I'm not too sure what I did to fix it. I used the latest Visashot script from your website and didn't do any modification (not even the Shell=True).
Sorry for taking your precious time trying to figure this out.
I'm going to try on my HP 3563A next! Will report my results here.
C:\Users\James\AppData\Local\Programs\Python\Python313\python.exe C:/Users/James/Downloads/visashot.py -s GPIB0::7::INSTR -o agilent.png
Process finished with exit code 0
(https://www.eevblog.com/forum/testgear/visashot-a-python-script-for-capturing-screenshots-from-vintage-instruments/?action=dlattach;attach=2405047;image)
-
Great! ^-^
I haven't tested the 3563A so if it works it's (another) small miracle. But definitely worth a try. And I'm happy to discuss with you to make it happen.
Cheers!
-
Hi Damien,
Ok I've tried each device type scripts and so far not working: 3563A will first show "Unknown Mnemonic" and then "Command Too Long" before timeout.
Sorry I'm not familiar with HP-IB programming, I just started to read the 3563A programming manual:https://docs.ampnuts.ru/eevblog.docs/HP_Agilent_Keysight/HP%203563A%20Programming.pdf (https://docs.ampnuts.ru/eevblog.docs/HP_Agilent_Keysight/HP%203563A%20Programming.pdf) . In appendix B Example Program 1 would that be a good start? Though seems like this code passes the control to 3563A to trigger the print though.
-
A quick check into the manual you linked indicates that it's a vector graphic display. Visashot only works with bitmaps at the moment.
Still, it should be possible to get the HPGL buffer and render that into a bitmap. Or use an HPGL to SVG converter (apparently those exist!)
The relevant pages are 5-28 and following. There seems to be two commands to send:
- VBLK 1
- DVAS or DVAN or DVBN, depending on the output format
After that capturing the buffer should be possible.
You can first try visashot with the -I option, this should get the ID string right.
For developing the best would be to start by getting the buffer in the 3 different formats. Simplest would be to get a python console, connect to your instrument (see short sample on my website) and then send the two commands above (e.g. VBLK1 or VBLK01, followed by DVAS) Then maybe something like "READ?" but I'm not sure... Hacking required from this point ;-)
-
What you meant by hacking is reverse engineering and reconstructing the data right? ;D
I did the DVAS, DVAN and DVBN tests below, so far I can complete each test command individually. If i mix 2 together (eg. VBLK1>DVAS>READ?>VBLK1>DVAN), I'll get into timeout error and can only recover after I restarted 3563a.
Test 1
>>> instrument.write("VBLK1")
7
[3563A displayed: "VECTOR DISP BLOCK 1"]
>>> instrument.write("DVAS")
6
[3563A displayed: "DUMP VECTOR DISP ASCII"]
>>> instrument.write("READ?")
7
No status changes in 3563A
Test 2
>>> instrument.write("VBLK1")
7
[3563A displayed: "VECTOR DISP BLOCK 1"]
>>> instrument.write("DVAN")
6
[3563A displayed: "DUMP VECTOR DISP ANSI"]
>>> instrument.write("READ?")
7
No status changes in 3563A
Test 3
>>> instrument.write("VBLK1")
7
[3563A displayed: "VECTOR DISP BLOCK 1"]
>>> instrument.write("DVBN")
6
[3563A displayed: "DUMP VECTOR DISP BINARY"]
>>> instrument.write("READ?")
7
No status changes in 3563A
Test 1
>>> import pyvisa
>>> ressourceManager = pyvisa.ResourceManager()
>>> instrument = ressourceManager.open_resource("GPIB0::20::INSTR")
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAS")
6
>>> instrument.write("READ?")
7
Test 2
>>> import pyvisa
>>> ressourceManager = pyvisa.ResourceManager()
>>> instrument = ressourceManager.open_resource("GPIB0::20::INSTR")
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAN")
6
>>> instrument.write("READ?")
7
Test 3
>>> import pyvisa
>>> ressourceManager = pyvisa.ResourceManager()
>>> instrument = ressourceManager.open_resource("GPIB0::20::INSTR")
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVBN")
6
>>> instrument.write("READ?")
7
Combined Test with error
>>> import pyvisa
>>> ressourceManager = pyvisa.ResourceManager()
>>> instrument = ressourceManager.open_resource("GPIB0::20::INSTR")
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAS")
6
>>> instrument.write("READ?")
7
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAN")
Traceback (most recent call last):
File "<python-input-7>", line 1, in <module>
instrument.write("DVAN")
~~~~~~~~~~~~~~~~^^^^^^^^
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyvisa\resources\messagebased.py", line 196, in write
count = self.write_raw(message.encode(enco))
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyvisa\resources\messagebased.py", line 156, in write_raw
return self.visalib.write(self.session, message)[0]
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyvisa\ctwrapper\functions.py", line 2795, in write
ret = library.viWrite(session, data, len(data), byref(return_count))
File "C:\Users\James\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
return self.handle_return_value(session, ret_value) # type: ignore
-
Yeah, things are going to get a little dirty :D
From the 6/7 returned by the commands I can see that the termination characters you're using are "\r\n", which should work. Well actually it worked since you've got reasonable messages displayed on the 3563A. So I think talking with the instrument is not an issue. Noice.
What is the instrument ID string?
id_string = instrument.query("ID?")
print(id_string)
When using the READ? command you will need to actually read from the instrument after that. The fact that the instrument doesn't say anything on the screen when you do the READ? is probably a good thing (no error) but now it's just waiting for you to get the bytes, for example using:
buffer = instrument.read_raw()
Then you could save the content of the buffer to check what's in it, maybe after checking its length:
print("Buffer length: " + str(len(buffer)) + "\n")
file = open("buffer.raw", "wb")
file.write(buffer)
file.close()
... or something like that (the code above is untested but should may work)
If that works then try to get a buffer file for each of the output formats.
If there's more than 20kB or so you may need to read multiple times and concatenate the outputs, but let's forget about that for now...
-
Sorry I missed the instrument string: "HP3563A"
So far so good all 3 buffer types are less than 20kb, 3563A shows no errors or indication during buffer extraction, and managed to extract them as attached.
>>> import pyvisa
>>> ressourceManager = pyvisa.ResourceManager()
>>> instrument = ressourceManager.open_resource("GPIB0::20::INSTR")
>>> id_string = instrument.query("ID?")
>>> print(id_string)
HP3563A
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAS")
6
>>> buffer = instrument.read_raw()
>>> print("Buffer length: " + str(len(buffer)) + "\n")
Buffer length: 2012
>>> file = open("dvasbuffer.raw", "wb")
>>> file.write(buffer)
2012
>>> file.close()
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVAN")
6
>>> buffer = instrument.read_raw()
>>> print("Buffer length: " + str(len(buffer)) + "\n")
Buffer length: 1068
>>> file = open("dvanbuffer.raw", "wb")
>>> file.write(buffer)
1068
>>> file.close()
>>> instrument.write("VBLK1")
7
>>> instrument.write("DVBN")
6
>>> buffer = instrument.read_raw()
>>> print("Buffer length: " + str(len(buffer)) + "\n")
Buffer length: 270
>>> file = open("dvbnbuffer.raw", "wb")
>>> file.write(buffer)
270
>>> file.close()
-
The size is way to small for a screenshot, even vectorized :-( All I was able to do is use the dvasbuffer.raw and after removing a couple of bytes at the beginning it can be loaded in octave/matlab. Don't get too excited though: the plot is not interesting. Not actually sure what it represents. See pic below.
There has to be another function for the screenshot or printing :(
-
I just made some minor improvements over the holidays and that means a new release 1.22!
- Successful tests with HP-8563E
- Improve handling of PRINT_DEVICES instruments
- Switch to IM v7 while keeping some compat with v6.
- Be robust against bad serial numbers in IDN string
- HP 5450/1xA/B scopes successfully tested
- Fix serial baud rate argument handling
- Automatic timeout calculation for serial devices
Quick download link: https://damien.douxchamps.net/elec/visashot/visashot.py
Enjoy!
-
Yet another new release. The major addition in 1.23 is the support for the LeCroy 9300 series of scopes.
120 instruments are now supported, thanks to all the contributors!
Quick download link: https://damien.douxchamps.net/elec/visashot/visashot.py
Enjoy!
[attachimg=1]
-
a stray '+' here maybe?
/visashot.py", line 815
if model in LECROY_SCDP_DEVICES+: # Some devices are orange instead of green
^
SyntaxError: invalid syntax
-
Hi fenugrec,
Whoopsie, thanks! Fixed in 1.24 :-)
-
HP-894xx Signal analyzers (89441A, 89440A, 89410A, 89441V, 89450A, 89451A) [untested]
Minor data point: it looks like the 89410A/8944xA should work, but the MMEM storage area appears to only have about 64KB available, at least on mine. TIFF files tend to be (much) bigger than that, and in my case I get a disk-full error.
I added a couple of lines to force it to use the RAM disk:
instrument.write("MMEM:INIT 'RAM:',DOS, 500000")
instrument.write("MMEM:MSIS 'RAM:'")
That lets it create the SCRNSHOT.TIF file, but instrument_query_binary_values() doesn't appear to read the preamble properly. I can retrieve the file with this short program, courtesy o4-mini-high:
import pyvisa
rm = pyvisa.ResourceManager()
inst = rm.open_resource('GPIB0::17::INSTR')
inst.read_termination = None
inst.write_termination = '\r\n'
inst.write(":MMEM:DATA? 'SCRNSHOT.TIF'")
hdr = inst.read_bytes(2) # b'#' + b'<digit>'
if hdr[0] != ord('#') or not chr(hdr[1]).isdigit():
raise RuntimeError(f"Bad preamble: {hdr!r}")
n = int(chr(hdr[1])) # how many ASCII digits follow
len_s = inst.read_bytes(n).decode('ascii') # payload length
length = int(len_s)
img = inst.read_bytes(length)
inst.read_bytes(1) # trailing \n
with open('screen.tif','wb') as f:
f.write(img)
The file is there, but the incantation that wrote it apparently wasn't quite right:
(https://i.imgur.com/M0nz2uC.png)
That's all the time I had to tinker around with it. Looks pretty close, but I'm not familiar enough with PyVISA to diagnose it easily.
-
Hi KE5FX,
Ooh, this is awesome! I did some quick blind coding for those instruments, I'm surprised is "nearly" works! ^-^
I added your two lines and changed
instrument.write(":MMEM:DATA? 'INT:scrnshot.tif'")
into
instrument.write(":MMEM:DATA? 'RAM:scrnshot.tif'")
Since you set "MMEM:MSIS 'RAM:'" we could maybe omit the "RAM:" before "scrnshot.tif" but it could also be the source of the error you saw. BTW that red warning on the screen is missing the "?" after "MMEM:DATA". Maybe it was from a previous (unsuccessful) attempt at reading the buffer, because AFAICT that GPIB call is for reading not writing.
Can you try the attached version? If anything is wrong please try the -g option and share the debug output.
-
Can you try the attached version? If anything is wrong please try the -g option and share the debug output.
Thanks much, that worked after a couple of tweaks. :-+
- Some operations needed *WAI commands for synchronization
- The 894xx doesn't support the READ? command so I added a separate _read_HCOPY_bitmap() function
- Deleting a file that doesn't exist causes an error message, so you won't want to do that twice (or at all, necessarily, since the RAM disk gets initialized each time)
There should probably be a warning somewhere that we nuke the RAM disk. Hate to do something like that, but I don't see any alternatives at first glance.
-
Hi KE5FX,
Thanks for helping out! I've tweaked a few minor things and came up with this new version. Let me know if there's any issue, otherwise I'll make a new release. Banzai!
Damien
-
Looks good, ship it!
-
I think being able to print is great. I have a spectrum analyzer (8592L) and think being able to print will be nice.
Unfortunately I don't believe I have any spare cables and not knowledgeable with using Python scripts.
Do you have plans to post a brief tutorial on making a cable and/or better steps to implement the script?
-
HPiB cables should be quite simple to acquire as used surplus.
Given the rather apecial connectors forget about DIY.
-
Besides the GPIB cable, you also need a GPIB Interface
Look at the AR488 - USB to GPIB DIY - based on a Arduino Nano
-
Hi Bostonman,
I have some information/tips on my website here: https://damien.douxchamps.net/elec/visashot/ Admittedly not a full tutorial though. ::)
The most important is to get GPIB (or serial) and pyVISA working with your machine.
If you have a desktop you can find cheap PCI cards (ok, an older desktop then!) or as @DeepLink suggested a USB adapter. The DIY one is the cheapest way, you can also find some by Keysight/Agilent or NI on auction sites (but they can go for more than $100).
If you use linux then python will be easy: just save the script somewhere and execute it (use the -h option for help). For example:
./visashot.py -d 8 -o output.png
for device 8 on the GPIB bus. On windows you will have to install python and call it a little differently:
python3 visashot.py -d 8 -o output.png
-
Looks good, ship it!
Awesome, released! Thanks for the feedback and help ;D
-
Sadly, I thought my 8592L had GPIB. Unfortunately, after doing more research into implementing your script, I grabbed my analyzer only to discover it has serial and parallel only.
-
Sadly, I thought my 8592L had GPIB. Unfortunately, after doing more research into implementing your script, I grabbed my analyzer only to discover it has serial and parallel only.
Someone with an 8591EM had success using the serial port. It would look something like:
./visashot.py -g -s "ASRL4::INSTR" -r 19200 -o output.png
ASRL is for the serial port, and you will need to set the baudrate on your instrument too.
-
So a basic serial cable to a USB convertor, and then use Visashot?
Do I need any image convertor or is it simply run that command and get a PNG image?
Some research showed I'd need the parallel port for capturing screen shots and the serial port for capturing the settings (i.e. frequency, span, etc...) with a RTC (real time clock) for keeping track of date/time stamps, and an SD card. This all assumes I use an Arduino to do the work.
-
So a basic serial cable to a USB convertor, and then use Visashot?
Yes it should be that simple. I'm not sure about the code when using a USB-serial converter though. Hopefully it's as simple as ASRL1 (serial port 1).
Do I need any image convertor or is it simply run that command and get a PNG image?
No convertor needed, it's integrated in visashot via ImageMagick. So something close to the command line above should give you a PNG image as output.
You can run
./visashot.py -h
for help about options. I've only had one person with a serial instrument so far, so I can't rule out it will fail. But I'm happy to work with you to make it chooch!
-
Thankfully I have a USB to serial convertor (also had to install a driver).
Due to too many anomalies between analyzer printer settings, not understanding Python, and your script, I apologize in advance, but need some help with the basics.
The analyzer printer settings is something I'll need to tinker with, but I'd like to know one piece of the puzzle that is correct so I know where to focus my attention.
I have an older laptop with Win7 with Python 3.8.0; I just downloaded it and ran the installer. When I click your script, I get a Command window that quickly closes.
The little I know about Python is: I think it needs to be set in an environment in order to just run a .py file. I added the path in the environment. Now when I type Python --version in the CMD window, it shows the version.
Having said this, I'm uncertain how to setup Python to run your script; and this eliminates me from using the 'help' file you suggested.
As for the analyzer, I'm tinkering with the print/plotter settings, but, each time I try a setting by pressing 'copy', it freezes. Due to not understanding how to run the script, I have two equations with three unknowns (the third being whether this USB to serial works).
Going forward, assuming this current setup works, ideally I'd like something that will last the test of time. Most likely a USB to serial convertor will not work on future Windows due to driver incompatibility, but maybe an alternate method would be great like a Pi or Arduino.
-
To run the script you type (in the folder that contains visashot)
Python visashot.py
Note that you need to install the python package PyVisa. Otherwise the visashot will not be happy. I have no windows experience, but on Linux you would do:
pip install pyvisa
For ImageMagick have a look here: https://imagemagick.org/script/download.php
Maybe a good samaritan with Windows experience can help? :-)
-
Hmmmm seems then this would all be easier on Linux.
Looking at pyvisa, it seems a NI driver also needs to be installed.
-
Think maybe I'll need to cancel trying to get this to work.
The NI Visa that's required needs Labview and/or Studio installed. I can try Linux, but assume I need a driver for the serial to USB cable.
-
Looking at pyvisa, it seems a NI driver also needs to be installed.
If it meets your needs, the pyvisa-py backend is usually much easier to get working in my experience, rather than messing with the vendor drivers.
-
I can try Linux, but assume I need a driver for the serial to USB cable.
most linux distros will have all the common usb serial devices prebuilt and will show up as either /dev/ttyUSB[n] or /dev/ttyACM[n] out of the box
-
From what I understand, and maybe my interpretation is incorrect, pyvisa won't install without the NI stuff, but then NI won't install without Labview or Studio.
So it seems this whole setup isn't Windows friendly.
-
From what I understand, and maybe my interpretation is incorrect, pyvisa won't install without the NI stuff, but then NI won't install without Labview or Studio.
So it seems this whole setup isn't Windows friendly.
No, that's what pyvisa-py is for, to avoid that:
https://pyvisa.readthedocs.io/en/latest/introduction/getting.html#:~:text=Alternatively%2C%20you%20can%20install%20PyVISA%2DPy%20which%20is%20a%20pure%20Python%20implementation%20of%20the%20VISA%20standard.%20You%20can%20install%20it%20using%20pip%3A
https://pyvisa.readthedocs.io/projects/pyvisa-py/en/latest/
-
I think this all revolves around Linux because Windows doesn't install pyvisa. Online documentation keeps referring me to NI which states pyvisa needs NI installed.
Maybe someone who installed this on a Windows machine knows more than the documentation I'm finding.
-
No, it's nothing to do with linux, works on windows too. pyvisa needs a backend. NI is one backend, pyvisa-py is another. Read the pyvisa-py docs and follow them.
This is from scratch on a windows laptop that that's never had pyvisa nor NI installed (and also doesn't have any devices to connect to) but it still gets all the way through to device discovery along with some warnings about optional extra packages you can use for enhanced network discovery:
[attach=1]
-
I didn't know about PowerShell (nor have I used it until recently).
I followed your screen shot (much appreciated), and believe everything with according to your steps. Once the steps were completed, I tried running visashot, visashot -h, etc.. and all I kept seeing was a DOS window opening and closing.
Sorry for the questions, but I have limited experience with scripts and stuff, so not sure what needs to be done at this point.
-
I ran it from a Command window and it didn't open/close like it does when I double click the py file, but I'm lost. I referenced the -h file along with going to the website in the help file, and tried formatting the command to take information from the serial and usb.
Below are the steps I took and just don't understand how this needs to be formatted to listen to the incoming data from the analyzer.
C:\Users\user58\Desktop\New folder>visashot.py -s asrl2 -o c:\test.png
ERROR:Could not access instrument asrl2 using backend 'None': Please install PyS
erial (>=3.0) to use this resource type.
No module named 'serial'
C:\Users\user58\Desktop\New folder>visashot.py -s asrl6 -o c:\test.png
ERROR:Could not access instrument asrl6 using backend 'None': Please install PyS
erial (>=3.0) to use this resource type.
No module named 'serial'
C:\Users\user58\Desktop\New folder>visashot.py -s usb6 -o c:\test.png
WARNING:There is no class defined for (<InterfaceType.unknown: -1>, None). Using
Resource
ERROR:Could not access instrument usb6 using backend 'None': VI_ERROR_INV_RSRC_N
AME (-1073807342): Invalid resource reference specified. Parsing error.
C:\Users\user58\Desktop\New folder>
-
Not a windows user but I can try to continue from the instructions of abeyer:
1) get into the virtual environment:
.\venv\Scripts\activate.ps1
2) pip install PySerial:
python -m pip install PySerial
-
Is it serial I need or USB? This is going from the serial port on the analyzer through the convertor cable and into the USB port (at the time it was port 6) on the laptop.
Am I formatting the commands correctly because I'm somewhat shooting from the hip with trying to figure out the analyzer settings and the command line settings along with trying to figure out what isn't installed correctly.
-
I figured out in order to use the 9-pin serial port to USB, the cable needs to be null modem. After building a null modem cable, I used Putty (9600, N, 8, 1, XON/XOFF), pushed 'copy' on the analyzer, and saw a stream of information indicating it's communicating.
After I played with Visashot and had very little luck. Figured I'd try ChatGPT and it had me install Magick along with adding a path in the Visa.py file. It also had me make changes to four lines (see below). The result was better, but all I got was the analyzer screen remained frozen when I ran the Visashot script, the command seemed to execute (I didn't get any errors as I was before ChatGPT helped), but no image, and, as mentioned, the analyzer screen remained frozen indicating it's not dumping the 'copy' information.
What can I try now?
# model = _get_model(instrument, invert_idn_order)
# if model is None:
# logging.error("Could not find the instrument model")
# return False
model = "8592L"
logging.warning("Forcing model to 8592L for compatibility")
-
I'm at a loss with Visashot.
Today I took the approach of making sure the data from the 8592L was correct by connecting my null modem cable to the serial to USB convertor and opened Putty. The settings were the same: serial, 9600, 8, N, 1, and Xon/Xoff. The analyzer is set to 'plotter' and 9600, however, I don't see any other settings other than selecting serial (or parallel if I wanted to use the parallel port) and then something called LPJ or something like that.
After opening a terminal window in Putty, I pushed 'copy' on the analyzer and saw a long stream of data that I saved as a HPGL file. Then used a third party program to convert the HPGL to a PNG which it did. The screen shot looked perfect (except black and white).
This I assume tells me the analyzer settings are correct, my cable is correct, and the serial to USB convertor is working.
Now when I try to use Visashot, I get errors that I don't understand.
The steps I took to convert raw data to an image is what I assume Vistashot does automatically; except possibly keeps it green.
In any case, I could use help. According to ChatGPT, when 'copy' on the analyzer is pressed, Visashot doesn't get a reply from the analyzer and therefore it doesn't get any data including the analyzer screen remains frozen indicating the internal buffer is full which is what gives me errors.
Maybe I didn't install Pyvisa correctly or did something else wrong - but I followed all the steps for Pyvisa.
I think Visashot is installed correctly because I run the .py file in a CMD window from within the Windows directory it resides in without an issue.
-
LLMs are great for learning about Python and writing/debugging code, but when you try to do more obscure things they often don't hold up very well. If you ask even a high-end reasoning/research model, "How can I use Visashot under Windows to obtain screenshots from my HP 8592L?" you will likely get a bunch of plausibly-hallucinated text. Instructions that probably should work, using tools that probably should exist with options that they probably should support, but don't. Just the nature of the beast.
The important thing is that you have now positively established communications with the 8592L. It may be possible to get 7470.EXE working over your serial cable, if the 8592L supports commands similar to the later analyzers in the 859x series.
I would suggest setting the 8592L to addressable mode (may be called Talk/Listen mode, while you may be in Talk-Only mode now.) Then, go back to PuTTY and send it the command PLOT 550,279,9750,7479; (the semicolon at the end probably isn't necessary but for some reason I used it in 7470.EXE.) When you hit Enter, what happens?
-
Upon using ChatGPT to test, I was blown away, however, as you stated, the more I've used it, the more I've realized it goes in circles. I tried using it as a way of copy/pasting errors in hopes it would shed light rather than bombarding this thread.
Fortunately it helped me establish a working serial cable, and, until it suggested Putty, I hadn't considered looking at incoming data. Currently I use it for certain things and feel guilty coming on here admitting to using it, but feel being honest about were my information came from that led me to this point is better; and it allows people to realize I didn't get to a certain point on my own so they don't talk too high tech.
I would suggest setting the 8592L to addressable mode (may be called Talk/Listen mode, while you may be in Talk-Only mode now.)
Unless I'm overlooking a menu, as mentioned, my analyzer doesn't have much for communication settings nor does it have anything related to talk/listen. In fact, I don't understand why when I select 'plotter' does it still offer comm settings for 'printer'.
In any case, from what I can establish, it seems since the analyzer screen remains frozen, Visashot isn't seeing the incoming data and/or not acknowledging the incoming data; although I'd assume if it saw incoming data that it would get processed but keep the analyzer screen frozen.
When using Putty, either just before or after it finishes receiving data, the analyzer screen isn't frozen indicating the buffer got dumped.
Not fully understanding RS232, my thoughts are maybe the RS232 is working via Putty, but maybe pins are connected or not connected that need to be for Visashot to work correctly.
If I remember correctly, I connected 1-4, 2-3, 3-2, 4-6, 5-5, 6-1, 7-8, 8-7, and 9-9
-
Upon using ChatGPT to test, I was blown away, however, as you stated, the more I've used it, the more I've realized it goes in circles. I tried using it as a way of copy/pasting errors in hopes it would shed light rather than bombarding this thread.
Fortunately it helped me establish a working serial cable, and, until it suggested Putty, I hadn't considered looking at incoming data. Currently I use it for certain things and feel guilty coming on here admitting to using it, but feel being honest about were my information came from that led me to this point is better; and it allows people to realize I didn't get to a certain point on my own so they don't talk too high tech.
I wouldn't worry too much about what other people think of your LLM usage. Some people are not great at understanding and using powerful tools. Some of those people end up on the Internet. Some of them end up on here. And they all have strong, poorly-informed opinions on the subject that they are all too happy to share. Enough said. :)
Unless I'm overlooking a menu, as mentioned, my analyzer doesn't have much for communication settings nor does it have anything related to talk/listen. In fact, I don't understand why when I select 'plotter' does it still offer comm settings for 'printer'.
Yes, talk/listen nomenclature is normally associated with GPIB rather than serial comms, but it can still come into play. If there are no menu settings that sound similar to that, it's not a concern.
In any case, from what I can establish, it seems since the analyzer screen remains frozen, Visashot isn't seeing the incoming data and/or not acknowledging the incoming data; although I'd assume if it saw incoming data that it would get processed but keep the analyzer screen frozen. When using Putty, either just before or after it finishes receiving data, the analyzer screen isn't frozen indicating the buffer got dumped. Not fully understanding RS232, my thoughts are maybe the RS232 is working via Putty, but maybe pins are connected or not connected that need to be for Visashot to work correctly. If I remember correctly, I connected 1-4, 2-3, 3-2, 4-6, 5-5, 6-1, 7-8, 8-7, and 9-9
Your connections are fine, and so is Putty. Putty is just a terminal program that receives text from the serial port, displays it, and sends any characters you type back to the port.
However, if the analyzer can only use its serial port for one-way communication with a plotter or printer, that rules out its use with Visashot. Visashot expects to send the analyzer a request for a plot dump, which is inherently a two-way conversation. 7470.EXE can wait for the plot to be sent from the instrument, as well as actively request them. I'm curious to see if your 8592L can response to the command I mentioned. If it can, then perhaps Visashot can be modified to send that command. If it can't, then 7470.EXE is your only hope for (easily) receiving plots.
-
I'll try the program you suggested.
ChatGPT suggested sending certain commands from Putty to see how the analyzer responds and in all cases the analyzer never replied - not to say ChatGPT knew what it was talking about.
Seeing how the data was received in Putty, I assume Visashot was just waiting for incoming data too, so I wasn't sure if the analyzer not accepting requests was an issue.
-
I'll try the program you suggested.
Try the command I suggested first. Just type it into Putty and hit Enter.
-
Looks like nothing happened.
The data before (see attached) is the stream from pushing ‘copy’ on the analyzer; wanted to make sure it was communicating correctly.
Attached is a screen shot and the wiring diagram for the null modem adapter I made.
-
Sounds like the 8592L doesn't do anything but send data through the serial port, unless the manual says otherwise (not personally familiar with it, myself.)
Some other options are to save the text received by Putty and send it to an HP-GL/2 plotting program, or write your own Python script to do the same. That's one thing that ChatGPT and similar resources can help you with... although l've been using either Claude or Gemini for programming-related stuff lately, as the decent OpenAI models are painfully slow.
If you install the GPIB Toolkit, you could try using the 'Edit CONNECT.INI' option in the GPIB configurator program to change the interface_settings line to com<your COM port #>:baud=9600 parity=N data=8 stop=1 and is_Prologix to 0. After saving the file, run the 7470 plotter emulator and hit the 'w' key, then press 'copy' on the analyzer. Good chance that will also work.
-
After years of doing this via VB6 and other apps I ended up grabbing screen data from my test gear via MS Excel as in the screenshot below. I just select the instrument via the tab along the bottom of the spreadsheet and then hit the get screen button. It copies it to the clipboard and it can be pasted as a picture into Word and it also gets saved as a file. All the instruments are connected via GPIB except the Tek MSO4104 which connects via USB.
I'm not too keen on installing the ImageMagick SW but I could try testing your Python script on some of the instruments in the Excel tabs?
For example, you have the E4440A PSA as untested, also the E4406A and the 54540C scope and I have these included in my Excel spreadsheet below.
-
If you want the IDNs from the instruments in the excel tabs I can send them to you (with the SN set to zero on the LSDs) along with some screenshots.
Can I test your Python script on these newer instruments without needing ImageMagick? I'd rather not install it on this PC or the little EeePC.
-
'm not too keen on installing the ImageMagick SW but I could try testing your Python script on some of the instruments in the Excel tabs?
I'm not keen either on installing such software. Not necessarily because it's another piece of software, but because I want to avoid depending on software that may go obsolete and not run on future operating systems.
A VB script is a simpler solution, but also is dependent on others using MS Office versus some who use Linux and/or someone such as myself who has an outdated version of Excel that may not work with such a script.
Extracting data from the (in my case) analyzer is less confusing to me after tinkering with this for so long. Unless I'm wrong, the data is simple to get. The biggest challenge is converting the data to an image. As ChatGPT had me (successfully) do: save the data string as an HPGL and use third party software to convert it.
My opinion this was a long process. It provided a solution, but it's not practical for capturing several images.
I think ChatGPT is capable of producing a script that will capture the incoming data string and then save it as an HPGL which reduces steps by a human.
My question is: how much work to convert the data to a PNG or some other image without third party software; or some piece of software that's and can always run on an OS?
-
After years of doing this via VB6 and other apps I ended up grabbing screen data from my test gear via MS Excel as in the screenshot below. I just select the instrument via the tab along the bottom of the spreadsheet and then hit the get screen button. It copies it to the clipboard and it can be pasted as a picture into Word and it also gets saved as a file. All the instruments are connected via GPIB except the Tek MSO4104 which connects via USB.
That's pretty slick! Is it online anywhere? I'll add a link to my 'Third-party software' section if so.
-
Hi KE5FX. It's not online anywhere as it really isn't very portable. It is configured to work for my instruments and the two PCs I use and it really is very fussy about changes. It took me a while to get it to work on both PCs and with both GPIB to USB adaptors I have here.
In my case it was worth the effort as I use it to grab screenshots to the clipboard (and to a file if required) and this is great for rapidly putting them into a Word document. Before I had this, there was always that mental barrier of having to use different tools for each piece of test gear. Also the SW tool might not be able to directly copy to the clipboard.
Here's a quick Youtube demo across seven instruments. It's a hot day here today and my workroom quickly became really hot with all this test gear on at once :)
It is also possible to configure it to dump multiple screen grabs from the same instrument into Excel. It then overlays the images in a neat pile within Excel with a slight offset between them. So (say) ten grabs could be made in a few seconds and the ten images could be saved or processed later.
https://www.youtube.com/watch?v=aLc3WmbWWi8 (https://www.youtube.com/watch?v=aLc3WmbWWi8)
-
ImageMagick has been around "for eons". Less hassle than our friends at M$. So, do not assume problems when there are unlikely to be any :-//
-
I've been working with ChatGPT on creating a script to capture the analyzer screen data.
Either this is a difficult process or ChatGPT is having difficulty. It kept giving code to me over the last three-days that seemed to abort before all the data was captured. It seems to think Xon/Xoff stuff was messing up things and kept tweaking. It wasn't until tonight when I informed it that using Putty, from the time I press 'copy' on the analyzer to when the data finishes being captured is about seventeen-seconds. It then placed a twenty-two second (per my suggestion) time out which seemed to have solved the capturing issues.
Currently I have something that seems to work, however, I haven't done any extensive tests other than a few successful captures. It still needs some tweaking because it's quite basic and needs the code edited to fluff it a bit.
In any case, Ghostscript seemed to be the suggested software to convert the hpgl file, but I'm getting an issue with the "auto" convert from hpgl > ps > PDF, so I'm using an online convertor to go from hpgl to PDF and also hpgl to PNG. I think the error is in the code and not pointing to the correct directory, but this is a minor issue that I haven't bothered to address.
The more serious issue that seems to be occurring is some text is being translated wrong (see attached hpgl file).
I haven't figured out which single or multiple characters are causing issues. Maybe it's the online convertors I'm (temporarily) using that can't convert the data correctly or maybe it's the data stream.
I'd appreciate any feedback on this issue and how to possibly resolve it.
-
Almost no generic .hpgl renderers are worth messing with when it comes to rendering plots from test equipment. Your data stream seems OK, in that 7470.EXE can render it without any trouble:
(https://i.imgur.com/x4Vq13K.png)
This isn't because 7470.EXE is so great, or because the other renderers are so terrible, but because so many instruments don't actually conform to the published specs for HP-GL/2. Many of them generate output with various quirks and bugs that the original HP 7470-series plotters shrugged off, but that anyone writing an emulator would have no reason to anticipate.
Whenever I run into one of those "quirks", I add a hack to work around it... and believe me, at this point there are a LOT of hacks.
For an automated HPGL->PDF pipeline, ImageMagick is almost certainly a better bet, just going by how well it works with the Visashot package. I would stick to that, for what you're doing.
(As for ChatGPT, naturally it's not a mind-reader, and it isn't sitting there beside you, so it doesn't know how long the timeout intervals need to be unless you tell it. These tools are incredibly powerful but "vibe coding" only gets you so far.)
-
That looks great; I really like the white with blue line. It's better than the green which I thought was good - maybe because it mimicked the actual screen; and better than just having all one color.
Thanks for converting that (I haven't quite figured out that 7470 program - seems like it installs a bunch of other programs). In any case, my focus has been to capture the data and then work on a simple conversion later. I'm sure Imagemagick is better, and whether I've used others in the past and will continue, as stated above, my current focus is just getting a working capture script, but I plan to use Imagemagick since it's been highly recommended.
The current script opens a window similar to a CMD window (or maybe it is) with a small pop up window that you click when you're ready to start the capture. The comm port is pre-selected in code (I change it if need be), and then converts the hpgl to ps and then to PDF (which currently fails).
My vision is: open the script, select the comm port, press the capture button, push copy on the analyzer, it captures the data, converts it, and either deletes the hpgl and ps files or moves them to another directly. Although, seems as if I use Imagemagick, I won't need a ps file, so maybe move the final PNG file to a sub-directory.
-
That looks great; I really like the white with blue line. It's better than the green which I thought was good - maybe because it mimicked the actual screen; and better than just having all one color.
Thanks for converting that (I haven't quite figured out that 7470 program - seems like it installs a bunch of other programs).
7470.EXE doesn't install anything else, but it is one of several programs whose shortcuts are all (unfortunately) dumped on the desktop by the install program. In retrospect I wish I hadn't done that, but it doesn't bug me enough personally to fix it. >:D
You can force 7470.EXE to write a .PDF by setting up a .PDF writer as your system's default printer but whether that is more or less trouble than what you're doing now, I couldn't say.
In any case, my focus has been to capture the data and then work on a simple conversion later. I'm sure Imagemagick is better, and whether I've used others in the past and will continue, as stated above, my current focus is just getting a working capture script, but I plan to use Imagemagick since it's been highly recommended.
The current script opens a window similar to a CMD window (or maybe it is) with a small pop up window that you click when you're ready to start the capture. The comm port is pre-selected in code (I change it if need be), and then converts the hpgl to ps and then to PDF (which currently fails).
My vision is: open the script, select the comm port, press the capture button, push copy on the analyzer, it captures the data, converts it, and either deletes the hpgl and ps files or moves them to another directly. Although, seems as if I use Imagemagick, I won't need a ps file, so maybe move the final PNG file to a sub-directory.
Yeah, I'd focus on swapping out Ghostscript for ImageMagic, assuming you can get it to render the .hpgl file well. Being a plotter emulator, the color choices are generally easy to change in these programs. ChatGPT is probably reasonably conversant with ImageMagick, since as wkb and others have pointed out, it has been around a while.
Edit: seems ImageMagick doesn't accept HPGL or render to .PDFs directly, so... :-//
-
Edit: seems ImageMagick doesn't accept HPGL or render to .PDFs directly, so...
I didn't realize a new message was posted, so I'm just getting this.
Ironically I was just researching ImageMagick to see which commands to use for converting HPGL to an image.
At the moment I'll have to tinker with which options are best because 7470 is great, but I think it's GUI based whereas I need a command line method for quick converting. Ideally after the data is received, I'd like to have it converted automatically and either open for immediate viewing, or at least be in a directory to open/view.
-
I wrote some code many years ago which properly renders the input data to the old HP vector displays as SVG.
Here is a sample output from HP8568B:
https://phk.freebsd.dk/_images/spec_6731.svg
Because the SVG is vector based, you can scale however you want.
Feel free to steal whatever code you can use from:
https://github.com/bsdphk/pylt
and
https://phk.freebsd.dk/hacks/Wargames/
-
Thanks for the code.
After several hours with ChatGPT, I've managed to accomplish little.
My plan was to make the most simple GUI with the most basic add-ons/libraries that captures the incoming data stream as an HPGL, converts it to a post script (a necessary step according to ChatGPT), and then converts it to PNG (or PDF).
The GUI is nice, but after two-days and about ten-hours, I realized it's nothing more than Putty. Today I was informed by ChatGPT that the post script file(s) aren't correct and it's why the PDF comes out blank. Until now, I was ignoring that issue because I was trying to perfect the GUI and thought adding the necessary code to do the conversion was simple. Thought I have the HPGL data/file, it's converting it to PS, and then all I need is to add on converting from PS to PNG or PDF.
Today I tried having it create a script to auto run 7470.exe because I like the color scheme (white background and blue lines). It told me a script to auto run the 7470 was easy, but after two-hours of it sending me in circles, I gave up.
Eventually it told me it could create a script to convert HPGL to post script without needing anything else except Python code, that was about two-hours wasted because it got close, but all I'd get was the screen (no text) the size of a quarter.
The GUI saves the step in Putty of setting up the comm port, capturing the data, saving it as an HPGL, etc... but it still requires manual time consuming labor to convert it in 7470. Ideally I want to capture the data, bing bang, and I have a nice PNG of the screen.
The other thing I was confused at towards the end of my ChatGPT go around in circles chat was that I thought 7470 can create a PNG from an HPGL. Unless I'm doing something wrong, you have to select 'all files' to see an HPGL file, and then you can only save it as a BMP, GIF, etc... Once you close 7470 or try opening another HPGL file, you have to select 'all files' again.
This is the part ChatGPT was struggling with because sometimes 7470 would pop a window asking to add text and throw errors in the script.
I got burnt out and gave up for now, but ideally if I could get 7470 to auto run somehow, then I think it would be pretty cool.
-
Yep, it will save .GIF/.PCX/.BMP/.TGA files, but not .PNG. For these types of plots, there is no reason to use .PNG. They don't need to go beyond 8-bit color, and 8-bit .GIFs actually tend to be a bit smaller than .PNGs.
I wouldn't expect LLMs to know a whole lot about 7470.EXE, as it's much more obscure than the other general-purpose vector graphics renderers. You'd almost be better off feeding the .cpp files to a large-context model and asking it to translate it all to Python. :)
I haven't tested it in a million years, but at one point the auto_print_mode option in 7470.INI would do what you're talking about. You would set up your default printer to write .PDF files (or .PS, I suppose.)
-
I agree that GIF or BMP is probably just as good.
The screen shot in a previous post was a PNG, so I was under the assumption 7470 went from HPGL to PNG - it really doesn't matter to me. I tend to like final screen shots to be PDF, but an image is just as good.
I should check the HPGL file that was obtained from my script in 7470 to make sure it's correct before continuing. For what it's worth, I probably never used my analyzer since obtaining it several years ago, so being able to print from it really is just the challenge at this point.
Also, I thought implementing Visashot was a simple task, but, as we discovered, apparently it doesn't support my analyzer.
Worse case I can manually use 7470, but that wouldn't be fun; and it would be time consuming.
You bring up an interesting subject and not sure whether you were serious. I didn't see an .ini file, but I see C code for 7470. Maybe ChatGPT can use that to implement the conversion.
Maybe I can spend thirty or forty hours letting ChatGPT send me in circles.
-
Claude (particularly Claude Code) and github Copilot Pro are both much better options for writing software than ChatGPT right now, from everything I've seen. Also, once you start going in circles you should just stop... they are all pretty bad about not being able to right themselves once that happens. You need to take a step back then and reset something or it will usually just continue. That could be just switching models, or feeding the output of one to another, or write some code or pseudocode yourself that sketches out something that it's doing wrong and ask it to flesh out the details, or even just start a new session and rewrite your prompt different from the start. If you don't do something though, and just keep repeating what's not working, you're wasting your time (not to mention tokens, if you're paying for usage.)
I'm still not certain you couldn't get visashot working... but not sure what's wrong there either. I poked at the docs on hparchive for a minute and it sounded like that model should from what I saw.
-
Claude (particularly Claude Code) and github Copilot Pro are both much better options for writing software than ChatGPT right now,
I'll have to keep this in mind and possibly try it too.
Also, once you start going in circles you should just stop... they are all pretty bad about not being able to right themselves once that happens.
You couldn't have said it any better. My first request was asking for a GUI that had several features. The GUI it initially made was great, great color scheme, etc... and just about the entire layout was done without any direction.
I told it the GUI was great, now let's just move something here, or change this to that. It decided to strip everything in the GUI in order to implement a change. I'd tell it to add the stuff it previously had, suddenly it's placing things where they don't belong, text doesn't fit within the GUI, the GUI wouldn't load, etc... Once the GUI didn't load, that's when it really went downhill because suddenly it's focused on installing libraries rather than realizing: the GUI worked before I made this change.
I began telling it immediately that here is the code that I liked and works, but had flaws, let's call this Rev 1. As time went on, I'd say, no, give me the GUI you had in Rev 1.
In any case, you could be correct about Visashot working with my analyzer, but I found myself confused over the command line since I'm not Linux savvy which may have contributed to it not working. My experience was that I tried all the commands and got results I didn't understand and even resorted to ChatGPT by letting it read the help file and directing me. One argument I had with ChatGPT is it kept telling me to install NI, and I kept arguing that Pyvisa is all that's needed.
Seeing the data stream in Putty gave me the idea to let ChatGPT create a simple GUI to act like Putty. It detects available comm ports, you select which one, push capture data, etc... The initial issue was timing. From what I calculated, at 9600 baud it takes 17s from the time 'copy' is pushed on the analyzer to when the data finishes. This took a bit to work into the code, but the GUI works almost flawlessly now.
As stated though, after several days, all I've done is reinvented the wheel because I have a simple version of Putty without the ability to convert HPGL to something usable.
-
One argument I had with ChatGPT is it kept telling me to install NI, and I kept arguing that Pyvisa is all that's needed.
I still don't understand that myself. How PyVisa is supposed to communicate with an NI488.2-compatible interface if you didn't install the manufacturer's low-level kernel driver package for that specific interface, I have no earthly clue.
People on here are swearing that it works, though, so... :-//
-
I still don't understand that myself. How PyVisa is supposed to communicate with an NI488.2-compatible interface if you didn't install the manufacturer's low-level kernel driver package for that specific interface, I have no earthly clue.
If you need a kernel driver then you need a kernel driver... but that's generally only true if you have a pci/isa gpib card in your machine. Many cases (I'd say most cases in modern use) you're not using gpib hardware directly in the host machine, but over an adapter to serial, usb, ethernet, etc... In that case you don't need a driver, only an implementation of the protocol on top of the the low-level driver for whatever hardware bus you're communicating on.
-
I still don't understand that myself. How PyVisa is supposed to communicate with an NI488.2-compatible interface if you didn't install the manufacturer's low-level kernel driver package for that specific interface, I have no earthly clue.
If you need a kernel driver then you need a kernel driver... but that's generally only true if you have a pci/isa gpib card in your machine. Many cases (I'd say most cases in modern use) you're not using gpib hardware directly in the host machine, but over an adapter to serial, usb, ethernet, etc... In that case you don't need a driver, only an implementation of the protocol on top of the the low-level driver for whatever hardware bus you're communicating on.
That's the problem, though. Going with the USB example, under Windows, you need a manufacturer-specific USB driver for an NI GPIB-USB-HS adapter. Even though the GPIB-USB-HS uses a bog-standard FX2LP USB device controller, it does not support any predefined USB device classes, and it will enumerate with a VID and PID that Windows has no idea what to do with. A given system might have multiple copies of cyusb.sys sitting around, but the OS won't know to assign it to the adapter if you don't install the NI driver package.
Maybe things are different in Linux, but in Windows there is basically no way that pyvisa is going to talk to an NI PCI or USB adapter without either installing some sort of OEM driver or doing some fancy Zadig-style footwork to assign a generic FX2LP driver to that VID/PID and self-sign it.
If there's a tractable way to do that, neither ChatGPT nor an extremely-experienced USB device developer (your humble narrator) is aware of it.
-
Unfortunately I don't have input because I thought Visaprint was Windows based; or able to run on Windows with ease.
After following directions on installing libraries through Powershell and still not getting it to work, the conclusion was this is deeper than just double clicking a script because I don't know Linux command lines well.
I checked the HPGL data from my GUI script (see attached) using 7470 and it's apparent that the incoming data is good. As mentioned, the script also converts the HPGL > post script > PDF, but the PDF was always blank. Some was due to the script not having the correct path, but, from my understanding, the PS file doesn't contain the correct information.
Currently I need the extra step of going from HPGL to an image file (JPG, BMP, etc..) or PDF as easy.
Seems 7470 can be somewhat automated with a script, but I've noticed sometimes it opens a window to add caption text and sometimes it doesn't. Also, the file drop down menu doesn't include HPGL, so 'all files' need to be selected. This confuses the script, so I haven't been able to automate it this way either.
I thought ChatGPT could create a script to mimic the HPGL data and draw something it can convert to an image file, but that proved to be about two-hours wasted.
-
Maybe things are different in Linux, but in Windows there is basically no way that pyvisa is going to talk to an NI PCI or USB adapter without either installing some sort of OEM driver or doing some fancy Zadig-style footwork to assign a generic FX2LP driver to that VID/PID and self-sign it.
My understanding is the python usb stack uses libusb and winusb to communicate from userspace. I don't think you even need zadig anymore, though it will work. You can use winusb.sys as the driver (signed by MS) and might need to manually load it or provide an INF to force it by vid/pid, if the device doesn't natively allow it. That's about the limit of what I know, as it's always just worked for me with my hardware, and never needed to dive deeper. There may well be something special about the GPIB-USB-HS that prevents that approach from working, but don't own one so can't really say. pyvisa-py is pretty clear that they don't support every possible config, and they document pretty well what you need to do to configure it for what it does support.
-
First of all thanks very much for sharing this great tool!
I tried it for the first time with my HP8591E spectrum analyzer and it almost works. The image consists of only one pixel line with a border (the pixels are in the right color). So something must be working.
Any idea what I might be doing wrong?
visashot.py -I -s "TCPIP::10.0.0.150::gpib1,18::INSTR" -o hp8591E-screen.png
I'm using pyvisa on macOS. Here is the image I get:
(https://www.eevblog.com/forum/testgear/visashot-a-python-script-for-capturing-screenshots-from-vintage-instruments/?action=dlattach;attach=2707615;image)
Here is the debug output of when doing the same as above with the -g option:
DEBUG:Using default backend
DEBUG:No visa library specified, trying to find alternatives.
DEBUG:Environment variable PYVISA_LIBRARY is unset.
DEBUG:Not loading dll_extra_paths because we are not on Windows or Python < 3.8
DEBUG:Automatically found library files: [None, None, None, None, None]
DEBUG:No user defined library files
DEBUG:Did not find IVI binary
DEBUG:SerialSession was not imported No module named 'serial'.
DEBUG:USBSession and USBRawSession were not imported No module named 'usb'.
DEBUG:TCPIPSession was correctly imported.
DEBUG:GPIBSession was not imported No module named 'gpib'.
DEBUG:pyvisa-py is available.
DEBUG:Created library wrapper for py
DEBUG:Created ResourceManager with session 7220906
DEBUG:PyVISA ressource manager started
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - opening ...
DEBUG:RawTCPClient: connecting to socket at (10.0.0.150, 111)
DEBUG:Make call <PortMapperVersion.get_port: 3>, (395183, 1, 6, 0), <bound method PortMapperPacker.pack_mapping of <pyvisa_py.protocols.rpc.PortMapperPacker object at 0x1051054c0>>, <bound method Unpacker.unpack_uint of <pyvisa_py.protocols.rpc.PortMapperUnpacker object at 0x1051055b0>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61111), raddr=('10.0.0.150', 111)>: b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x86\xa0\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00'
DEBUG:RawTCPClient: procedure type 3
DEBUG:Start receiving at least 1 packages
DEBUG:received b'\x80\x00\x00\x1c'
DEBUG:received b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#2'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61111), raddr=('10.0.0.150', 111)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#2')
DEBUG:RawTCPClient: closing socket
DEBUG:RawTCPClient: connecting to socket at (10.0.0.150, 9010)
DEBUG:Make call 10, (274522546, 0, 10000, 'gpib1,18'), <bound method Vxi11Packer.pack_create_link_parms of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_create_link_resp of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b"\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\\\xe1\xb2\x00\x00\x00\x00\x00\x00'\x10\x00\x00\x00\x08gpib1,18"
DEBUG:RawTCPClient: procedure type 10
DEBUG:received b'\x80\x00\x00('
DEBUG:received b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc')
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - is open with session 2584994
DEBUG:PyVISA instrument initialized
DEBUG:Platform is Darwin
DEBUG:Using 'magick' as ImageMagick convert utility
DEBUG:Make call 11, (0, 2000, 10000, 8, b'ID?\r\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b"\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x08\x00\x00\x00\x05ID?\r\n\x00\x00\x00"
DEBUG:RawTCPClient: procedure type 11
DEBUG:received b'\x80\x00\x00 '
DEBUG:received b'\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05')
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
DEBUG:Make call 12, (0, 252, 2000, 10000, 0, 0), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b"\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x00\x00\x00\x00\x00"
DEBUG:RawTCPClient: procedure type 12
DEBUG:received b'\x80\x00\x000'
DEBUG:received b'\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\tHP8591E\r\n\x00\x00\x00'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\tHP8591E\r\n\x00\x00\x00')
DEBUG:Instrument ID string using 'ID?' : HP8591E
DEBUG:Instrument model: 8591E
DEBUG:Timeout automatically set to 25000 ms
DEBUG:Reading buffer...
DEBUG:Using PRINT...
DEBUG:Make call 11, (0, 25000, 10000, 8, b'PRINT\r\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b"\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00a\xa8\x00\x00'\x10\x00\x00\x00\x08\x00\x00\x00\x07PRINT\r\n\x00"
DEBUG:RawTCPClient: procedure type 11
DEBUG:received b'\x80\x00\x00 '
DEBUG:received b'\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07')
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
DEBUG:Make call 12, (0, 252, 25000, 10000, 0, 0), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b"\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00a\xa8\x00\x00'\x10\x00\x00\x00\x00\x00\x00\x00\x00"
DEBUG:RawTCPClient: procedure type 12
DEBUG:received b'\x80\x00\x01$'
DEBUG:received b'\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x01\x00\x1b*r1U\x1b*rA\x1b*b64W\x00teway v1.1 (AR488 v0.53.03)\n\x00_\x9b\xfeB\xbbe\xbfm\xe6\xe9G\xcc\xd7\xe5\xdd\xed\xb5\xdf\xaa\xbd\xfao\x99\xdb\xf9\xc7\xbf\x8d\x9e\xcd\xd5\xdf\xcf\xff\x9f\xef\x8c\xf0\xd3\xcb\xa1\xf6\xffr\xb7\xffV\xbe\xb9\x94\xef\xd8\xee\xfa\xdc\xa8w\xc7\xff\xce\xca\xc9\xeb~\xfe\x1d\xfc\x7f\xfe\xfb\xc8\xf4\xed\xfd\xff\xf7\xbe\x8e\xde\xee\xba/\xfbYx\x83u\xf1\xcf\xea\n\xfa\xef\xf7\xeb\xfb_\xf6+\xfd\xfb\xf7z\xf3\xffG\xef\xea\xfd>,},},}4X\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x01\x00\x1b*r1U\x1b*rA\x1b*b64W\x00teway v1.1 (AR488 v0.53.03)\n\x00_\x9b\xfeB\xbbe\xbfm\xe6\xe9G\xcc\xd7\xe5\xdd\xed\xb5\xdf\xaa\xbd\xfao\x99\xdb\xf9\xc7\xbf\x8d\x9e\xcd\xd5\xdf\xcf\xff\x9f\xef\x8c\xf0\xd3\xcb\xa1\xf6\xffr\xb7\xffV\xbe\xb9\x94\xef\xd8\xee\xfa\xdc\xa8w\xc7\xff\xce\xca\xc9\xeb~\xfe\x1d\xfc\x7f\xfe\xfb\xc8\xf4\xed\xfd\xff\xf7\xbe\x8e\xde\xee\xba/\xfbYx\x83u\xf1\xcf\xea\n\xfa\xef\xf7\xeb\xfb_\xf6+\xfd\xfb\xf7z\xf3\xffG\xef\xea\xfd>,},},}4X\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
DEBUG:Captured buffer: 256 bytes in 5570 ms (413 bds, 0 kbps)
DEBUG:Using PCL buffer processing
DEBUG:Temporary PGM file: /private/var/folders/d0/jjgxp7pd0hl63wtszdp0wpfr0000gq/T/capture_hpib.pbm
DEBUG:Saving PCL buffer to buffer_debug.pcl...
DEBUG:Monochrome PCL detected
DEBUG:End of header reached
DEBUG:Image width calculated: 512
DEBUG:PCL buffer processed. Image size: 512 x 1
DEBUG:Saving to PGM/PPM '/private/var/folders/d0/jjgxp7pd0hl63wtszdp0wpfr0000gq/T/capture_hpib.pbm'
DEBUG:Buffer saved to temporary PGM file
DEBUG:Converting image format...
DEBUG:ImageMagick command: 'magick /private/var/folders/d0/jjgxp7pd0hl63wtszdp0wpfr0000gq/T/capture_hpib.pbm hp8591E-screen.png'
DEBUG:Setting foreground and background colors
DEBUG:ImageMagick command: 'magick hp8591E-screen.png -depth 1 -monochrome -colors 2 -type bilevel -define colorspace:auto-grayscale=false -colorspace RGB -channel rgba -fuzz 0% -fill #22FF22 -opaque #000000 -fill #000000 -opaque #FFFFFF -define png:color-type=6 hp8591E-screen.png'
DEBUG:ImageMagick command: 'magick hp8591E-screen.png -format "%[hex:u.p{0,0}]" info:'
DEBUG:ImageMagick magick output: "000000FF"
DEBUG:Autodetected corner / background color: "#000000FF"
DEBUG:Adding margins (4 pixels)
DEBUG:ImageMagick command: 'magick -background transparent -bordercolor #000000FF hp8591E-screen.png -compose Copy -border 4 hp8591E-screen.png'
DEBUG:Done with ImageMagick processing
DEBUG:Capture completed, success = True
DEBUG:Closing ResourceManager (session: 7220906)
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - closing
DEBUG:Make call 23, 0, <bound method Vxi11Packer.pack_device_link of <pyvisa_py.protocols.vxi11.Vxi11Packer object at 0x10501fd90>>, <bound method Vxi11Unpacker.unpack_device_error of <pyvisa_py.protocols.vxi11.Vxi11Unpacker object at 0x105105400>>
DEBUG:Sending record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: b'\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG:RawTCPClient: procedure type 23
DEBUG:received b'\x80\x00\x00\x1c'
DEBUG:received b'\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG:Received record through <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.2', 61112), raddr=('10.0.0.150', 9010)>: bytearray(b'\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
DEBUG:RawTCPClient: closing socket
DEBUG:TCPIP0::10.0.0.150::gpib1,18::INSTR - is closed
DEBUG:Done
Did anyone successfully use visashot with a 8590xE spectrum analyzer?
-
Some additional observations:
1) The 8591E is an older unit, the firmware version of is 940822
2) apparently the :IDN? command doesn't work, that's why I used the -I switch
3) When I use visashot, the unit crashes. The crash is profound, the front panel freezes, no key works (though the trace keeps being updated) and not even a PRESET helps. I have to power cycle the unit to get it back to work.
Edit: Doesn't crash, the unit is just in remote control mode. Pressing "Config" gets local button control back.
Edit 2:
If I use pyvisa-shell to "emulate" visashot and do this:
(open) write PRINT
(open) read
VI_ERROR_IO (-1073807298): Could not perform operation because of I/O error.
the display on the SA freezes after "write PRINT". I then wait 10 seconds and do "READ", the error message is returned and the SA unfreezes.
Not sure if the error comes from pyvisa or from the unit.
-
visashot works fine on my HP8594E. Sample screenshots of my SA are on https://damien.douxchamps.net/elec/visashot/ (albeit mislabeled slightly: 94A should be 94E)
Your observation that -I must be used is correct btw.
Not sure what causes your issues though..
-
Looks like the instrument starts sending the screenshot data, but then the transfer fails.
DEBUG:Captured buffer: 256 bytes in 5570 ms (413 bds, 0 kbps)
Hmm, 256 bytes eh.
Some lan-gpib interfaces have trouble with larger transfers. What are you using?
-
Thank you, that's very good to know! What firmware version is your unit on? I found out that the one I have isn't that old after all, so that may not be the problem.
Experimenting with the visashot.py source, I tried different values of pause_s in _read_buffer() with no change in the output. The default timeout settings (25s) appear adequate, too, there's no timeout happening.
I dumped the PCL file which is the same every time, much too small at 256 bytes. The generated image also doesn't resemble one single pixel line on the display (there's simply no line that matches), but it isn't not random either. Maybe that is really an error message that is interpreted as pixel data. Just guessing, though.
I think the next step would be starting to debug what instr.read_raw() does, which is in pyvisa and I'm not up to that at this point.
Looks like the instrument starts sending the screenshot data, but then the transfer fails.
Some lan-gpib interfaces have trouble with larger transfers. What are you using?
Yes, I also think it's a communications issue. I'm using Kofen/Kofotronics's GPIB/Lan adapter. Which is plugged into the 8591E with no other device on the bus.
Edit: Hmm, I was looking for the string "teway v1.1 (AR488 v0.53.03)" that appears in the PCL dump that that seems to come from the GPIB adapter. That's strange.
-
Looks like the interface is messing up. I have Keysight USB-GPIB interface in use here.
Firmware is 980615 on the HP8594E. There is one later version, which replaces the HP logo with a Agilent one if I remember correctly. I can live with that.. :-//
-
I'm using Kofen/Kofotronics's GPIB/Lan adapter.
That has a known firmware issue with long reads, there should be a new fw release in the coming days.
https://github.com/Kofen/PoE_Ethernet_GPIB_Adapter/issues/7
-
I'm using Kofen/Kofotronics's GPIB/Lan adapter.
That has a known firmware issue with long reads, there should be a new fw release in the coming days.
https://github.com/Kofen/PoE_Ethernet_GPIB_Adapter/issues/7
Thanks for the pointer, that's excellent news.
-
Edit: I moved this off topic question to https://www.eevblog.com/forum/projects/poe-ethernet-gpib-adapter-open-source-project-now-public/msg6121717/#msg6121717 (https://www.eevblog.com/forum/projects/poe-ethernet-gpib-adapter-open-source-project-now-public/msg6121717/#msg6121717)
I'm using Kofen/Kofotronics's GPIB/Lan adapter.
That has a known firmware issue with long reads, there should be a new fw release in the coming days.
https://github.com/Kofen/PoE_Ethernet_GPIB_Adapter/issues/7 (https://github.com/Kofen/PoE_Ethernet_GPIB_Adapter/issues/7)
So I tried to build my own version using the current source on github but that doesn't work at all. While it builds OK and also flashes to the GPIB Adaptor using avrdude, seemingly it does something completely different and visashot can't even execute a ID? command to the unit and aborts.
I also got a firmware from Magnus dated mid October which apparently doesn't incorporate the large-answer changes yet (that happened 3 weeks ago according to the github logs).
Do you know, is there something special needed in order to build the firmware? I used platformio-cli and it appeared to work fine.
-
I've added support for
- Tektronix TDS 7xx (should probably work with most/all 4xx, 5xx, 6xx, 7xx scopes too)
- HP 4195A (hopefully also 4194, not tested)
I've also refactored the code into 'device classes' to make such additions hopefully easier. As a side project along that, I also implemented a basic testsuite (currently only tests ID string recognition, but that was one core issue for hp 4195)
I don't intend to take over damien's project but hoping he will eventually have time to look at the refactor and we can merge everything back to one repo. In the meantime I'm happy for any comments from testers or reviewers. Code is the 'reb3' branch at https://sourceforge.net/u/fenugrec/visashot/ci/reb3/tree/
Due to the extent of the rework, it's likely I have accidentally broken some devices that I'm unable to test, but those should be trivial fixes.
-
I've continued work on my fork, and added
- annotation : some devices (tek TDS *, hp 4195, E44** spectrum analyzers, probably others?) can display a short comment / annotation on the plot, which is super useful. See attached screenshots (disregard the awful colors on the hp4195 plot, I fixed that already : )
- loop mode : visashot can be set to wait on a prompt for a graph title and file name, take screenshot then continue waiting. I found that more convenient than tweaking a CLI invocation every time. See animated GIF below for an example (different software, same functionality)
- WIP : 'return to local' functionality, currently only enabled on hp4195 where it was the most annoying to me : after a screenshot, the 4195 now returns to local mode. This is tricky to do in a way that works on different interface types; only tested with a 82357B .
- expanded testsuite : nobody cares but it should make it harder to accidentally break things during development !