OptixLog Documentation
Experiment tracking platform for photonic simulations and hardware testing
OptixLog Documentation
Welcome to the OptixLog documentation! OptixLog is an experiment tracking platform designed for photonic simulations and hardware testing.
What is OptixLog?
OptixLog helps you track, visualize, and compare your photonic simulations and hardware test results. Whether you're running FDTD simulations, testing optical components, or automating hardware measurements, OptixLog provides the tools you need to stay organized and productive.
Quick Start
1. Install the SDK
pip install optixlog2. Initialize and Log
from optixlog import Optixlog
# Create client with your API key
client = Optixlog(api_key="your_api_key")
# Get or create a project
project = client.project(name="my_project", create_if_not_exists=True)
# Create a run with configuration
run = project.run(
name="experiment_1",
config={"wavelength": 1550, "resolution": 30}
)
# Log metrics
for step in range(100):
loss = simulate(step)
run.log(step=step, loss=loss, accuracy=0.95)
# Log matplotlib figures with one line
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
run.log_matplotlib("my_plot", fig)That's it! View your results at optixlog.com
API Structure
The SDK uses a fluent, chainable API:
Optixlog → Project → Run → log()from optixlog import Optixlog
# Initialize client
client = Optixlog(api_key="your_api_key")
# Get project (creates automatically if create_if_not_exists=True)
project = client.project(name="project_name", create_if_not_exists=True)
# Create a run
run = project.run(name="run_name", config={"param": "value"})
# Available methods on run:
run.log(step=0, metric=value) # Log metrics
run.log_matplotlib("key", fig) # Log matplotlib figure
run.log_plot("key", x, y) # Create and log simple plot
run.log_array_as_image("key", array) # Log numpy array as heatmap
run.log_image("key", pil_image) # Log PIL image
run.log_file("key", "path/to/file") # Log any file
run.log_histogram("key", data) # Create and log histogram
run.log_scatter("key", x, y) # Create and log scatter plot
run.log_multiple_plots("key", [...]) # Log multiple lines on one plot
run.log_batch([...]) # Log multiple metrics in parallel
run.set_config({"key": "value"}) # Update configurationDocumentation
SDK Documentation
Python SDK for experiment tracking
CLI Documentation
Command-line code instrumentation
Hardware Testing
SCPI automation guide
Common Use Cases
Parameter Sweep
from optixlog import Optixlog
client = Optixlog(api_key="your_api_key")
project = client.project(name="sweep", create_if_not_exists=True)
for lr in [0.001, 0.01, 0.1]:
for batch_size in [16, 32, 64]:
run = project.run(
name=f"lr={lr}_bs={batch_size}",
config={"lr": lr, "batch_size": batch_size}
)
for step in range(100):
loss = train_step(lr, batch_size)
run.log(step=step, loss=loss)Training Loop with Context Manager
project = client.project(name="training", create_if_not_exists=True)
with project.run(name="experiment_v1", config={
"model": "resnet50",
"optimizer": "adam",
"lr": 0.001
}) as run:
for epoch in range(100):
train_loss = train_epoch()
val_loss = validate()
run.log(step=epoch, train_loss=train_loss, val_loss=val_loss)
# Automatically prints completion statusLogging Matplotlib Plots
import matplotlib.pyplot as plt
run = project.run(name="analysis")
# Method 1: Log existing matplotlib figure
fig, ax = plt.subplots()
ax.plot(x, y)
run.log_matplotlib("my_plot", fig)
# Method 2: Create and log in one call
run.log_plot("loss_curve", steps, losses,
title="Training Loss",
xlabel="Step",
ylabel="Loss")Logging Field Data (Numpy Arrays)
import numpy as np
run = project.run(name="field_simulation")
# Log 2D arrays as heatmaps
field = np.random.rand(100, 100)
run.log_array_as_image("field", field, cmap='hot', title="E-field intensity")Logging Files
# Log CSV data
run.log_file("measurements", "data.csv", "text/csv")
# Log video
run.log_file("animation", "simulation.mp4", "video/mp4")Multi-Metric Tracking
with project.run(
name="waveguide_sim",
config={"wavelength": 1550, "resolution": 50}
) as run:
for step in range(100):
# Log multiple metrics at once
run.log(
step=step,
power=measure_power(),
transmission=calc_transmission(),
reflection=calc_reflection(),
phase=calc_phase()
)Photonic Simulation Example
Track FDTD simulations with Meep, Tidy3D, or custom solvers:
from optixlog import Optixlog
import meep as mp
client = Optixlog(api_key="your_api_key")
project = client.project(name="PhotonicSims", create_if_not_exists=True)
with project.run(
name="waveguide_sim",
config={"wavelength": 1.55, "resolution": 30}
) as run:
sim = mp.Simulation(...)
for step in range(100):
sim.run(until=1)
power = calculate_power(sim)
run.log(step=step, power=power)
# Log field snapshot as heatmap
if step % 10 == 0:
field = sim.get_array(...)
run.log_array_as_image(f"field_step_{step}", field, cmap='RdBu')Hardware Testing Example
Automate test equipment with SCPI and log results:
from optixlog import Optixlog
client = Optixlog(api_key="your_api_key")
project = client.project(name="HardwareTesting", create_if_not_exists=True)
with project.run(name="power_measurement") as run:
for i, wavelength in enumerate(wavelengths):
# Set wavelength on laser
laser.write(f':WAVE {wavelength}nm')
# Read power from meter
power = float(power_meter.query(':MEAS:POW?'))
run.log(step=i, wavelength=wavelength, power=power)Key Features
- Fluent API — Chain methods naturally:
client.project().run().log() - Zero Boilerplate — Log matplotlib plots in one line with
log_matplotlib() - Helper Methods —
log_plot(),log_array_as_image(),log_histogram(),log_scatter() - Context Managers — Use
with project.run() as run:for automatic cleanup - MPI Support — Automatic detection and rank 0 logging for parallel simulations
- Input Validation — Catches NaN/Inf and invalid data
- Batch Operations — Fast parallel uploads with
log_batch() - Return Values — Get URLs and status for everything
Setup
1. Get Your API Key
Visit optixlog.com to get your API key.
2. Install SDK
pip install optixlog3. Start Logging
from optixlog import Optixlog
client = Optixlog(api_key="your_api_key")
project = client.project(name="MyProject", create_if_not_exists=True)
with project.run(name="my_experiment") as run:
run.log(step=0, loss=0.5)4. View Results
Visit optixlog.com to view your runs.
Next Steps
- SDK Quick Start — Get started with the SDK
- API Reference — Complete SDK reference
- Examples — Real-world code samples
- Hardware Testing — Automate test equipment
Support
- Documentation: Browse the sections in the sidebar
- API Reference: Complete SDK reference
- Examples: Real-world code samples
- Troubleshooting: Common issues and solutions