Skip to content

Instantly share code, notes, and snippets.

Avatar
🕟
10 minutes in

Viktor Tóth csiki

🕟
10 minutes in
View GitHub Profile
View corridor_experiment.py
import torch
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from controller.controller import Controller # hardware control code
from vizdoom import DoomGame, Button, GameVariable, ScreenFormat, ScreenResolution, AutomapMode
View corridor.c
#include "zcommon.acs"
#define KILL_REWARD 100.0
#define EXIT_REWARD 500.0
// these variables are exposed to ViZDoom
global int 0:reward;
global int 1:killCount; // number of monsters killed
global int 2:xpos; // player's position
View stupid_example.py
while y > 6:
if y == 5:
x += y*2
if x < 42:
x += y*3
View profstart.py
ProfStart('output.prof')
# ... Python code that calls C extension you intend to profile ...
ProfFlush()
ProfStop()
View setup.py
from distutils.core import setup
from Cython.Build import cythonize
setup(
name = 'gperftools_wrapped',
ext_modules = cythonize("gperftools_wrapped.pyx"),
)
View prof.py
cdef extern from "gperftools/profiler.h":
int ProfilerStart(char* fname)
void ProfilerStop()
void ProfilerFlush()
def ProfStart(fname):
return ProfilerStart(fname)
def ProfStop():
ProfilerStop()
View alpha_feature.m
function feature = alpha_feature(EEG)
% constants
alpha = 7 : 12;
left_channels = 1 : 4;
right_channels = 11 : 14;
% left mean alpha power for every channel
left_alpha_power_avg = 0;
for chan = left_channels