Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Ratiocinating

Lekan lakehanne

🎯
Ratiocinating
View GitHub Profile
@lakehanne
lakehanne / KalmanFilter.py
Last active Oct 12, 2020
Simple Kalman filter implementation for a single state linear system.
View KalmanFilter.py
from __future__ import print_function
'An easy implementation of the Kalman-Bucy Filter'
'Ref: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.361.6851&rep=rep1&type=pdf'
import rospy. # you don't have to use rospy
import numpy as np
# handle_soro_pose is a function wrapper around a ros service that retrieves sensor observations in real time.
from scripts.service_clinet import handle_soro_pose
View domering.xml
<?xml version="1.0"?>
<Node name="DomeRingNode" gravity="0 -9.81 0" dt=".02">
<EulerImplicitSolver name="domeRing_cg_odesolver" printLog="false" />
<CGLinearSolver iterations="25" name="linear solver_dome_ring" tolerance="1.0e-9" threshold="1.0e-9" />
<!-- <MeshObjLoader name="dome_ring_loader" filename="../../../../ros/srs_traj_opt/patient_description/meshes/dome/dome_ring.obj" scale="1"/> -->
<MeshVTKLoader name="vtkDomeRingLoader" filename="../../../../ros/srs_traj_opt/patient_description/meshes/dome/dome_ring.vtu" />
<TetrahedronSetTopologyContainer name="TetraTopologyContainer_dome_ring" src="@vtkDomeRingLoader" />
<MechanicalObject name="dofs" src="@vtkDomeRingLoader" template="Vec3d" showIndices='false' showIndicesScale='4e-5' rx='0' dz='0'/>
<TetrahedronSetGeometryAlgorithms template="Vec3d" name="domeRing_TetraGeomAlgo" drawTetrahedra="1"/>
<TetrahedronSetTopologyAlgorithms template="Vec3d" name="domeRing_TetraTopologyAlgo" />
View rounder.py
import numpy as np
"""
For details, see
[1] https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
[2] https://docs.scipy.org/doc/numpy/reference/generated/numpy.around.html?highlight=round#numpy.around
Thanks to fesetround from ctypes. We can manually set the rounding mode
"""
import ctypes, sys
View champock.py
import os
import cupy as cp
import numpy as np
class chambollepock(object):
def __init__(self):
self.proxops = proxops()
self.variables = cpk_variables()
self.applyK = cpk_applyK()
self.optimizer = cpk_optimizer(self)
@lakehanne
lakehanne / mac_dev_setup.sh
Created Aug 15, 2018 — forked from captainsafia/mac_dev_setup.sh
A set of commands I use to configure my Mac for development
View mac_dev_setup.sh
# Create a global gitignore for macOS
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
# Send screenshots to a directory that isn't the desktop
mkdir -p ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
# Show all hidden files (like dotfiles)
defaults write com.apple.finder AppleShowAllFiles YES; killall Finder;
View lbfgs.py
import os
import copy
import time
import random
import h5py
import h5sparse
import logging
import numpy as np
from scipy.sparse import vstack
View get_mask.py
import h5py
import numpy as np
from skimage.transform import resize
import os
import logging
from os.path import join, expanduser
logger = logging.getLogger(__name__)
@lakehanne
lakehanne / sublime.sh
Created Jan 6, 2018 — forked from amatellanes/sublime.sh
Install Sublime Text 3 on Ubuntu 14.04 LTS (Trusty Tahr)
View sublime.sh
sudo add-apt-repository ppa:webupd8team/sublime-text-3;
sudo apt-get update;
sudo apt-get install sublime-text-installer;
sudo ln -s /usr/lib/sublime-text-3/sublime_text /usr/local/bin/sublime;
@lakehanne
lakehanne / CMakeLists.txt
Created May 4, 2017
OpenCV CmakeLists custom compiler
View CMakeLists.txt
# ----------------------------------------------------------------------------
# Root CMake file for OpenCV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_OPENCV_ROOT>
#
#
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
#
# ----------------------------------------------------------------------------
You can’t perform that action at this time.