Recent

Author Topic: AI Assist Python - to - Pascal?  (Read 1638 times)

Thausand

  • Sr. Member
  • ****
  • Posts: 498
Re: AI Assist Python - to - Pascal?
« Reply #15 on: April 08, 2026, 03:56:24 pm »
The python for the VNA has been sitting in my download folder for a few years  :( so I don't remember where it came from.  It's called "pynanovna."  I would guess it was from github -- certainly somewhere on the web.
Here is program for nanovna and is write in cpp/windows and may be can help ( https://github.com/OneOfEleven/NanoVNA-App )

I no think rewrite mathplot and numphy for pascal is work (like write other: is many complicate translate).

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 747
Re: AI Assist Python - to - Pascal?
« Reply #16 on: April 08, 2026, 06:13:10 pm »
Thanks for the link to the C code, I downloaded the zip and will have a look.  I've done C++ conversions before in projects like this.  Huge time sinks!  Really interested in how much help Claude AI can be but am finding it hard to gain traction on where to start.  (I'm sure it's not that hard -- I just don't have the energy I used to.)

gidesa

  • Full Member
  • ***
  • Posts: 237
Re: AI Assist Python - to - Pascal?
« Reply #17 on: April 08, 2026, 06:42:43 pm »
It is the Python ecosystem that can be complicated, not the language as such, because most of Python's real functionality lies in its extensive use of libraries mostly written in other, much more low-level languages.
Which also makes it much harder to port: in effect you have to port the - interface to - those libraries too.
Absolutely. But was a comparison between Spectrum Basic and Python as a languages :-)
Python simply is much popular among people that work in some software areas, as: AI, big data, scientific/research, and others.
It's not so popular in other  areas, for example Android development.

EDIT: it's also popular as a scripting language in many complex softwares, as Blender for 3D graphic.

 
« Last Edit: April 08, 2026, 07:02:05 pm by gidesa »

Thausand

  • Sr. Member
  • ****
  • Posts: 498
Re: AI Assist Python - to - Pascal?
« Reply #18 on: April 08, 2026, 07:41:58 pm »
@Curt

May be I not understand correct.

VNA protocol is have 2 version, version 1 and version 2. version 1 ascii and version 2 binary.

When read it say it is use serial device and send data (have baudrate, stopbits etc) and use version 1 protocol (please have make self verification that true. I only have make quick look so may be I wrong).

BTW source for python pynanovna is https://github.com/PICC-Group/pynanovna

Then I think is easy and all have do is port protocol. Can use python version or cpp version and should be same. Maybe cpp version tiny better for understand how port protocol for Pascal (may be also for LLM).

Then have receive data test. When have data receive then have see how is make code for process data.

Then data is process for display graphics. Python is use mathplot library for draw graph data. Cpp version have use own solution.

Lazarus have TAChart graphic that make graphic like mathplot. Then I think is may be good idea and learn how is work TAChart and how is organize data for make graphic with TAChart. Then have find how make serial data and make code convert and store properties for have draw for TAChart.

Information TACHArt https://wiki.freepascal.org/TAChart and https://wiki.freepascal.org/TAChart_Demos

May be have make more small step for LLM for help. If lucky then may be LLM understand protocol and not have need source-code and can ask for please have write pascal implementation for protocol for VNA device.

Have note that is available free AI online and can have ask question about protocol. May be one have knowledge and can help for that and not have pay LLM use.



I have ask duck AI "what protocol is use nanovna device for communicate computer" and it have write information.

Quote
The NanoVNA device typically communicates with a PC using a USB connection and employs a serial communication protocol. This allows users to control the device and retrieve data through software applications.

Communication Protocol for NanoVNA

Connection Method

The NanoVNA device communicates with a PC using a USB connection. This allows for easy data transfer and control of the device.
Protocol Details

The communication between the NanoVNA and the PC utilizes a serial communication protocol. This protocol enables users to send commands to the NanoVNA and receive measurement data through compatible software applications.

Summary of Features

FeatureDescription
Connection TypeUSB
Communication protocolSerial communication protocol
FunctionalityControl device and retrieve data

This setup allows users to effectively manage the NanoVNA and analyze data on their computers.

You can have ask LLM for write what is step for make plan. Then have make plan execute small step 1, then small step 2 etc. So no have think anything. That is why I not have like AI: it have make lazy  ;D
« Last Edit: April 08, 2026, 08:12:41 pm by Thausand »

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 747
Re: AI Assist Python - to - Pascal?
« Reply #19 on: April 08, 2026, 10:32:21 pm »
Thank you for the information Thausand.  The nanovna project is more a way to try and learn something about AI than to build a Lazarus/Pascal interface for the hardware (which can be used with no PC connection at all and has it's own GUI of sorts).  My only contact with AI is via google, so it's all unknown territory for me.  I am lazy though, so if ClaudeAI can poop out a working program for me, I won't say no  :)  -- it would be a good starting point.   We'll see.  For now, it's just an adventure.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6381
  • Compiler Developer
Re: AI Assist Python - to - Pascal?
« Reply #20 on: April 10, 2026, 07:25:42 am »
Is not what OP asked, but may I suggest this: https://github.com/lmbelo/python4delphi

It's a component that allows the use of Python within Delphi or Lazarus.
I used it to build a DLL in Delphi (python module .pyd) for a project that Python can uses (i.e., exactly the opposite of what it was designed to do).

There are several bugreports for python4delphi related to custom variants. So I wouldn't assume it working

Considering that the one you linked later on is closed, I'd say that 3.3.1 is better in that regard than 3.2.2 (and I think the fix is also in 3.2.3) and as long as one doesn't rely on implicit casts (the bug report referenced in the end of that bug report) then one should be able to use it rather well... 🤔

 

TinyPortal © 2005-2018