Photonic Computing API Reference

Complete documentation for all classes and methods

class RingResonator

Silicon microring resonator model for implementing photonic weights.

from photonic import RingResonator

ring = RingResonator(
    radius=10e-6,         # Ring radius in meters
    coupling_gap=200e-9,  # Waveguide-ring gap
    waveguide_width=500e-9,
    loss_db_cm=2.0,       # Propagation loss
    n_eff=2.4             # Effective refractive index
)

Constructor Parameters

ParameterTypeDescription
radiusfloatRing radius in meters (typically 5-20 μm)
coupling_gapfloatGap between bus waveguide and ring in meters
waveguide_widthfloatWaveguide width in meters
loss_db_cmfloatPropagation loss in dB/cm
n_efffloatEffective refractive index of waveguide mode

Methods

transmission(wavelength)float

Returns power transmission coefficient at given wavelength (meters).

phase(wavelength)float

Returns phase shift in radians at given wavelength.

get_fsr()float

Returns Free Spectral Range in meters.

get_quality_factor()float

Returns loaded Q factor.

tune_resonance(delta_lambda)float

Thermally tune resonance by delta_lambda. Returns required heater power in mW.

class PhotonicMVM

Photonic Matrix-Vector Multiplication unit using WDM crossbar architecture.

from photonic import PhotonicMVM

mvm = PhotonicMVM(
    size=(32, 32),        # Matrix dimensions
    precision=4,          # Bits per weight
    wavelengths=8,        # Number of WDM channels
    clock_rate=10e9       # Operating frequency in Hz
)

Constructor Parameters

ParameterTypeDescription
sizetupleMatrix dimensions (rows, cols)
precisionintWeight precision in bits (2, 4, or 8)
wavelengthsintNumber of WDM channels
clock_ratefloatOperating frequency in Hz

Methods

load_weights(matrix)None

Load weight matrix (numpy array). Automatically quantizes to specified precision.

forward(input_vector)ndarray

Perform matrix-vector multiplication. Returns output vector.

get_throughput()float

Returns compute throughput in TOPS.

get_energy_per_mac()float

Returns energy per MAC operation in fJ.

set_noise_model(model)None

Attach a NoiseModel instance for realistic simulation.

class PCMWeight

Phase-change material model for non-volatile photonic weight storage.

from photonic import PCMWeight

pcm = PCMWeight(
    material='gst',       # 'gst', 'gsst', 'aist'
    thickness=30e-9,      # Film thickness in meters
    wavelength=1550e-9,   # Operating wavelength
    levels=16             # Number of analog levels
)

Methods

set_state(level)float

Program to specified level (0 to levels-1). Returns energy consumed in nJ.

get_transmission()float

Returns current optical transmission (0 to 1).

get_refractive_index()complex

Returns current complex refractive index n + ik.

crystallize(pulse_width, power)None

Apply SET pulse with given parameters.

amorphize(pulse_width, power)None

Apply RESET pulse with given parameters.

class OpticalDAC

High-speed optical digital-to-analog converter for input encoding.

from photonic import OpticalDAC

dac = OpticalDAC(
    bits=8,               # Resolution
    architecture='segmented',  # 'binary', 'thermometer', 'segmented'
    sample_rate=40e9      # Sample rate in Hz
)

Methods

convert(digital_code)float

Convert digital code to analog optical power level.

get_inl()ndarray

Returns Integral Non-Linearity for all codes in LSB.

get_dnl()ndarray

Returns Differential Non-Linearity for all codes in LSB.

get_enob()float

Returns Effective Number of Bits.

class OpticalADC

Photonic analog-to-digital converter for output readout.

from photonic import OpticalADC

adc = OpticalADC(
    bits=6,               # Resolution
    architecture='flash', # 'flash', 'sar', 'pipeline'
    sample_rate=20e9      # Sample rate in Hz
)

Methods

sample(optical_power)int

Sample analog optical signal and return digital code.

get_sndr()float

Returns Signal-to-Noise-and-Distortion Ratio in dB.

get_sfdr()float

Returns Spurious-Free Dynamic Range in dB.

class NoiseModel

Comprehensive noise analysis for photonic computing systems.

from photonic import NoiseModel

noise = NoiseModel(
    optical_power=1e-3,   # Input power in Watts
    bandwidth=20e9,       # Detection bandwidth in Hz
    temperature=300,      # Temperature in Kelvin
    responsivity=0.9,     # Photodetector responsivity A/W
    rin_dbhz=-150         # Laser RIN in dB/Hz
)

Methods

shot_noise()float

Returns shot noise current in A/√Hz.

thermal_noise(load_resistance)float

Returns thermal noise current in A/√Hz.

rin_noise()float

Returns RIN-induced noise current in A/√Hz.

total_noise()float

Returns total noise current (RSS) in A/√Hz.

get_snr()float

Returns Signal-to-Noise Ratio in dB.

get_enob()float

Returns Effective Number of Bits.

Complete Example

import numpy as np
from photonic import PhotonicMVM, PCMWeight, NoiseModel

# Create 32x32 photonic MVM unit
mvm = PhotonicMVM(size=(32, 32), precision=4, wavelengths=8, clock_rate=10e9)

# Generate random weight matrix
W = np.random.randn(32, 32) * 0.1
mvm.load_weights(W)

# Add realistic noise model
noise = NoiseModel(optical_power=1e-3, bandwidth=20e9, temperature=300)
mvm.set_noise_model(noise)

# Forward pass
x = np.random.randn(32)
y = mvm.forward(x)

# Check performance
print(f"Throughput: {mvm.get_throughput():.1f} TOPS")
print(f"Energy/MAC: {mvm.get_energy_per_mac():.1f} fJ")
print(f"SNR: {noise.get_snr():.1f} dB")
print(f"ENOB: {noise.get_enob():.1f} bits")

# Compare with ideal result
y_ideal = W @ x
mse = np.mean((y - y_ideal)**2)
print(f"MSE: {mse:.2e}")