Skip to content

Instantly share code, notes, and snippets.

@jeanminet
jeanminet / pulse_density_modulation.py
Created September 27, 2016 19:03
Simple simulation of pulse density modulator
import numpy as np
import matplotlib.pyplot as plt
def pdm(x):
n = len(x)
y = np.zeros(n)
error = np.zeros(n+1)
for i in range(n):
y[i] = 1 if x[i] >= error[i] else 0
error[i+1] = y[i] - x[i] + error[i]
@jeanminet
jeanminet / CTL101_laser_temperature_vs_voltage.py
Last active January 16, 2024 08:18
CTL101 laser temperature vs voltage
import numpy as np
from matplotlib import pyplot as plt
R0 = 10E3 # Ohm
# https://www.thorlabs.com/drawings/781769f975857712-CFFE0B13-BE04-E334-3F539B30BADD4590/TH10K-SpecSheet.pdf
a = 3.3540170E-3
b = 2.5617244E-4
c = 2.1400943E-6
d = -7.2405219E-9