This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sqlite3 | |
DB_NAME = 'comptage.db' | |
def create_base(): | |
conn = sqlite3.connect(DB_NAME) | |
c = conn.cursor() | |
c.execute("""CREATE TABLE IF NOT EXISTS compte ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Tkinter as tk | |
from comptage_sql import * | |
def format_row(t): | |
return "ID: {}, {}, {}-{}".format( | |
t[0], "HOMME" if not t[1] else "FEMME", | |
t[2], t[2] + 10) | |
def onselect(evt): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Discrete Fourier Transform | |
""" | |
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
N = 200 #sample size | |
x = np.cos(range(N)) #create a periodic cyclic function | |
r = np.random.random(N) #create some noise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
from skvideo.io import vreader | |
VIDEO_PATH = "room.mp4" #my room where i'm moving and i want to remove myself to get only the background... | |
cap = vreader(VIDEO_PATH) | |
L = list(cap) | |
L = map(lambda img: cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), L) #to gray scale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
NB_STATES = input("nb autocollants a collectionner : ") | |
PROBA = input("probaabilite minimale 'to catch them all' : ") #0.95 par example | |
#transition matrix | |
states = np.zeros((NB_STATES, NB_STATES)) | |
#setting tranition probability | |
for i in range(NB_STATES): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class State: | |
state_id_counter = 0 | |
def __init__(self, initial=False, final=False): | |
#setting an unique id | |
self.id = State.state_id_counter | |
State.state_id_counter += 1 | |
#setting params | |
self.initial = initial | |
self.final = final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
from psonic import * | |
#random major scale chord progression from the transitions allowed by: | |
#http://www.dummies.com/art-center/music/major-and-minor-chord-progressions-for-music-composition/ | |
def get_major_chord(base_note): | |
"""Take the base note and return a list of 3 notes in | |
the root position of the major chord of the base note. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from random import * | |
def euclidian(v1, v2): | |
return (sum((v1 - v2) ** 2)) ** .5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gc | |
import os | |
import time | |
import pickle | |
import psutil | |
import pathlib | |
import threading | |
from dataclasses import dataclass, field | |
from typing import Any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gc | |
import os | |
import re | |
import time | |
import types | |
import pickle | |
import psutil | |
import pathlib | |
import threading |
OlderNewer