Skip to main content

Client SDK for logging photonic simulations to OptixLog with MPI support

Project description

OptixLog SDK

Experiment tracking for photonic simulations with automatic MPI support.

🚀 Quick Start

pip install http://optixlog.com/optixlog-0.1.0-py3-none-any.whl
import optixlog

# Set your API key
export OPTIX_API_KEY="proj_your_key_here"

# Start logging
with optixlog.run("my_experiment", config={"lr": 0.001}) as client:
    # Log metrics
    client.log(step=0, loss=0.5, accuracy=0.9)
    
    # Log plots (one line!)
    import matplotlib.pyplot as plt
    plt.plot([1,2,3], [1,4,9])
    client.log_matplotlib("my_plot", plt.gcf())

That's it! View your results at optixlog.com

📚 Documentation

Complete API Reference - Every function with examples

✨ Key Features

  • Zero Boilerplate: Log matplotlib plots in one line
  • Context Managers: Clean with statement support
  • Input Validation: Catches NaN/Inf and invalid data
  • Rich Output: Colored console feedback
  • MPI Support: Automatic detection and rank 0 logging
  • Batch Operations: Fast parallel uploads
  • Return Values: Get URLs and status for everything
  • Query API: Programmatic access to runs and artifacts

🎯 Common Use Cases

Log Training Metrics

with optixlog.run("training") as client:
    for epoch in range(100):
        client.log(step=epoch, loss=0.5, accuracy=0.9)

Log Matplotlib Plots

# Old way (15+ lines of boilerplate)
plt.savefig("plot.png")
with open("plot.png", "rb") as f:
    img = PIL.Image.open(f)
    client.log_image("plot", img)
os.remove("plot.png")

# New way (one line!)
client.log_matplotlib("plot", plt.gcf())

Log Field Data

import numpy as np
field = np.random.rand(100, 100)
client.log_array_as_image("field", field, cmap='hot')

Log Multiple Metrics

metrics = [{"step": i, "loss": losses[i]} for i in range(1000)]
result = client.log_batch(metrics)  # Fast batch upload!

Query Previous Runs

runs = optixlog.list_runs(client, project_name="MyProject")
for run in runs:
    artifacts = optixlog.get_artifacts(client, run.run_id)
    print(f"{run.name}: {len(artifacts)} artifacts")

🔧 Installation

From PyPI

pip install http://optixlog.com/optixlog-0.1.0-py3-none-any.whl

From Source

git clone https://github.com/yourusername/optixlog-sdk.git
cd optixlog-sdk
pip install -e .

🔑 Setup

  1. Get your API key from optixlog.com
  2. Set environment variable:
export OPTIX_API_KEY="proj_your_key_here"
  1. Optionally set default project:
export OPTIX_PROJECT="MyProject"

📖 Full Documentation

API_REFERENCE.md - Complete reference with:

  • All functions and parameters
  • Return types and error handling
  • Real-world examples
  • Best practices
  • MPI support details

🎓 Examples

See DEMO.py for a comprehensive demonstration of all features.

🛠️ Requirements

  • Python 3.8+
  • requests
  • numpy
  • matplotlib
  • pillow
  • rich

🚀 What's New in v0.1.0

  • One-line plot logging: log_matplotlib()
  • Context managers: with optixlog.run()
  • Helper functions: log_plot(), log_array_as_image()
  • Input validation: Catches NaN/Inf automatically
  • Return values: Every method returns status + URL
  • Batch operations: log_batch(), log_images_batch()
  • Query API: List and download runs programmatically
  • Rich output: Beautiful colored console feedback

See CHANGELOG.md for full details.

🤝 CLI Integration

The OptixLog CLI works seamlessly with this SDK:

npm install -g optixlog-cli
optixlog init  # Create .optixlog.json config
optixlog add-logging script.py  # Auto-instrument code
optixlog runs list  # Query runs from terminal

📊 Dashboard

View all your experiments at optixlog.com

📝 License

MIT License - see LICENSE file for details

🐛 Support


Version: 0.1.0
Made with ⚡ for photonic simulation tracking

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

optixlog-0.1.0.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optixlog-0.1.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file optixlog-0.1.0.tar.gz.

File metadata

  • Download URL: optixlog-0.1.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optixlog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 05db6f800875b01b4ed3d1d4a061d546962fd64d1821cf0454e8147710fb4409
MD5 37ec2f665eed7bed93f41e3dc6bd5cec
BLAKE2b-256 5152d34cd83d1fc7c79b7fc85f91f4b882ba8aa678e37087aee48c92b32b35fd

See more details on using hashes here.

File details

Details for the file optixlog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: optixlog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optixlog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 212e6b4110ec8d9a49bdfeea9a61de182049119086de2e1ab3b140e2f15bf125
MD5 26aeb0bc1149ea07333f6a2db8857e1a
BLAKE2b-256 cdd46b0ac2a9820d387b2dba927b33cfba649bd47b95c4b0c761485fb862c503

See more details on using hashes here.

Supported by

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