Skip to content

Instantly share code, notes, and snippets.

View antonior92's full-sized avatar

Antonio Horta Ribeiro antonior92

View GitHub Profile
from scipy.signal import decimate, resample_poly
def resample_ecg(trace, input_freq, output_freq, axis=-1):
"""Resample ecg.
`trace` should be a multidimensional numpy array. `axis` gives which axis will be resampled (be default the last
one). `input_freq` and `output_freq` are the input and output frequency (in heartz). Use the most appropriate SciPy
function vailable: first try decimate (with bidirectional filtering), if the input and output frequencies are not
multiple, it resamples using polyphase filtering.

How to install the GPU Drivers on Linux (or How I learned to stop worrying and love NVIDIA)

Authors: Antônio H. Ribeiro and Manoel H. Ribeiro

This is a guide containing practical steps to install nvidia gpu drivers and tensorflow which combines successful steps from previous (troublesome) experiences. We currently use nvidia cuda toolkit v9.0 and cudnn v7.0.5. This methodology has worked for Ubuntu v16.04 and for graphic cards GTX 980Tiand GTX 1080Ti.

Install Nvidia Driver

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* CUTEst2 interface to Python and NumPy */
/* (c)2011 Arpad Buermen */
/* Licensed under LGPL V2.1 */
/* Note that in Windows we do not use Debug compile because we don't have the debug version
of Python libraries and interpreter. We use Release version instead where optimizations
are disabled. Such a Release version can be debugged.
*/
/* Unused CUTEst tools - sparse finite element matrices and banded matrices
# (C)2011 Arpad Buermen
# Licensed under LGPL V2.1
"""PyCUTEst problem manager
Currently works only under Linux.
Requres CUTEst installation for double precision built with gcc and gfortran.
CUTEst library must be built with -fPIC (as position independent code).
using DifferentialEquations
using Plots
plotlyjs()
function kuramoto_pair_aux(t, θ, params, dθ)
w1, w2, k = params
dθ[1] = w1 - k*sin(θ[2] - θ[1])
dθ[2] = w2 - k*sin(θ[1] - θ[2])
end
using DifferentialEquations
using Plots
pyplot()
f = @ode_def_noinvjac KuramotoPair begin
dθ1 = w1 - k*sin(θ2 - θ1)
dθ2 = w2 - k*sin(θ1 - θ2)
end w1=>1.0 w2=>2.0 k=>1.0
# Simulation parameters
# Example
from __future__ import division, print_function, absolute_import
import numpy as np
from ipsolver import minimize_constrained, NonlinearConstraint, BoxConstraint
# Define objective function and derivatives
fun = lambda x: 1/2*(x[0] - 2)**2 + 1/2*(x[1] - 1/2)**2
grad = lambda x: np.array([x[0] - 2, x[1] - 1/2])
hess = lambda x: np.eye(2)
# Define nonlinear constraint