Python code for Sparse filtering etc