Module Expr Str Import alias identifier ImportFrom alias identifier FunctionDef arguments args NameParam defaults body Expr Str Import alias alias alias alias Assign NameStore Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num For NameStore NameLoad body AugAssignAdd NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str With Call NameLoad NameLoad Str NameStore body For NameStore Call AttributeLoad NameLoad attr body For NameStore NameLoad body If BoolOpAnd CompareNotEq NameLoad Str CompareNotEq NameLoad Str body Expr Yield Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num keyword Str For NameStore NameLoad body AugAssignAdd SubscriptStore NameLoad Index Call NameLoad NameLoad Num If NameLoad body Assign NameStore BinOpDiv NameLoad Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num keyword Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad BinOpAdd NameLoad NameLoad AugAssignAdd SubscriptStore NameLoad Index NameLoad Num Assign NameStore NameLoad Assign NameStore NameLoad If NameLoad body Assign NameStore BinOpDiv NameLoad Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Num NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad Call AttributeLoad Str attr Call NameLoad NameLoad NameLoad AugAssignAdd SubscriptStore NameLoad Index NameLoad Num Assign SubscriptStore NameLoad Slice Num Num SubscriptLoad NameLoad Slice Num Assign SubscriptStore NameLoad Index Num NameLoad If NameLoad body Assign NameStore BinOpDiv NameLoad Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr TupleLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr For NameStore Call NameLoad Num body For NameStore Call NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpSub NameLoad Num BinOpAdd NameLoad Num BinOpAdd Call NameLoad NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Return NameLoad decorator_list
N/A N/A Compute statistics on the digits of pi.

This uses precomputed digits of pi from the website
of Professor Yasumasa Kanada at the University of 
Tokoyo: http://www.super-computing.org/

Currently, there are only functions to read the
.txt (non-compressed, non-binary) files, but adding
support for compression and binary files would be
straightforward.

This focuses on computing the number of times that
all 1, 2, n digits sequences occur in the digits of pi.
If the digits of pi are truly random, these frequencies
should be equal.
 N/A numpy np matplotlib pyplot plt fetch_pi_file N/A N/A filename N/A N/A N/A This will download a segment of pi from super-computing.org
    if the file is not already present.
     N/A os urllib.request urllib.parse urllib.error N/A ftpdir ftp://pi.super-computing.org/.2/pi200m/ N/A N/A N/A N/A os path exists filename N/A N/A N/A N/A N/A N/A N/A urllib request urlretrieve N/A ftpdir filename filename N/A compute_one_digit_freqs N/A N/A filename N/A N/A N/A 
    Read digits of pi from a file and compute the 1 digit frequencies.
     N/A d N/A txt_file_to_digits filename N/A freqs N/A one_digit_freqs d N/A freqs N/A compute_two_digit_freqs N/A N/A filename N/A N/A N/A 
    Read digits of pi from a file and compute the 2 digit frequencies.
     N/A d N/A txt_file_to_digits filename N/A freqs N/A two_digit_freqs d N/A freqs N/A reduce_freqs N/A N/A freqlist N/A N/A N/A 
    Add up a list of freq counts to get the total counts.
     N/A allfreqs N/A N/A np zeros_like N/A freqlist N/A 0 N/A f freqlist N/A N/A allfreqs f N/A allfreqs N/A compute_n_digit_freqs N/A N/A filename n N/A N/A N/A 
    Read digits of pi from a file and compute the n digit frequencies.
     N/A d N/A txt_file_to_digits filename N/A freqs N/A n_digit_freqs d n N/A freqs N/A txt_file_to_digits N/A N/A filename the_type N/A str N/A N/A 
    Yield the digits of pi read from a .txt file.
     N/A N/A open filename r f N/A N/A line N/A N/A f readlines N/A N/A c line N/A N/A N/A N/A c N/A c N/A N/A N/A N/A the_type c N/A one_digit_freqs N/A N/A digits normalize N/A False N/A N/A 
    Consume digits of pi and compute 1 digit freq. counts.
     N/A freqs N/A N/A np zeros 10 dtype i4 N/A d digits N/A N/A N/A freqs N/A N/A int d 1 N/A normalize N/A N/A freqs N/A freqs N/A N/A freqs sum N/A freqs N/A two_digit_freqs N/A N/A digits normalize N/A False N/A N/A 
    Consume digits of pi and compute 2 digits freq. counts.
     N/A freqs N/A N/A np zeros 100 dtype i4 N/A last N/A next digits N/A this N/A next digits N/A d digits N/A N/A index N/A int N/A last this N/A N/A freqs N/A index 1 N/A last this N/A this d N/A normalize N/A N/A freqs N/A freqs N/A N/A freqs sum N/A freqs N/A n_digit_freqs N/A N/A digits n normalize N/A False N/A N/A 
    Consume digits of pi and compute n digits freq. counts.

    This should only be used for 1-6 digits.
     N/A freqs N/A N/A np zeros N/A pow 10 n dtype i4 N/A current N/A N/A np zeros n dtype int N/A i N/A range n N/A N/A N/A current N/A i N/A next digits N/A d digits N/A N/A index N/A int N/A N/A join N/A map str current N/A N/A freqs N/A index 1 N/A N/A current N/A 0 -1 N/A current N/A 1 N/A N/A current N/A -1 d N/A normalize N/A N/A freqs N/A freqs N/A N/A freqs sum N/A freqs N/A plot_two_digit_freqs N/A N/A f2 N/A N/A N/A 
    Plot two digits frequency counts using matplotlib.
     N/A f2_copy N/A N/A f2 copy N/A N/A f2_copy shape N/A 10 10 N/A ax N/A N/A plt matshow f2_copy N/A N/A N/A plt colorbar N/A i N/A range 10 N/A N/A j N/A range 10 N/A N/A N/A N/A plt text N/A i 0.2 N/A j 0.2 N/A N/A str j N/A str i N/A N/A N/A plt ylabel First digit N/A N/A N/A plt xlabel Second digit N/A ax N/A plot_one_digit_freqs N/A N/A f1 N/A N/A N/A 
    Plot one digit frequency counts using matplotlib.
     N/A ax N/A N/A plt plot f1 bo- N/A N/A N/A plt title Single digit counts in pi N/A N/A N/A plt xlabel Digit N/A N/A N/A plt ylabel Count N/A ax N/A