Skip to content

Instantly share code, notes, and snippets.

View lindemann09's full-sized avatar
🐧

Oliver Lindemann lindemann09

🐧
View GitHub Profile
@lindemann09
lindemann09 / full_screen_test.py
Created May 6, 2014 07:20
pygame full screen test
import pygame
pygame.display.init()
screen_size = (pygame.display.Info().current_w,
pygame.display.Info().current_h)
pygame.display.set_mode(screen_size,
pygame.DOUBLEBUF | pygame.OPENGL | pygame.FULLSCREEN)
pygame.time.wait(2000)
pygame.quit()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from expyriment import control, design, misc, io, stimuli
def scale_to_fullscreen(visual_stimulus, exp, keep_aspect_ratio=True):
"""Scale the stimulus to fullscreen.
This is a surface operation. After this, a surface will be present!
Scaling goes along with a quality loss. Thus, scaling an already
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Operation Signs Spatial Associations.
Use arrow keys
"""
@lindemann09
lindemann09 / expyriment_picture_dict.py
Last active August 29, 2015 14:01
Dictionary of Expyriment pictures from files in a subfolder
import os as _os
def picture_dict(suffix, subfolder="", preload=False):
"""Returns a dictionary of Expyriment pictures from files in a subfolder
Returns
-------
picture_dict : dictionary
key: filename (with suffix)
value: Expyriment stimulus
@lindemann09
lindemann09 / draganddrop.py
Last active August 29, 2015 14:02
Tracking mouse trajectory
"""Drag and drop
Example how to track mouse trajectories under Expyriment by Florian Krause
"""
from expyriment import control, stimuli
control.set_develop_mode(True)
exp = control.initialize()
exp.mouse.show_cursor()
@lindemann09
lindemann09 / PGSurface.py
Last active August 29, 2015 14:03
Expyriment Stimulus for direct Pygame operations & PixelArrays
import pygame
from expyriment.stimuli import Canvas
from expyriment.stimuli._visual import Visual
def inherit_docs(cls):
for name, func in vars(cls).items():
if not func.__doc__:
for parent in cls.__bases__:
parfunc = getattr(parent, name)
if parfunc and getattr(parfunc, '__doc__', None):
import pygame
from expyriment.stimuli import Canvas
class PGSurface(Canvas):
def get_surface_copy(self):
return self._get_surface().copy()
def set_surface(self, surface):
"""surface or pixel_map"""
@lindemann09
lindemann09 / blink_demo.py
Created October 6, 2014 14:31
Expyriment: Attentional Blink Demo
@lindemann09
lindemann09 / random_matched_transitions.py
Last active August 29, 2015 14:07
get_transition_matched_sequence
"""written by O. Lindemann"""
import numpy as np
np.random.seed()
def get_transition_matched_sequence(conditions, n_transition_repetitions):
""" returns of sequences of conditions, were each transistion is balanced
"""
@lindemann09
lindemann09 / wait_callback.py
Created January 15, 2015 14:31
wait callback functions in Expyriment (0.7)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demonstration of wait callback functions in Expyriment
"""
from expyriment import control, design, misc, io, stimuli
control.defaults.quit_key = None # switch off quitting key