Skip to content

Instantly share code, notes, and snippets.

@Matjaz-B
Matjaz-B / mpl_to_plotly.py
Last active July 5, 2023 07:10
Plot multiple plots on same html using mpld3
import numpy as np
import matplotlib.pyplot as plt
import plotly.tools as tls
import json
import jinja2
template_str = """<!Doctype Html>
<html>
<head>
@Matjaz-B
Matjaz-B / click_test.py
Last active June 4, 2023 21:22
click clean-up after abort
import asyncio
import click
async def do_some_work(duration):
print("Function performs some initialization, runs some command, waits and then stops")
## some init functions
## start operation
@Matjaz-B
Matjaz-B / saleae-logic cont capture 1h.py
Created February 28, 2023 11:17
Using saleae API capture and store logic data indefinitly every x seconds
from saleae import automation
from datetime import datetime
import os
import os.path
manager = automation.Manager.connect(port=10430)
while(True):
@Matjaz-B
Matjaz-B / s1p_plot.py
Created April 15, 2021 13:30
Plot multiple s1p plots on one graph
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import skrf as rf
def plot_s1p(title, path, files):
fig, (ax) = plt.subplots(1,1, figsize=(20,10))
out = ""
for f in files:
net = rf.Network(path+f)
net.frequency.unit = "mhz"
@Matjaz-B
Matjaz-B / embedder.py
Created October 3, 2017 11:04
Embed images (data URI) into HTML document
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Embed images into HTML document
"""
import base64
import mimetypes
import os
import re