Skip to content

Instantly share code, notes, and snippets.

View eric-tramel's full-sized avatar
👷
🏗️ ⚒️ 🔧 🏛️

Eric W. Tramel eric-tramel

👷
🏗️ ⚒️ 🔧 🏛️
View GitHub Profile
@eric-tramel
eric-tramel / gist:5368344
Created April 12, 2013 00:38
Julia Images Error
julia> Pkg.add("Images")
MESSAGE: Installing BinDeps v0.0.0
'BinDeps' already exists in the index
ERROR: failed process: Process(`git submodule add --reference . git://github.com/loladiro/BinDeps.jl.git BinDeps`, ProcessExited(1)) [1]
in pipeline_error at process.jl:388
in run at process.jl:378
in _resolve at pkg.jl:301
in anonymous at no file:155
in cd at file.jl:26
in cd_pkgdir at pkg.jl:34
@eric-tramel
eric-tramel / gist:5368450
Created April 12, 2013 00:58
Julia, "using Images;" Error with TK.
julia> using Images;
WARNING: ImageMagick utilities not found. Install for more file format support.
objc[9644]: Class TKApplication is implemented in both /usr/lib/libtk.dylib and /Applications/Julia.app/Contents/Resources/julia/lib/libtk8.6.dylib. One of the two will be used. Which one is undefined.
objc[9644]: Class TKMenu is implemented in both /usr/lib/libtk.dylib and /Applications/Julia.app/Contents/Resources/julia/lib/libtk8.6.dylib. One of the two will be used. Which one is undefined.
objc[9644]: Class TKContentView is implemented in both /usr/lib/libtk.dylib and /Applications/Julia.app/Contents/Resources/julia/lib/libtk8.6.dylib. One of the two will be used. Which one is undefined.
objc[9644]: Class TKWindow is implemented in both /usr/lib/libtk.dylib and /Applications/Julia.app/Contents/Resources/julia/lib/libtk8.6.dylib. One of the two will be used. Which one is undefined.
ERROR: ParseError("incomplete expression")
in include_from_node1 at loading.jl:76
in reload_path at loading.jl:96
in require
@eric-tramel
eric-tramel / gist:5368534
Created April 12, 2013 01:19
Lines 97 to 115 of Tk.jl
type TkWidget
path::ByteString
kind::ByteString
parent::Union(TkWidget,Nothing)
ID::Int = 0
function TkWidget(parent::TkWidget, kind)
path = "$(parent.path).jl_$(replace(kind, "::", "_"))$(ID)"; ID += 1
new(path, kind, parent)
end
@eric-tramel
eric-tramel / matrix_image_conv.m
Last active August 29, 2015 13:56
2D Convolution Matrix in Matlab
% Specify image
im_size = [128,128];
X = double(imread('peppers.png'));
X = imresize(X,im_size);
% Grab some kind of filter/PSF
PSF_dim = [4,4];
PSF = ones(PSF_dim);
PSF = PSF ./ norm(PSF(:));
@eric-tramel
eric-tramel / gist:9125302
Created February 20, 2014 23:12
Jean's Panoply of Priors
classdef Prior
% This class contains all the prior-dependent functions including learnings
properties
av_mess; av_mess_old; var_mess; var_mess_old; R; S2; rho; learn; N; alpha; func; dump_learn; t; method; param_1; param_2; param_3; param_4;
% Gaussian sparse prior : p(x) ~ (1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var_gauss) ) : param_1 = m_gauss; param_2 = var_gauss;
% Gaussian sparse prior enforcing value inside a symetric interval : p(x) ~ [(1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var_gauss) )] * I(|x| < cut) : param_1 = m_gauss; param_2 = var_gauss; param_3 = cut;
% Positive Gaussian sparse prior : p(x) ~ (1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var) ) * I(x > 0) : param_1 = m_gauss; param_2 = var_gauss;
% Mixture of two gaussians : p(x) ~ (1 - rho) * exp(-(x - m_1)^2 / (2 * var_1) ) / sqrt(2 * pi * var_1) + rho * exp(-(x - m_
@eric-tramel
eric-tramel / eric_positive_armijo.m
Created December 19, 2014 16:10
Positive Constrained Minimization
function x = eric_positive_armijo(x0,f,g,h)
% Calculate a Newton-Step type minimization using the given
% f function, its gradient g, and its hessian (second order)
% h.
scalar_mode = false;
if isscalar(x0)
scalar_mode = true;
end
2015-09-21 13:23:35 +0200
make
-C
contrib
-f
repackage_system_suitesparse4.make
prefix=/usr/local/Cellar/julia/HEAD
USE_BLAS64=0
FC=/usr/local/bin/gfortran
@eric-tramel
eric-tramel / Testing CUBLAS.ipynb.json
Last active September 28, 2015 09:49
Testing CUDArt.jl and CUBLAS.jl on Julia
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Testing CuBLAS and CUDArt for Julia\n",
"After finally getting NVCC to work on OSX, we can start using the CUDA-themed BLAS packages written for Julia. In this notebook we will document how to utilize the necessary datatypes and show comparisons between the CPU and GPU implementations of common BLAS functions."
]
},
@eric-tramel
eric-tramel / generate_synthetic_tomo_data.m
Created November 24, 2015 15:32
Synthetic Binary Tomo Data
function X = generate_synthetic_tomo_data(N,p,seed)
% GENERATE_SYNTHETIC_TOMO_DATA Create an NxN circle-masked synthetic image based
% on E.G.'s BP for Tomography package: https://github.com/eddam/bp-for-tomo.
% def generate_synthetic_data(l_x=128, seed=None, crop=True, n_pts=25):
% """
% Generate synthetic binary data looking like phase separation
% Parameters
% ----------
@eric-tramel
eric-tramel / ConvertCIFAR.m
Created February 9, 2016 13:41
Script for converting all CIFAR to wavelet coefficients.
clear;
%% File Paths
fname = 'AllCIFAR.h5';
addpath(genpath('/Google Drive/Research/code/matlab/toolboxes/WaveletSoftware'));
%% Read in the HDF5 information
hi = hdf5info(fname);
X = hdf5read(hi.GroupHierarchy(1).Datasets(1));