Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you could build a simple server/client, the server running continuously making and updating the plot, and the client just communicating the next file to process.</p> <p>I wrote a simple server/client example based on the basic example from the <code>socket</code> module docs: <a href="http://docs.python.org/2/library/socket.html#example" rel="noreferrer">http://docs.python.org/2/library/socket.html#example</a></p> <p>here is server.py:</p> <pre><code># expensive imports import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import scipy.ndimage import scipy.signal import sys import os # Echo server program import socket HOST = '' # Symbolic name meaning all available interfaces PORT = 50007 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) while 1: conn, addr = s.accept() print 'Connected by', addr data = conn.recv(1024) if not data: break conn.sendall("PLOTTING:" + data) # update plot conn.close() </code></pre> <p>and client.py:</p> <pre><code># Echo client program import socket import sys HOST = '' # The remote host PORT = 50007 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.sendall(sys.argv[1]) data = s.recv(1024) s.close() print 'Received', repr(data) </code></pre> <p>you just run the server:</p> <pre><code>python server.py </code></pre> <p>which does the imports, then the client just sends via the socket the filename of the new file to plot:</p> <pre><code>python client.py mytextfile.txt </code></pre> <p>then the server updates the plot.</p> <p>On my machine running your imports take 0.6 seconds, while running <code>client.py</code> 0.03 seconds.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload