Skip to main content

A realtime plotting library built using plot.ly

Project description

Crystal

crystal logo

A realtime plotting and project management library built using Plotly

What can it do?

Crystal is an alternative to the amazingly useful visualization tool Tensorboard with some additional features that make it useful not just for Machine Learning but, in any project that needs realtime data visualizations. You can include realtime plots in your python (more languages to come) easily with just two line of code.

Some features provided by crystal include;

  • Centralized database to store the results of all projects.
  • Easy way to download results from the database if needed.
  • Plots supported include scalar, histogram and images with more to come.

To get started just install crystal using pip as follows:

$ pip install crystal

The installation adds a path to crystal script to PATH variable on linux which allows you to run the crystal dashboard from any directory as follows:

$ crystal

Note:

  • If you install it on a virtual environment then you will only be able to run it only when the environment is activated.

Here's how you'd plot a sine wave using crystal:

"""
realtime_sinewave.py
"""

import time
import numpy as np
from crystal import Crystal

cr = Crystal(project_name="Realtime_sine")
x_range = np.arange(0, 1000, 0.1)

for i in x_range:
    value = np.sin(2*np.pi*i)
    cr.scalar(value=value, step=i, name="sine_wave")
    print("step: {} \t value: {}".format(i, value))
    time.sleep(1)  # one value a second

Let's have a closer look at some of the functions used in the above code:

  • cr = Crystal(project_name=..) creates a new project in the database, if no project name is provided then, the script name is used as the project name.
  • cr.scalar(value=..) plots a scalar value and takes three parameters, value stores the y-axis value which in this case is the sin output, step saves the x-axis value and name provides a title for the plot.
  • Each run in a project is assigned a unique run id that contains the time stamp. You can see them in the terminal and also the dashboard (described below).
  • All the data is stores under ~/Crystal_data/crystal.db.

Output:

Run

$ crystal 

and select a project and run name. You will see a plot that looks something like this:

crystal gif

Crystal Dashboard in action

Where can I learn more?

Docs are still being worked on. Feel free to contribute in documenting the usage!

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crystal-0.1.0.tar.gz (2.1 MB view hashes)

Uploaded Source

Built Distribution

crystal-0.1.0-py3-none-any.whl (2.1 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page