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)¶ 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.
byte2unicode
(s, fse=False)¶
-
expyriment.misc.
compare_codes
(input_code, standard_codes, bitwise_comparison=True)¶ 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.
create_colours
(amount)¶ Create different and equally spaced RGB colours.
Parameters: amount : int
the number of colours to create
Returns: colours : list
a list of colours, each in the form [r, g, b]
-
expyriment.misc.
find_font
(font)¶ 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_experiment_secure_hash
()¶ Returns the fingerprint, that is, the first six places of the secure hash (sha1) of the main file of the current experiment.
Returns: hash: string or None
first six places of the experiment secure hash or None, if no main file can be found
Notes
Fingerprints of experiments help to ensure that the correct version is running in the lab. Hash codes are written to all output files and printed in the command line output. If you want to check post hoc the version of your experiment, create the secure hash (sha1) of your expyriment .py-file and compare the first six place with the code in the output file.
-
expyriment.misc.
get_module_hash_dictionary
()¶ Returns a dictionary with the fingerprints of all modules imported from the local folded.
Returns: hashes: dict
hash dict with all imported modules keys = file names, values = sha hashes
Notes
See get_experiment_secure_hash() for further information about Expyriment secure hashes.
-
expyriment.misc.
get_monitor_resolution
()¶ Returns the monitor resolution
Returns: resolution: (int, int)
monitor resolution, screen resolution
-
expyriment.misc.
get_system_info
(as_string=False)¶ Print system information to standard out and return as a dictionary.
Parameters: as_string : boolean, optional
Print as string instead of dict (default = False)
-
expyriment.misc.
has_internet_connection
()¶ Return True if computer is connected to internet.
-
expyriment.misc.
is_android_running
()¶ Return True if Exypriment runs on Android.
-
expyriment.misc.
is_idle_running
()¶ Return True if IDLE is running.
-
expyriment.misc.
is_interactive_mode
()¶ Returns if Python is running in interactive mode (such as IDLE or IPthon)
Returns: interactive_mode : boolean
-
expyriment.misc.
is_ipython_running
()¶ Return True if IPython is running.
-
expyriment.misc.
list_fonts
()¶ 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.
module_hashes_as_string
()¶ helper function that converts dict to str
-
expyriment.misc.
numpad_digit_code2ascii
(keycode)¶ 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.
unicode2byte
(u, fse=False)¶
-
expyriment.misc.
which
(programme)¶ Locate a programme file in the user’s path.
This mimics behaviour of UNIC ‘which’ command.
Parameters: programme : str
the programme to file to locate
Returns: path : str or None
the full path to the programme file or None if not found