Skip to content

Instantly share code, notes, and snippets.

@ixxra
ixxra / denoising.py
Created November 25, 2014 00:46
denoising of a fringe pattern with variational methods. Currently not working!
# -*- coding: utf-8 -*-
from __future__ import division
"""
Created on Fri Nov 14 17:49:33 2014
@author: isra
"""
import numpy as np
from matplotlib import pyplot as plt
@ixxra
ixxra / numbers_from_digits.py
Created September 1, 2014 15:37
This is an example on howt to convert a list of digits into an integer
#Numbers from digits:
#How to convert a list of digits into a number
x = [2, 3, 4, 5, 9, 0]
#First way: ping-pong between string and integer
print int(''.join([str(d) for d in x]))
#Second way: plain arithmetic
@ixxra
ixxra / digits.py
Created September 1, 2014 15:23
How to make a list of digits from a number
#Aritmetic way to extract digits from a number
#It should work in most programming languages
x = 78449
digit = []
for k in range(4, -1, -1):
digit.append( x / 10**k )
x = x % 10**k
@ixxra
ixxra / digitos.py
Created August 29, 2014 19:13
This is a example of how to split a list of numbers into a list of digits.
#this program converts a list of integers into a list of digits
l = range(400, 450)
numeros_separados = []
for v in l:
digitos = []
y = v
for k in range(4, -1, -1):
@ixxra
ixxra / pandasNaiveBayes.py
Created August 1, 2014 23:59
Naive bayes with pandas, not working yet!... see https://higgsml.lal.in2p3.fr/software/starting-kit/
import pandas as pd
TRAINING_SET = 'data/training.csv'
TEST_SET = 'data/test.csv'
training = pd.read_csv(TRAINING_SET)
#background and signal total weights
total_weights = traininig.groupby(training.Label).sum()
#include "linklabel.h"
#include <QtWidgets>
LinkLabel::LinkLabel(QWidget * parent)
:QLabel(parent)
{
connect( this, SIGNAL( clicked() ), this, SLOT( slotClicked() ) );
}
void LinkLabel::slotClicked()
@ixxra
ixxra / gauss_parser.py
Created June 4, 2014 21:15
This is a parser for elementary operations in gaussian elimination... Currently only type 3 operations
import re
'''
gauss_parser.py
parses instructions in gaussian elimination of the form
F2 -> F2 + 3 * F1
see "parser" for a more detailed explanation.
@ixxra
ixxra / corners-distribuition.json
Created April 9, 2014 18:14
Calculation of the frequencies distribution for the corners of all paths going to the right or upwards from the bottom-left to the top-right of a regular lattice of size n x m.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ixxra
ixxra / info2meta
Created February 17, 2014 03:39
info2meta - Reads metadata information as downloaded by cd-info and writes it to flac files. See https://gist.github.com/ixxra/9044268 too
#!/usr/bin/env ruby
#
#
#info2meta
#
#Reads metadata information as downloaded by cd-info and writes it to flac files.
#I use this script together with https://gist.github.com/ixxra/9044268 to rip my
#cds into flac format.
#
@ixxra
ixxra / rip.sh
Created February 17, 2014 03:33
rip.sh - Rip a cd into flac files. It uses cd-info and gstreamer 1.0
#!/bin/bash
#
#rip.sh
#
#Rip a cd into flac files.
#
#It uses cd-info and gstreamer 1.0
#