@jfkominsky jfkominsky released this Dec 4, 2018 · 13 commits to master since this release

Assets 2

Fixing audio doubling in 0.6.3 introduced a bug where PyHab no longer looped video within a trial basically because I forgot to re-add a line of code or forgot to sync it before putting out the last release. This patch just fixes that, but it's an important fix!

Also fixes a counter-intuitive behavior with minimum on-time of 0 (it now acts like it has no minimum on-time, whereas before you will still have to press gaze-on at least once).

This version is fully backwards-compatible with any experiment made with any v0.6 build, just copy the "PyHabBuilder", "PyHabClass", and "PyHabClassPL" files into the PyHab folder of any experiment you've already made and it should all work.

As ever, please join the mailing list for the latest updates!

@jfkominsky jfkominsky released this Nov 19, 2018 · 19 commits to master since this release

Assets 2

A few new features and some under-the-hood tune-ups, and an updated manual. This version is fully backwards-compatible with any experiment made with v0.6 and v0.6.1-2, just copy the "PyHabBuilder", "PyHabClass", and "PyHabClassPL" files to the PyHab folder of any previously made experiment and you will get all the new features.

As ever, please join the mailing list for the latest updates!


  • More information and control over the end of the experiment: Previously, when the last trial ended, the program would simply quit, and the experiment display would revert to desktop. Now, the experimenter window will tell you when it is saving the data from that run, and when it is finished it will tell you and prompt you to press a key to close the stimulus and coder windows. Not only does this tell you when your data have been safely saved, if part of your methods involves some kind of infant behavior after stimulus presentation, you can now ensure that the infant won't be distracted by the screen reverting to your desktop.

  • Customizable start and end of experiment displays: You can now select images to appear on the stimulus display before the first trial and after the end of the experiment. Previously, before the first trial, the stimulus display would simply be blank, so the infant had no reason to pay attention to the screen until the first trial started. Now you can (optionally) add an image that will appear on the screen until the first trial starts, and another image (or the same image) to appear on the stimulus display after the last trial ends. Good for standardizing infant experiences across labs, removes any variance from different desktop backgrounds. You set this up in the builder, see the manual for details.

  • Optional experimenter notification that next trial must be started manually: There is now an option that can be turned on in the builder to make the whole coder window flash to let you know that the previous trial has ended and you can start the attention-getter for the next trial. This means that as long as the coder window is in your peripheral vision when you are looking at whatever screen you are using that shows the infant, you will know when you need to start the next trial. Some labs reported that it was easy to miss the end of the previous trial and so leave a blank screen for longer than intended, so this is designed to address that.

Under the hood

  • Even more reliable save behavior on Windows: Saving condition files was occasionally problematic, even after the changes in 0.6.2. This has been fixed.

  • Warnings about adding trial types after making conditions: If you made conditions and then added a new trial type, but didn't update your conditions, the experiment would break. The builder now warns you to update your condition files if you create a new trial type after making conditions.

@jfkominsky jfkominsky released this Oct 27, 2018 · 28 commits to master since this release

Assets 2

This fixes a lot of important bugs on Windows machines in particular

Four major bugs have been fixed:

  • Windows save behavior: Previously unreliable, would occasionally crash or save incomplete files, and slow besides. This should no longer be an issue. Saving should now be faster and much more reliable on Windows and no different on Mac.

  • Phantom audio: In certain cases, the audio would start playing before the video should have started playing, or would play again and double-up over the next trial. While this behavior was relatively uncommon, and seems to be specific to certain video codecs, I have found a way to make it MUCH less common (hopefully nonexistant!). One fix involved reloading a movie file entirely when redoing a trial - this may cause slowdowns when redoing the last trial or last set of trials. There may also be some odd behavior when redoing block of auto-advancing trials that are all movies, but I haven't pinned it down yet. That is a very specific edge case, and I'll get it soon.

  • Redoing auto-advancing trials: Separately from the above, when redoing multiple trials that auto-advance together, it would occasionally land on the wrong stimuli. Now it always get the right one.

  • Transferring experiments between Windows and Mac: There were issues that would cause experiments that were made in one operating system to fail on the other. That should no longer happen, at least not for that reason. Now, if it fails, it's probably because of issues with either video encoding or memory capacity (Running PyHab with stimuli on Windows uses a lot more RAM than on Mac for some reason).

You should be able to simply replace the contents of the "PyHab" files in existing experiment folders to take advantage of the new upgrades, with no major changes in functionality.

Assets 2

Some minor bug fixes and a handy new condition randomization feature for creating blinded randomization. You can simply replace the PyHabBuilder.py and PyHabClass.py files in any existing experiment and it will work fine. Most of the changes are to the builder.

Bug fixes:

  • Setting screen index in the builder now works properly
  • Attention-getter settings now display properly in the builder and work as intended. Previously, if you set a trial type to have no attention-getter, next time you opened that trial type's settings it would revert to default. It now correctly remembers when you want a trial type to have no attention-getter.


  • New condition randomization system allows users to create random condition for each subject without having to do it manually. The user manual has been updated with information about how to do this.
  • Experimenter blinding options in universal settings now have proper text descriptions, functionality unchanged.

@jfkominsky jfkominsky released this Sep 13, 2018 · 39 commits to master since this release

Assets 2

A big upgrade that most users won't notice. This version has a bunch of under-the-hood changes to make it easer to modify PyHab further in the future. It does include some new functionality and a handful of bug fixes. Most exciting, it has automated testing of many functions, meaning that it will be easier for me to catch bugs before they are released in the future! This has already payed off, there are some issues that I caught in preferential looking thanks to these tests, and they helped me make PyHab compatible with Python 3.

v0.6 is compatible with experiments made in v0.5, simply replace the contents of the "PyHab" folder of your experiment with the contents of the PyHab folder in this download. However, there are some functional changes! Read through those changes below to see if they affect your experiment, and decide if you want to change its behavior.


  • The builder now supports an unlimited number of trials in the study flow, and will render up to 40. Past 40, it will put a counter that tells you how many trials are not rendered.
  • There is now a visual marker for auto-advance trials in the study flow: They are directly adjacent to the trial that precedes them, instead of there being a gap as there normally is. This will help you better visualize exactly what your study flow will be.
  • Color/trial type associations are now fixed within a single session of the builder. They may change between sessions if you close and re-open the builder, but whatever color is assigned to a trial type will be that trial type’s color until you close the builder, in both the type palette and the flow.


  • Redoing trials has been changed. When you redo a trial, by hitting “R” during a time between trials, PyHab will now go back to the last non-auto-advancing trial. For example, say you have trial types A and B, and B is an auto-advance trial, and you have the study flow A-B-A-B. So, after each A, B immediately starts. If you hit R after the first AB pair, before you start the second A, you will now go back to before the first A, and the first A and the first B will be flagged as bad trials in the data. Under the old behavior, it would have just redone the B trial, but not the A trial.
  • Note: The bad trials will be ordered by trial number, so in your data file it would have A (bad) A (good) B (bad) B (good) even though the actual order of running was AB(bad) AB(good).
  • Habituation trials are no longer restricted to a single stimulus, and will cycle through all stimuli assigned to that trial type the same way other trial types do. You can still use the condition settings to limit how many stimuli are available for a given participant.
  • The “insert habituation trial” and “jump to test trial” functions (I and J keys respectively) now work properly with Hab meta-trials and in general. If you are using a meta-trial, you can now jump from either a hab trial or any sub-trial in a hab meta-trial. When you insert a hab trial, it now inserts a full hab meta-trial. Best of all, it now correctly finds and loads any stimuli that need to be added for an inserted trial.
  • It is no longer possible to overwrite existing data files by accident. Now, if there is already a data file with the same subject number and ID, PyHab will create a data file with a number after the subject ID (so if there was already a 999_asdf, it will create 999_asdf2).

Preferential looking studies:

  • The preferential looking version is now closely tied to the base version and only replaces a handful of functions, so all of the above changes apply to preferential looking as well.

Full patch notes:


  • Text scaling has been tuned so that labels are more likely to stay in their boxes. Long all-caps labels will still be a little too wide for their box, unfortunately.
  • Fixed a crash when trying to display a warning about naming trial types.


  • The changes to redoing trials also uncovered a bunch of issues with redoing trials! PyHab now correctly selects which stimuli to display and updates all data files appropriately.
  • Aborting trials in progress would also fail to present the correct stimuli. They now do.
  • There were issues with PyHab figuring out what the name of the current stimulus file was. The process has been fixed, which also fixed a bunch of other downstream bugs involving selecting stimuli (see above), recording the correct stimulus name in the data file, etc.
  • The biggest bug associated with the stimulus name issue was a crash that could occur if you had more than 2x as many trial repetitions as there were stimuli for a given trial type. That is fixed.
  • PyHab no longer puts a blank frame in-between trials when auto-advancing. The transition is now seamless.
  • Fixed a crash when inserting hab trials during stimulus presentation, as part of rework of insert hab trial functionality.

Preferential looking:

  • All of the bugs described for single-target studies have been fixed for preferential looking studies as well.
  • There was an issue where trials would not end properly if the “end only on movie end” option was selected and the movie ran longer than maxDur for that trial, but only for preferential looking studies. This has been fixed.
  • Fixed an issue that would stop preferential looking studies from working in Python3.


  • Unit testing and Travis-CI integration! Not all functions can be tested because of issues mimicking input, but any function that can be tested without waiting for a keypress now is.
  • PyHab as a whole is now much more modular and has better code hygiene in general. This should make it easier to modify in the future, and easier for other contributors to change things.
  • PyHab is now confirmed compatible with both Python2 and Python3 versions of PyHab.


  • The study flow now refreshes completely every time you update a trial type.


  • The way verbose data is stored during a run has been changed to a dict of lists of dicts. This allows for certain functions, notably redotrial, to be shared between single-target and preferential-looking experiments by cycling through all the verbose data structures procedurally.
  • There are several new functions, jumpToTest, insertHab, and redoSetup, each of which takes something that was repeated in the doExperiment loop and modularizes it, making it easier to test and easier to modify. Documentation updated to match.
  • CheckStop (which is used to set and check against habituation criteria) has been changed to no longer require arguments, since I realized all of its arguments were available as global variables.


  • redoTrial has been removed because the new data structure has allowed the base version to cover both single target and preferential looking.
  • All of the changes to CheckStop and Redo have been modified in PL as well.
  • Changed how PL imports PyHab to make it Python3 compatible.

@jfkominsky jfkominsky released this Jul 24, 2018 · 76 commits to master since this release

Assets 2

Two little builder bugs that are both important:

  • One bug meant that it would not successfully save the data settings for Preferential Looking studies. You would still get correct Verbose data files, but the summary data files would be incorrect. This has been fixed.**
  • If you deleted a trial type and it changed the colors of the other trial types (by re-ordering them), previously it would not update those colors in the study flow as well. Now it does. In a future update, the colors will remain constant.

**If you have been using v0.5.3, you can update any existing preferential looking experiments you have made with the following steps:

  1. Copy the PyHabBuilder.py file from the PyHab folder in this download to the PyHab folder in your experiment folder, replacing the one that is currently there.

  2. Launch your experiment from the launcher and open the builder (go to "Builder" instead of "Run")

  3. Open the data settings (bottom-left white button in the builder) and make sure all the columns you want to appear in the summary data file. Hit OK when done.

  4. Save your study again from the builder

This should update the settings for your study such that it now records the summary data files correctly.

@jfkominsky jfkominsky released this Jul 11, 2018 · 77 commits to master since this release

Assets 2

Right now a little bit too much code is redundant between the base version and the preferential looking version, so sometimes when I fix something in the base version I forget to fix it in the preferential looking version. I'm working in a direction that will remove that problem soon. Until then, bug fixes!

Good news again is that you can simply replace the PyHabPL file in any existing experiments made with an earlier version of v0.5 and it should work, just better.

  • Fixed a bug with stimulus presentation for non-movie stimuli.
  • Fixed a bug with outdated code for loading stimuli.
  • Fixed a bug with a redundant call to record data.

@jfkominsky jfkominsky released this Jun 26, 2018 · 79 commits to master since this release

Assets 2
  • Fixed a bug loading stimuli for habituation blocks
  • Fixed a crash bug with trial types that cycle through all of their videos more than twice
  • Fixed the "Jump to test trial" functionality for Hab meta-trials
  • Fixed a builder bug when turning off the "use conditions" option.

@jfkominsky jfkominsky released this Jun 23, 2018 · 100 commits to master since this release

Assets 2

A massive upgrade!

  • Multiple stimulus types! Images, audio, and more.
  • Changed how stimuli work in the builder. You now create an experiment-wide stimulus library and then assign files from that library to your stimulus type.
  • Customizable attention-getters! Use your own movie file or procedurally generated shapes.
  • Attention-getters can be selected trial-by-trial.
  • Looking-time criteria can be set trial-by-trial.
  • You can now set background color for the stimulus window.
  • More ways to calculate habituation criteria, including moving-peak criteria and fixed-window evaluation.
  • Much better code documentation (and ReadTheDocs integration)
  • Lots of under-the-hood changes to make it cleaner, more modular, and more reliable whenever possible.

Bug fixes from v0.5:

  • Crashes on non-stimulus-presentation runs of trial types that have no attention-getter have been fixed.
  • Habituation calculation for preferential looking designs was not updated to incorporate new habituation settings.
  • Added new habituation criterion calculation: "Max". Set criterion based on the hab trials with the longest looking time, whether they are contiguous or not.
Jun 22, 2018


Updating documentation
Getting ReadTheDocs to work, adding ReadTheDocs to non-programmer