Code Monkey home page Code Monkey logo

cli-plotter's Introduction

cli-plotter

Simple modular text-based command line plotter

Setup

I recommend using a python virtualenv. Once in your environment run: pip install -r requirements.txt

Running the code

This module was designed to utilize OS pipes to extract data from a source, transform that data into floating point comma separated values and pipe that to the time_series.py script. The boilerplate command is:

EXTRACT-DATA | TRANSFORM-DATA | LOAD && DISPLAY DATA

cat ./examples/example_IMU_data.txt | python src/rpy_adapter.py | python src/time_series.py rpy demo

cat ./examples/example_IMU_data.txt | python src/heading_adapter.py | python src/time_series.py heading only demo

Run with real-time sensor outputting on serial port

cat /dev/ttyACM0 | python src/rpy_adapter.py | python src/time_series.py

Adapters

To create your own adapters (seen in the examples commands as: .. | python my_adapter.py | ..) use the following boiler plate code:

import sys
import json # optional - my serial device outputs json...
# this puts stdout in unbuffered mode -- eq to python -u
import unbuffered_io

# print title(s) with $ as first char
print('$MyData vs. Time')
try:
    while True:
        # read stdin
        line = sys.stdin.readline().strip()
        # transform
        try:
            #
            #   Transform the input to comma separated float values
            #   * In this example we have 1 title meaning 1 plot
            #     the output should be one float value only
            #
            output = float(line)
        except MyKnownException:
            continue

        # print
        print(output)

except KeyboardInterrupt:
    pass
finally:
    print('\n\tExample Adapter Exiting...\n')

cli-plotter's People

Contributors

caileighf avatar

Stargazers

Paul Reuter avatar Hendrik Lankers avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.