A small Python script for number memory training (WARNING: Long post!)

4 posts / 0 new
Last post
#1 28 February, 2016 - 15:42
Offline
Joined: 2 years 3 months ago

A small Python script for number memory training (WARNING: Long post!)


Hey!

I would like to begin practicing with an incomplete 00-99 number system I am devising, but it is cumbersome to do so.

The thing is: how to generate random sets of numbers relative to my complex images using only the numbers found in my incomplete system?

For instance, assuming my system is a 2-digit PAO (which it's not), I want to easily generate a sequence of 6 digits such as 4 2 9 8 2 6, so that I can mentally turn it into 42-98-26 and then into my P-A-O image. I'd also like to generate these sequences using only the numbers that I currently have in my system. Well, I think you get the problem.

With that in mind, I began making a Python script both with the intention of solving my problem and learning Python. After a 3-day struggle, I ended up with a huge Frankenstein of a program that, nevertheless, works. I would like to share it with you guys with the (very optimistic) hope that at least one of you might find it useful (in the even more optimistic hope that any of you will ever make it to the end of this post). It is geared towards the beginners, but I think the experienced ones might profit from it too, specially if they are creative with respect to their training.

All you need to run the program is to save it at a given directory and run it from within that directory by opening a terminal and typing the command 'python randNum.py', assuming you have Python 2 installed, of course. I use a Mac, so I am not sure if it is perfectly cross-platform, but it should be (follow the link above to download the program from Dropbox, as well as the accompanying example files).

I made some screenshots that might illustrate the main functionalities:

1 - This is the default output if no arguments are used: simply a 15 by 40 grid of random digits.

1_normal_grid.png

2 - By adding the -f flag and a file with numbers, you can restrict your grid to only the desired numbers. As you can see in the bottom of the figure, the example file I used has a header (that can be anything or even not exist) and one number in each row. This format was used because I imagine you guys who have developed number systems store them in a spreadsheet, so all you need to do is export the appropriate column as a .csv file.

2_selected_grid.png

3 - You can set different sampling probabilities for each number by using the -p flag and a file with numbers and probabilities. This is useful to cram numbers that are giving you trouble. Again, the header of this file can be anything, but the numbers should be in the first column. As you can see, the grid is almost composed by 50s, because the file sets a probability for 50 ten times larger than for any other number.

3_selected_with_prob_grid.png

4 - This is just to show you can easily change the grid size by using the -g flag accompanied by the number of line and columns, respectively.

4_custom_grid.png

5 - This is something that I think is very useful for beginners like me. You can change the display separation among the digits in the output. Here, you can see something important about the program: it "sees" NUMBERS internally, not DIGITS.

5_separations.png

5.1 - The first command displays 36 numbers. Because the default of the program is a 2-digit PAO, you have 72 digits as output.

5.2 - The second command makes that clear by using the -s flag to set the separation in "number mode". Now, you see that the sequence of digits is actually a sequence of 2-digit numbers (note that the sequence changes at each new command because it is random, as you know).

5.3 - We can further make it easier for us beginners by separating the output for each image. A 2-digit PAO combines three 2-digit numbers in a single complex image, so that's what you see in the third output.

5.4 - Finally, if you want to place, say, 2 complex images in the same locus, you can visualize it using the "loci mode" and the -l flag accompanied by 2.

6 - Range and "without replacement" flags:

6_range_and_replacement.png

6.1 - For the experts among you, you can set the system to a millennium 3-digit system by either supplying the appropriate number file or by using the -N flag. This flag sets the number population as all the numbers from 0 to N. If N is 999 then you have a millennium system. Don't worry, because the system turns 0 into 000 accordingly.

6.2 - By using the -W flag, we disallow replacement, meaning that there will be no repetitions of numbers. As an example, the second command attempts to generate 36 numbers, but the range is from 00 to 19, so only 20 numbers are provided, and with no repetition.

6.3 - In contrast, by not using this flag, you can have all the numbers you want, but there will be repetitions. This flag is useful for beginners to practice their entire system in as few runs as possible.

7 - Also for poor beginners like me, we can use the -d flag to provide a description file. When you do this, the program quizzes you on a single complex image at a time and shows the corresponding descriptions of individual images (e.g. person, action and object in a PAO system).

7_descriptions.png

7.1 - The first command provides nothing useful, because the input file used has very limited descriptions.

7.2 - This 'cat' command was used here just to show you guys the input description file: there are only descriptions for numbers 01 and 50. This explains the "No descriptions' warnings, since we allowed the system to sample all numbers from 00 to 99 (the default), most of which don't have descriptions.
As you can see, the header now is important for us to know which categories of individual images are merged to form each complex image (not all system are PAO, you know). Again, this format was used having .csv files in mind. NOTE: I was low on imagination for actions and objects :)

7.3 - This second 'cat' command shows the contents of the input data file that we will use now, which will restrict widely the possible list of numbers to be sampled, thus, allowing some descriptions to appear.

7.4 - Now, as you can see, there are descriptions for the person and the action, but still not for the object, because there are no descriptions for 44.

8 - Finally, we can use an in-built metronome by setting the -m flag. The command shown in the figure generated 5 complex PAO images displayed with 2 seconds in-between them. This is to show that experts can use the program too :)

8_metronome.png

9 - This is just to show that for mortals like me, we can still display one image at a time by setting the first value of the -m flag to zero. We can also keep showing the descriptions while using the metronome.

9_manual.png

Well guys, that's it. I am terribly sorry for this very long e-mail, but I had no idea how to make it shorter and I wanted to share it with you.

I hope the programmers around won't make fun of my programming skills when looking at the code. Please, modify it the way you like and, if possible, tell me where I could make it better. If any of you find it useful somehow, I'd love to hear your feedback, suggestions, complaints, whatever.

Best!
Tammish.

P.S.: I was forgetting: just run the program with the -h flag to see the help.

28 February, 2016 - 17:56
Offline
Joined: 2 years 8 months ago

Nice... I just tried running it on Linux, but the script is trying to grab my mouse cursor and then it exits. I'll take a closer look later.

29 February, 2016 - 04:20
Offline
Joined: 2 years 3 months ago

Bummer... I knew problems would occur, but I thought that at least on Unix-based systems, it would work.

Quote:
the script is trying to grab my mouse cursor

I guess I did create a Frankenstein monster, didn't I? :)

I am sure you are much better than I am in programming, but if I can help in anything to make it work, please don't hesitate to tell me how.

Best!
Tammish.

29 February, 2016 - 11:58
Offline
Joined: 2 years 8 months ago

I didn't see where it's trying to grab the cursor, but I'll be able to look more closely later. :)

Download our free ebook! Just click the "Sign up" button below to create an account, and we'll send you a free ebook with tips on how to get started.

Related content: