Download ufov
Download ufov

ufov

NAME

ufov - A program intended to exercise the brain in order to strengthen 'useful field of view', sometimes called 'speed of processing'.

SYNOPSIS


python ufov.py
from within a text terminal in a gui.
On linux, 
./ufov or 
./ufov.py should work within the executable directory.

DESCRIPTION

ufov is a program that is designed to exercise the brain and strengthen the 'useful field of view', also known as 'speed of processing'. This is reported in scientific research to have many useful (and seemingly dramatic) benefits. You can read about ufov (useful field of view) on wikipedia, https://en.wikipedia.org/wiki/Useful_field_of_view
And here is a link to the company (from that Wikipedia article), that sells programs that exercise and strengthen ufov, the programs used for the research in the field. http://www.positscience.com/why-brainhq/about-the-exercises/attention/double-decision
The research paper that brought useful field of view to my attention and triggered my interest in writing a program, http://www.eurekalert.org/pub_releases/2016-08/apa-btr072816.php
Here is an extract from that APA presentation summary.


    In addition to this meta-analysis, Edwards and her team released
    findings from their ACTIVE study, which stands for Advanced Cognitive
    Training for Independent and Vital Elderly. This study, which was
    presented last week, found that older adults' risk for dementia was
    reduced by 48 percent over 10 years when they completed 11 or mores
    sessions of this brain-training technique. Specifically, the risk of
    dementia was reduced by 8 percent for each session of speed of
    processing training completed, Edwards said.

OPTIONS

There are no command line options. All options can be set in a file named ufov.config, located either in the directory you are running the program from, ./ufov.config, or in ~/ufov.config.

The minimum screen size that works for me is

    -screen_width = 400  
    -screen_height = 300  
If you have a 720p monitor, this is the largest you can use.
    -screen_width = 1200  
    -screen_height = 700  
If you have a 1080p monitor, this is the largest you can use.
    -screen_width = 1900  
    -screen_height = 1000  
Larger monitors will work accordingly.

This sets the number of random sprites to display. The first of center or periphery to reach this number will end the game. It takes a few trials at the beginning to get used to the sprites being used and to associate the keys with them, so if you set this too low, you won't get any real practice before the program is over.

    -number_of_trials = 40

Set how likely the random center sprite will be a match for the desired center sprite.

    -center_match_likelihood = .20

Set how likely the random periphery sprite will be a match for the desired periphery sprite.

    -periphery_match_likelihood = .25

This determines how much cpu the program consumes. If your system is slow, you could lower this, but the timings will then be off. These ticks are used to measure response in msec based on 1 tick is 1 msec.

    -ticks_per_second = 1000  # 1 msec

These set the timing boundaries for how long the sprites will display, and how long before the next sprite is displayed (your response time). If you set the min and the max the same, the times will be constant.

    -min_center_ticks_per_trial = 1900
    -max_center_ticks_per_trial = 2100
    -min_center_display_ticks = 450
    -max_center_display_ticks = 550

    -min_periphery_ticks_per_trial = 1850
    -max_periphery_ticks_per_trial = 2050
    -min_periphery_display_ticks = 440
    -max_periphery_display_ticks = 540

If use_distraction is True, then random unrelated sprites will be displayed during play, with the timings set here. These are the min and max boundaries, and if the same, the distraction will appear at constant time intervals.

    -use_distraction = True  # set to False to turn it off
    -min_distraction_ticks_per_trial = 2900
    -max_distraction_ticks_per_trial = 3100
    -min_distraction_display_ticks = 550
    -max_distraction_display_ticks = 650

If use_background is True, then instead of a black background, there is the choice of a tiled background style.

    -use_background = False

The background styles are 1 for a single random full size tile everywhere, 2 for a random full size tile in each position, 4 for a single random quarter size tile everywhere, 5 for random quarter size tiles in each position, 10 for a single random tenth size tile everywhere, 11 for random tenth size tiles in each position.

    -background_style = 11

If background_erase is True, as sprites are placed in locations, they erase the original background that was there. See how well your python random number generator is working. :-) If False, then the background is constant during the duration of the game.

    -background_erase = True

This is the parent directory above the sprite directories, ufov_sprites_full, ufov_sprites_half, ufov_sprites_quarter. If it isn't correct, no sprites will be found, and the program won't run. The default is to use the current working directory.

    -base_dirname = os.getcwd ()  # default

This sets the size of sprites to use. 100 uses full size, 100 pixel square, 87 uses three quarter size, 87 pixel square, 71 uses half size, 71 pixel square, 25 uses quarter size, 50 pixel square, and 1000 uses all sizes.

    -sprite_size = 100

Show the center and periphery match sprites in text area. This is very useful because it is hard to remember the matches for the first few trials.

    -display_reminder = True

If print_stats is True, then statistics for the run will be printed on the running terminal. If show_stats is True, then statistics for the run will be shown on the ufov screen until the user dismisses them to close the program.

    -print_stats = True
    -show_stats = True

If file_append is True, then statistics for the run will be appended to the file name in file_append_name. The default is to append the statistics to the file ufov_results.txt in the directory where the ufov.py program is. It will be created if it doesn't exist. By appending, instead of writing, a record of results through time can be kept.

    -file_append = True
    -file_append_name = "ufov_results.txt"

If raw_file_append is True, then raw data for the run will be appended to the file name in raw_file_append_name. The default is to append the raw data to the file ufov_raw_results.txt in the directory where the ufov.py program is. It will be created if it doesn't exist. By appending, instead of writing, a record of results through time can be kept. The raw data gives times for each correct and incorrect response, for both the center and periphery.

    -raw_file_append = False
    -raw_file_append_name = "ufov_raw_results.txt"

If these are greater than zero, they will remove both correct and incorrect data from their respective statistics until this number of correct matches happens. So, for example, if it takes 5 displayed center matches to get 2 correct center matches, and 3 of those 5 were incorrect matches, and first_center_matches_to_discard is set to 2, then 2 correct match times, and 3 incorrect match times will be discarded from the statistics displayed. Because of screen display limitations, only the adjusted values will be displayed if show_stats is True, but both with and without ignored matches will be displayed when print_stats or file_append is True. Obviously, these have no effect if no stats are going to be displayed.

    -first_center_matches_to_discard = 2
    -first_periphery_matches_to_discard = 2

These are the parameters for the scoring algorithm. They include the weights for each component of the score, plus an estimated minimum value for the average correct time in msec. The algorithm is:

score = center_right_weight * 
     (average right time - minimum right average time estimate) 
+ center_wrong_weight * center wrong count * center wrong average time 
+ center_miss_weight * center miss count * average right time 
As you can see, it is costly to match incorrectly or miss matches, significantly more costly than correctly matching. You can change that with the numbers below. It's the same algorithm for all scores, just with different numbers plugged in. With this algorithm an excellent score would be in the 100 to 200 range. If you score there consistently, you should be adjusting the time settings so you score higher, in order to press yourself to improve. As you can see, these are floating point numbers, so you can make them numbers like 1.1 or 3.14159 or .5 if you want.
    -center_right_weight = 1.0
    -center_right_minimum = 500.
    -center_wrong_weight = 1.0
    -center_miss_weight = 1.0
    -periphery_right_weight = 1.0
    -periphery_right_minimum = 500.
    -periphery_wrong_weight = 1.0
    -periphery_miss_weight = 1.0

These select the keys that are used to indicate that a match for the desired sprite has been displayed. You can change them to whatever key you desire. For qwerty keyboards, K_f is the left index and K_j is the right index. You can find all the keys available in pygame here, http://www.pygame.org/docs/ref/key.html

    -center_key = pygame.K_f
    -periphery_key = pygame.K_j

INSTALLING

There is nothing sophisticated about the setup. Both python and pygame will need to be installed. Either python 2 or 3 will work. Then

tar -zxvf ufov.{version}.tar.gz

or

unzip ufov.{version}.zip

and cd into the resulting ufov-{version} directory.

Make any changes you desire to the ufov.config file, and run with

python ufov.py

On linux, ./ufov.py should work since the file is executable, or just ./ufov since there is a symbolic link to the executable.

RUNNING

ufov comes up into a screen showing the two sprites that you will be matching for this round, one for the center, and one for the periphery. To start the actual game, press the space bar.

Once the game is running, if you've enabled display_reminder, it shows the two sprites that are to be matched for in the text area. And sprites start appearing on, and disappearing from the screen. When you see a match for one of the match sprites, matching is accomplished by pressing a key for either the center, or the periphery. I use the left index finger for center, and the right index finger for periphery, or f and j of a qwerty keyboard respectively. But you can set them to whatever you want in the config file.

As you press a key, your response time is displayed for either center or periphery, and the color of the text is green for a correct match, or red for an incorrect match. At the end of the number of trials, if you've enabled it, the statistics are displayed, both on the screen and in the terminal, and can also optionally be written to a file. The stats screen is closed using q or space.

It's best to run the program from the directory where you installed it, since the sprite directories are located below that directory, and the config file is looked for there, as well as in home.

Since python and pygame are cross platform, this program should run on any computing device that runs python and pygame, and that has access to a text terminal in the gui. I've tried to keep things as generic as possible to enable and preserve that ability. However, I developed it on linux (Fedora 25), and tested it only on linux, so there are no guarantees.

I've never used, or even seen, the program that was used for the scientific studies. And, unlike that program, there are no double blind randomized studies confirming that ufov does anything. But it is fun to play, and it *probably* has the benefits of exercising ufov. If you want the real deal, though, you'll have to purchase the research program.

Perhaps someone will use ufov in a research study, and we can have confirmation. It should be easy enough to set up on a web server, and have study participants play the game daily, with their results recorded automatically.

And maybe not. First server is a strong advantage. Can free overcome it?

DISCUSSION

The purpose of the game is to get as many matches as possible right, with as few mismatches as possible, in the lowest average response time possible. There is a trade-off here; faster response time means less certainty due to less processing time, and thus more mismatches.

There are two ways that I see to use ufov to enhance brain functioning.

The first is true to its name. Useful field of view is seeing things without moving the eyes or head. For this, it is best to use a smaller screen size, one that a soft gaze can encompass. Maybe 700x600 or 500x600. With the larger size sprites, it is then possible to notice the matches without actively looking at them. For this purpose, it is probably best to use synchronous timings, though asynchronous will also work. As the size of the sprites decreases, this gets harder. On the quarter size sprites, with only subtle differences, it is nigh on impossible. I think, at this point, anyway. Maybe more practice and experience will push through that limitation.

The second way is completely different. Use a screen size as large as possible, vary the timings of every event, use all sizes, use background distraction, and use display times and trial times as short as possible. The goal is the same, but the strategy has to be different. Here, the eyes are constantly roving, familiar to anyone who practices defensive driving. On the road, quick glance in the rear view mirror, right ahead, left ahead, glance to left, glance to right, on the road ... It is training a different aspect of response time. Noticing the anomaly as the match, while being aware enough to catch the match in the center.

There is a scoring algorithm that attempts to combine the right matches, the wrong matches, and the missed matches into a single number that indicates performance. The lower that number, the better your performance.

EXTENDING

If you want to add more sprites, it is easily enough done. Create them and put them in the sprite directory of appropriate size. They'll be available the next time the program is run.

If you have a bunch of svg files, you can use inkscape in batch mode to convert them into png files of the desired size. Here is a bash program to do that. It requires that awk be installed for the renaming.


    #!/usr/bin/bash

    for x in *.svg
      # default background, transparent white
      do inkscape -z -f "$x" -w 100 -h 100 -j -e `echo $x | awk -F ".svg" '{print $1 "_100.png"}'`
      do inkscape -z -f "$x" -w 87 -h 87 -j -e `echo $x | awk -F ".svg" '{print $1 "_87.png"}'`
      do inkscape -z -f "$x" -w 71 -h 71 -j -e `echo $x | awk -F ".svg" '{print $1 "_71.png"}'`
      do inkscape -z -f "$x" -w 50 -h 50 -j -e `echo $x | awk -F ".svg" '{print $1 "_50.png"}'`
      # green opaque background
      #do inkscape -z -f "$x" -w 50 -h 50 -j -b "#115511" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_50.png"}'`
      #do inkscape -z -f "$x" -w 71 -h 71 -j -b "#115511" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_71.png"}'`
      #do inkscape -z -f "$x" -w 87 -h 87 -j -b "#115511" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_87.png"}'`
      #do inkscape -z -f "$x" -w 100 -h 100 -j -b "#115511" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_100.png"}'`
      # black opaque background
      #do inkscape -z -f "$x" -w 50 -h 50 -j -b "#000000" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_50.png"}'`
      #do inkscape -z -f "$x" -w 71 -h 71 -j -b "#000000" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_71.png"}'`
      #do inkscape -z -f "$x" -w 87 -h 87 -j -b "#000000" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_87.png"}'`
      #do inkscape -z -f "$x" -w 100 -h 100 -j -b "#000000" -y 255 -e `echo $x | awk -F ".svg" '{print $1 "_100.png"}'`
    done                     
 

If you have a bunch of png files, you can use mogrify from ImageMagick to convert them into png files of the desired size. Here is the command to do that. This command is destructive, as it overwrites the original file, so if you want to keep the originals, copy them into another directory where you will apply the conversion.


    mogrify -resize 50x50! *.png

If you want to add a completely new size, it will take some coding, unless you mix it with an existing size. From a purist point of view, that would be wrong, but should work with the side effect of being unable to isolate the two sizes. The program will not work properly if you use sprite sizes larger than 100x100.

PUBLICATION RULES

ufov is original code, and can be modified and used at will by any user, provided that:

a) The original copyright notices are maintained and that the source, including all modifications, is made publically available at the time of any derived publication. This is open source software according to the precepts and spirit of the Gnu Public License. See the accompanying file COPYING, which also must accompany any redistribution.

b) Full responsibility for the accuracy, suitability, and effectiveness of the program rests with the users and/or modifiers.

THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

ACKNOWLEDGEMENTS

This program uses the research in useful field of view of Dr. Karlene Ball of the University of Birmingham, Alabama, and Dr. Daniel Roenker of Western Kentucky University as its inspiration.

The sprites used were acquired from https://openclipart.org/
and http://brainworkshop.sourceforge.net/

The python project, https://www.python.org/

The pygame project, http://www.pygame.org/hifi.html

The SDL project, https://www.libsdl.org/

And the cast of thousands that created the open source ecology.

COPYRIGHT

Copyright 2016-2017 Stan Lysiak

GPL 3; see the file COPYING that accompanies the source of this program. This is the "standard Gnu General Public License version 3 or any later version"