Python IPC with matplotlib
NickName:csandy83 Ask DateTime:2018-02-04T07:43:54

Python IPC with matplotlib

Project description:

Connect existing "C" program (main control) to Python GUI/Widget. For this I'm using a FIFO. The C program is designed look at frame based telemetry.

The Python GUI performs two functions:

  1. Runs/creates plots (probably created through matplotlib) via GUI widget as the user desires (individual .py files, scripts written by different users)
  2. Relays the frame number to the python plotting scripts after they have been created so they can "update" themselves after being given the frame number from the master program.

I have several questions--understanding the pros and cons from multi-processing versus multi-threading seen here: Multiprocessing vs Threading Python

Implementation Considerations:

  1. Having too many plots created via threads in signal based architecture probably becomes laggy in terms of updating them I'm guessing. I'm not sure when they become CPU bound...most plots will update a few line series, some may update images. Perhaps it will be laggy regardless of which way I choose to do this regardless of creation method.

  2. I'm not sure what opening 30 python processes, where each process makes a plot or two with matplotlib does to a machine or its resources. I see a single simple matplotlib plot on my system has an RSS (allocated memory) of 117M, so I don't think a single user plotting 30 plots would limit system memory if done by opening separate processes for each plot. (16 GB, 32-core Linux Boxes with several simultaneous users)

Questions:

  1. Should I open the plots via threads or processes and will one be less laggy than the other?
  2. If I use threads does anyone have any idea how many matplotlib figures it will take to update before it gets laggy on a single thread?
  3. If I create the plots as processes, should I use the multiprocessing package? I'm guessing this API makes it straight forward to communicate the frame number between processes?
  4. Given I have multi-processing available, it's probably silly to try to open processes through POpen right? I'm guessing this is the case because if I did this I would have to setup all of the piping/IPC myself which would be more work?

Copyright Notice:Content Author:「csandy83」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48603249/python-ipc-with-matplotlib

More about “Python IPC with matplotlib” related questions

Python IPC with matplotlib

Project description: Connect existing "C" program (main control) to Python GUI/Widget. For this I'm using a FIFO. The C program is designed look at frame based telemetry. The Python GUI performs...

Show Detail

IPC Communication : Recieving a C application posted structure in python using POSIX IPC

We developing a IPC module where application A (C application uses Mqueue) will POSt a structure data in IPC Queue Application B (python Based uses POSIX IPC for Python) has to access the queue and

Show Detail

changing ipc:// to tcp:// python zmq (Windows)

I't trying to get a python application running on Windows and I get an ZMQError: Protocol not supported which is because ipc is not supported on windows. From what I have read the change from ipc t...

Show Detail

Python IPC between two processes on different machines

I have two python processes running on two separate machines. These processes need to communicate with each other using some IPC mechanism. Which is the simplest or the most suitable IPC mechanis...

Show Detail

is there an equivalent to posix_ipc on windows? for python

so I am wandering is there an equivalent to Posix_ipc on windows? what I want is to make an anonymous mapping shared memory between unrelated python processes, I've heard about Win32_ipc but I coul...

Show Detail

IPC mechanisms for python

A and B are two python programs in the same directory. Currently program A is running and now program B is going to be executed from A by using the following instruction. os.system("python B.py &...

Show Detail

IPC between VBA and Python

I am facing the following problem: In our company we use a software whose GUI was programmed with MS Access/VBA. Now a part of the business logic should be moved to Python, but the MS Access part s...

Show Detail

Alternatives to pyipc lib for IPC with python

I use for an old project pyipc a Python binings to System V interprocess communication mechanisms: https://pypi.python.org/pypi/pyipc/ that work well, I use it like this: from ipc import Semaphore,

Show Detail

IPC between C application and Python

So I am relatively new to IPC and I have a c program that collects data and a python program that analyses the data. I want to be able to: Call the python program as a subprocess of my main c prog...

Show Detail

Arrow IPC vs Feather

What is the difference between Arrow IPC and Feather? The official Arrow documentation says: Version 2 (V2), the default version, which is exactly represented as the Arrow IPC file format on disk....

Show Detail