Skip to content

Instantly share code, notes, and snippets.

View ASolchen's full-sized avatar

Adam Solchenberger ASolchen

  • WI, USA
View GitHub Profile
@ASolchen
ASolchen / pyads_window.py
Created January 9, 2019 17:45
Basic window to talk to a Beckhoff controller using PyGObject and pyads
#local ip is 10.10.10.11
#PLC ip is 10.10.10.10
#route setup on PLC's ADS router AmsNetID 10.10.10.11.1.1 and IP 10.10.10.11
import gi, shutil, os
import pyads
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject, Gdk
def setup_ads():
@ASolchen
ASolchen / interp.py
Created April 18, 2018 18:56
numpy interp1d
from scipy.interpolate import interp1d
import numpy as np
old_time = np.linspace(0, 10, num=11, endpoint=True)
old_vals = np.sin(old_time)
f = interp1d(old_time, old_vals)
f2 = interp1d(old_time, old_vals, kind='cubic')
new_time = np.linspace(0, 10, num=1000, endpoint=True)
import time, struct
import numpy as np
import matplotlib.pyplot as plt
path = 'E:/big_ass.rdd'
ptr = 0
np_ptr = 0
buff = np.zeros([2,2000000], np.float64)
t = time.time()
with open(path, 'rb') as f: