expyriment.misc¶
The misc package.
This package contains miscellaneous classes, modules and functions.
See also expyriment.misc.extras for more misc.
Modules¶
Classes¶
Functions¶
-
expyriment.misc.
add_fonts
(folder)[source]¶ Add fonts to Expyriment.
All truetype fonts found in the given folder will be added to Expyriment, such that they are found when only giving their name (i.e. without the full path).
Parameters: folder : str or unicode
the full path to the folder to search for
-
expyriment.misc.
compare_codes
(input_code, standard_codes, bitwise_comparison=True)[source]¶ Helper function to compare input_code with a standard codes.
Returns a boolean and operates by default bitwise.
Parameters: input_code : int
code or bitpattern
standard_codes : int or list
code/bitpattern or list of codes/bitpattern
bitwise_comparison : bool, optional
(default = True)
-
expyriment.misc.
find_font
(font)[source]¶ Find an installed font given a font name.
This will try to match a font installed on the system that is similar to the given font name.
Parameters: font : str
name of the font
Returns: font : str
the font that is most similar If no font is found, an empty string will be returned.
-
expyriment.misc.
get_monitor_resolution
()[source]¶ Returns the monitor resolution
Returns: resolution: (int, int) :
monitor resolution, screen resolution
-
expyriment.misc.
list_fonts
()[source]¶ List all fonts installed on the system.
Returns a dictionary where the key is the font name and the value is the absolute path to the font file.
-
expyriment.misc.
numpad_digit_code2ascii
(keycode)[source]¶ Convert numpad keycode to the ascii code of that particular number
If it is not a keypad digit code, no convertion takes place and the same code will be returned.
Returns: ascii_code : int
-
expyriment.misc.
str2unicode
(s, fse=False)[source]¶ Convert str to unicode.
Converts an input str or unicode object to a unicode object without throwing an exception. If fse is False, the first encoding that is tried is the encoding according to the locale settings, falling back to utf-8 encoding if this throws an error. If fse is True, the filesystem encoding is tried, falling back to utf-8. Unicode input objects are return unmodified.
Parameters: s : str or unicode
input text
fse : bool
indicates whether the filesystem encoding should be tried first. (default = False)
Returns: A unicode-type string. :
-
expyriment.misc.
unicode2str
(u, fse=False)[source]¶ Convert unicode to str.
Converts an input str or unicode object to a str object without throwing an exception. If fse is False, the str is encoded according to the locale (with utf-8 as a fallback), otherwise it is encoded with the filesystemencoding. Str input objects are return unmodified.
Parameters: u : str or unicode
input text :
fse : bool
indicates whether the filesystem encoding should used. :
(default = False) :
Returns: A str-type string. :