Skip to content

Commit aa2a303

Browse files
Sheppard, KevinSheppard, Kevin
authored andcommitted
DOC: Improve documentation
Improve documentation appearance Fix setup to not cythonize when run with clean
1 parent c9c9935 commit aa2a303

File tree

9 files changed

+60
-30
lines changed

9 files changed

+60
-30
lines changed

doc/source/_static/style-changes.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
a{color: #180CD2;}
2-
table a:not(.btn), .table a:not(.btn) {text-decoration: none;}
2+
table a:not(.btn), .table a:not(.btn) {text-decoration: none;}
3+
body {font-size: 16px;}
4+
code {font-size: 100%;}
5+
table {font-size: 16px;}
6+
.navbar {font-size: 16px;}
7+
.navbar .dropdown-menu > li > a, .navbar .dropdown-menu > li > a:focus {font-size: 15px;}

doc/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@
129129
# Theme options are theme-specific and customize the look and feel of a theme
130130
# further. For a list of options available for each theme, see the
131131
# documentation.
132-
html_theme_options = {'bootswatch_theme': 'flatly'}
132+
html_theme_options = {'bootswatch_theme': 'yeti',
133+
# Render the next and previous page links in navbar. (Default: true)
134+
'navbar_sidebarrel': False,}
133135

134136
# Add any paths that contain custom themes here, relative to this directory.
135137
#html_theme_path = []

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ RandomState Pseudo Random Number Generator Documentation:
6868
PCG-64 <pcg64>
6969
MLFG <mlfg>
7070
MRG32K3A <mrg32k3a>
71-
Readying System Entropy <entropy>
71+
Reading System Entropy <entropy>
7272

7373

7474
Indices and tables

randomstate/shims/mlfg-1279-861/mlfg-1279-861.pxi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ cdef object _set_state(aug_state *state, object state_info):
5050
DEF CLASS_DOCSTRING = """
5151
RandomState(seed=None)
5252
53-
Container for a multiplicative lagged fibonacci generator (MLFG).
53+
Container for a Multiplicative Lagged Fibonacci Generator (MLFG).
5454
55-
MLFG(1279, 861, \*) is a 64-bit implementation of a MLFG that uses lags 1279 and
55+
LFG(1279, 861, \*) is a 64-bit implementation of a MLFG that uses lags 1279 and
5656
861 where random numbers are determined by
5757
5858
.. math::

randomstate/shims/pcg-32/pcg-32.pxi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ The state of the PCG-32 PRNG is represented by 2 64-bit unsigned integers.
8585
8686
See pcg64 for a similar implementation with a larger period.
8787
88-
** Parallel Features **
88+
**Parallel Features**
8989
9090
``pcg32.RandomState`` can be used in parallel applications in one of two ways.
9191
The preferable method is to use sub-streams, which are generated by using the
92-
same value in the first position of the seed and incrementing the second value.
92+
same value of ``seed`` and incrementing the second value, ``inc``.
9393
9494
>>> import randomstate.prng.pcg32 as rnd
9595
>>> rs = [rng.RandomState(1234, i + 1) for i in range(10)]
9696
97-
The alternative method is to use a single RandomState and advance to get
98-
non-overlapping sequences.
97+
The alternative method is to call ``advance`` on a single RandomState to
98+
produce non-overlapping sequences.
9999
100100
>>> import randomstate.prng.pcg32 as rnd
101101
>>> rs = [rng.RandomState(1234, 1) for _ in range(10)]
102102
>>> for i in range(10):
103-
rs[i].advance(2**32)
103+
rs[i].advance(i * 2**32)
104104
105105
*Note*: Due to the limited period of ``pcg32.RandomState`` using ``advance``
106106
in parallel applications is not recommended.

randomstate/shims/pcg-64/pcg-64-docstring.pxi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,22 @@ The state of the PCG-64 PRNG is represented by 2 128-bit unsigned integers.
4545
4646
See pcg32 for a similar implementation with a smaller period.
4747
48-
** Parallel Features **
48+
**Parallel Features**
4949
5050
``pcg64.RandomState`` can be used in parallel applications in one of two ways.
5151
The preferable method is to use sub-streams, which are generated by using the
52-
same value in the first position of the seed and incrementing the second value.
52+
same value of ``seed`` and incrementing the second value, ``inc``.
5353
5454
>>> import randomstate.prng.pcg64 as rnd
5555
>>> rs = [rng.RandomState(1234, i + 1) for i in range(10)]
5656
57-
The alternative method is to use a single RandomState and advance to get
58-
non-overlapping sequences.
57+
The alternative method is to call ``advance`` on a single RandomState to
58+
produce non-overlapping sequences.
5959
6060
>>> import randomstate.prng.pcg64 as rnd
6161
>>> rs = [rng.RandomState(1234, 1) for _ in range(10)]
6262
>>> for i in range(10):
63-
rs[i].advance(2**32)
63+
rs[i].advance(i * 2**64)
6464
6565
References
6666
----------

randomstate/shims/xorshift1024/xorshift1024.pxi

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ RandomState(seed=None)
5454
Container for the xorshift1024* pseudo random number generator.
5555
5656
xorshift1024* is a 64-bit implementation of Saito and Matsumoto's XSadd
57-
generator [1]_. xorshift1024* has a period of 2**1024 - 1 and supports jumping
58-
the sequence in increments of 2**512, which allow multiple non-overlapping
59-
sequences to be generated.
57+
generator [1]_,[2]_,[3]_,[4]_. xorshift1024* has a period of 2**1024 - 1 and
58+
supports jumping the sequence in increments of 2**512, which allow multiple
59+
non-overlapping sequences to be generated.
6060
6161
``xorshift1024.RandomState`` exposes a number of methods for generating random
6262
numbers drawn from a variety of probability distributions. In addition to the
@@ -88,11 +88,13 @@ Notes
8888
-----
8989
See xorshift128 for a faster implementation that has a smaller period.
9090
91-
** Parallel Features **
91+
**Parallel Features**
9292
9393
``xorshift1024.RandomState`` can be used in parallel applications by
94-
invoking the ``xorshift1024.RandomState.jump`` which will advance the
95-
the state as-if :math:`2^512` random numbers have been generated.
94+
calling the method ``jump`` which advances the
95+
the state as-if :math:`2^{512}` random numbers have been generated. This
96+
allow the original sequence to be split so that distinct segments can be used
97+
on each worker process.
9698
9799
>>> import randomstate.prng.xorshift1024 as rnd
98100
>>> rs = [rnd.RandomState(1234) for _ in range(10)]
@@ -104,4 +106,10 @@ References
104106
----------
105107
.. [1] "xorshift*/xorshift+ generators and the PRNG shootout",
106108
http://xorshift.di.unimi.it/
109+
.. [2] Marsaglia, George. "Xorshift RNGs." Journal of Statistical Software
110+
[Online], 8.14, pp. 1 - 6, .2003.
111+
.. [3] Sebastiano Vigna. "An experimental exploration of Marsaglia's xorshift
112+
generators, scrambled." CoRR, abs/1402.6246, 2014.
113+
.. [4] Sebastiano Vigna. "Further scramblings of Marsaglia's xorshift
114+
generators." CoRR, abs/1403.0930, 2014.
107115
"""

randomstate/shims/xorshift128/xorshift128.pxi

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ RandomState(seed=None)
4949
Container for the xorshift128+ pseudo random number generator.
5050
5151
xorshift128+ is a 64-bit implementation of Saito and Matsumoto's XSadd
52-
generator [1]_. xorshift128+ has a period of 2**128 - 1 and supports jumping
53-
the sequence in increments of 2**64, which allow multiple non-overlapping
54-
sequences to be generated.
52+
generator [1]_,[2]_,[3]_,[4]_. xorshift128+ has a period of 2**128 - 1 and
53+
supports jumping the sequence in increments of 2**64, which allow multiple
54+
non-overlapping sequences to be generated.
5555
5656
``xorshift128.RandomState`` exposes a number of methods for generating random
5757
numbers drawn from a variety of probability distributions. In addition to the
@@ -84,11 +84,13 @@ Notes
8484
See xorshift1024 for an implementation with a larger period
8585
(2**1024 - 1) and jump size.
8686
87-
** Parallel Features **
87+
**Parallel Features**
8888
8989
``xorshift128.RandomState`` can be used in parallel applications by
90-
invoking the ``xorshift128.RandomState.jump`` which will advance the
91-
the state as-if :math:`2^64` random numbers have been generated.
90+
calling the method ``jump`` which advances the
91+
the state as-if :math:`2^{64}` random numbers have been generated. This
92+
allow the original sequence to be split so that distinct segments can be used
93+
on each worker process.
9294
9395
>>> import randomstate.prng.xorshift128 as rnd
9496
>>> rs = [rnd.RandomState(1234) for _ in range(10)]
@@ -100,4 +102,10 @@ References
100102
----------
101103
.. [1] "xorshift*/xorshift+ generators and the PRNG shootout",
102104
http://xorshift.di.unimi.it/
105+
.. [2] Marsaglia, George. "Xorshift RNGs." Journal of Statistical Software
106+
[Online], 8.14, pp. 1 - 6, .2003.
107+
.. [3] Sebastiano Vigna. "An experimental exploration of Marsaglia's xorshift
108+
generators, scrambled." CoRR, abs/1402.6246, 2014.
109+
.. [4] Sebastiano Vigna. "Further scramblings of Marsaglia's xorshift
110+
generators." CoRR, abs/1403.0930, 2014.
103111
"""

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ def is_pure(self):
184184
extra_link_args=extra_link_args)
185185
extensions.append(ext)
186186

187+
# Do not run cythonize if clean
188+
if 'clean' in sys.argv:
189+
def cythonize(e):
190+
return e
191+
187192
ext_modules = cythonize(extensions)
188193

189194
classifiers = ['Development Status :: 5 - Production/Stable',
@@ -231,7 +236,9 @@ def is_pure(self):
231236
zip_safe=False)
232237

233238
# Clean up generated files
239+
exts = ('.pyx', '-config.pxi', '.c')
234240
for config in configs:
235-
os.unlink(join(mod_dir, config['file_name'] + '.pyx'))
236-
os.unlink(join(mod_dir, config['file_name'] + '-config.pxi'))
237-
os.unlink(join(mod_dir, config['file_name'] + '.c'))
241+
for ext in exts:
242+
file_path = join(mod_dir, config['file_name'] + ext)
243+
if os.path.exists(file_path):
244+
os.unlink(file_path)

0 commit comments

Comments
 (0)