Author Topic: Visashot, a python script for capturing screenshots from vintage instruments  (Read 28435 times)

0 Members and 5 Guests are viewing this topic.

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2845
  • Country: us
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.
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2651
  • Country: us
    • KE5FX.COM
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.)
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2845
  • Country: us
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.
 

Offline abeyer

  • Frequent Contributor
  • **
  • Posts: 952
  • Country: us
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.
« Last Edit: July 07, 2025, 02:58:57 am by abeyer »
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2845
  • Country: us
Quote
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.

Quote
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.
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2651
  • Country: us
    • KE5FX.COM
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...  :-//
 

Offline abeyer

  • Frequent Contributor
  • **
  • Posts: 952
  • Country: us
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.
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2651
  • Country: us
    • KE5FX.COM
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.
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2845
  • Country: us
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.

 

Offline abeyer

  • Frequent Contributor
  • **
  • Posts: 952
  • Country: us
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.
 

Offline hp3310a

  • Frequent Contributor
  • **
  • Posts: 562
  • Country: 00
  • 50Hz Territory
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?
Code: [Select]
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:


Here is the debug output of when doing the same as above with the -g option:
Code: [Select]
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?


« Last Edit: November 30, 2025, 08:06:15 am by hp3310a »
 

Offline hp3310a

  • Frequent Contributor
  • **
  • Posts: 562
  • Country: 00
  • 50Hz Territory
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:
Code: [Select]
(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.
« Last Edit: November 30, 2025, 09:36:43 am by hp3310a »
 

Offline wkb

  • Super Contributor
  • ***
  • Posts: 1156
  • Country: nl
  • PA1WBU
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..
 
The following users thanked this post: hp3310a

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3812
  • Country: gb
Looks like the instrument starts sending the screenshot data, but then the transfer fails.
Quote
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?
 

Offline hp3310a

  • Frequent Contributor
  • **
  • Posts: 562
  • Country: 00
  • 50Hz Territory
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.
« Last Edit: November 30, 2025, 11:29:13 am by hp3310a »
 

Offline wkb

  • Super Contributor
  • ***
  • Posts: 1156
  • Country: nl
  • PA1WBU
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..  :-//
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3812
  • Country: gb
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
« Last Edit: November 30, 2025, 11:48:02 am by voltsandjolts »
 

Offline hp3310a

  • Frequent Contributor
  • **
  • Posts: 562
  • Country: 00
  • 50Hz Territory
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.
 

Offline hp3310a

  • Frequent Contributor
  • **
  • Posts: 562
  • Country: 00
  • 50Hz Territory
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

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

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.
« Last Edit: December 03, 2025, 03:13:13 pm by hp3310a »
 

Offline fenugrec

  • Frequent Contributor
  • **
  • Posts: 299
  • Country: ca
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.
 

Offline fenugrec

  • Frequent Contributor
  • **
  • Posts: 299
  • Country: ca
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 !
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->