skip to navigation
skip to content

PyCogWorks 0.3.0

Miscellaneous functions used in the CogWorks lab.

Latest Version: 0.3.1

pycogworks is a Python package with miscellaneous functions used in the CogWorks lab.


pycogworks can be installed using ‘pip’.

# pip install pycogworks


pycogworks has the following dependencies:

GUI Functions


Creates a GUI dialog to collect subject information. The default dialog collects subjects first name, last name and RIN. Additional fields can be collected by passing an array of field names to getSubjectInfo. getSubjectInfo returns a dict of subject information where the keys are the field names converted to lower case and spaces replaced with underscores. The RIN field is automatically encrypted using pycogworks.rin2id and stored in the ‘encrypted_rin’ field.

>>> getSubjectInfo(["Age"])
{'rin': u'123456789', 'first_name': u'Foo', 'last_name': u'Bar', 'age': u'18'}

Logging Functions


Returns the most accurate timestamp possible for the current OS.

>>> get_time()


Generates a date/time stamp usefull in logs and for log filenames.

>>> getDateTimeStamp()


Generates an encrypted id from a 9 digit RIN.

>>> rin2id(123456789)
>>> rin2id('123456789')


Takes a dict of subject information and writes a history file. The subject information dict must contain a field called ‘rin’ with a value that contains a valid 9 digit RIN. If the subject information dict does not already contain an ‘encrypted_rin’ field, the RIN will be enrypted and added to the subject information dict under the field ‘encrypted_rin’. The subject information dict is then encoded as a JSON string and written to a file.

>>> writeHistoryFile("test.history",{"foo":"bar","rin":"123456789"})
# cat test.history
  "cipher": "AES/CBC (RIJNDAEL) - 16Byte Key",
  "encrypted_rin": "300fe9abdca99d4a32cb2c43f2a69c5c",
  "foo": "bar",
  "rin": "123456789"
File Type Py Version Uploaded on Size
PyCogWorks-0.3.0.tar.gz (md5) Source 2012-10-02 11KB
  • Downloads (All Versions):
  • 7 downloads in the last day
  • 117 downloads in the last week
  • 541 downloads in the last month