I would like to use a quasirandom sequence, specifically Sobol, within a SciPy based simulation. Any recommendations on existing, efficient packages?
Is this project any use? If not, the relevant Wikipedia article mentions C and Fortran routines in NAG and Numerical Recipes, which probably shouldn't be difficult to wrap or reimplement in Python. There are also C routines in GSL.

Thanks, jburkardt's project (which builds on NumPy) does look interesting. Do you (or others) have any direct experience using it? Or any comparisons to other packages? Also, it'd be great to not have the 40 dimension limit. So I'm interested in find either a python implementation or (perhaps better, b/c faster) a premade python wrapper for a C/C++ code that removes this restriction, as is done in jburkardt's C++ an Fortran.– Bryan PFeb 23 '12 at 12:57

OK... I'm going to accept this answer for now, it seems like the only option. But am still interested in other options or solutions to the issues I raised in the last comment.– Bryan PMar 5 '12 at 7:12

2I've cleaned up the project linked above (docstrings now work), and will keep updating it, if necessary. It's available at github.com/naught101/sobol_seq Mar 26 '12 at 6:31

@naught101 sobolseq on your git projects has a maximum of 40 dimensions. Is there any implementation that lets it compute beyond 40dimensions– toingJan 30 at 10:34

2@naught101 thanks for link to discussion. Looks like both scipy as well as PyTorch now have feature to generate Sobol numbers with high dimensions. scipy.github.io/devdocs/generated/scipy.stats.qmc.Sobol.html– toingFeb 1 at 2:05
For Sobol Sequences try sobol_seq.
Generally speaking the best package I've found for dealing with quasirandom sequences is diversipy.
There are also packages that focus on specific implementations, for example sudoku_lhs deals with Latin Hypercubes and the Sudokutype Constraint variant.
pyDOE implements at least Latin Hypercube (maybe more).
The most interesting package I found is pydesign, which creates a wrapper for Fortran 90 codes on 15 or so methods. Unfortunately it does not seem to work (some assets seem to be missing).
I would use OpenTURNS, which provides several low discrepancy sequences:
 Faure sequence,
 Halton sequence,
 Reverse Halton sequence,
 Haselgrove sequence,
 Sobol sequence.
Moreover, the sequence can be generated so that the marginals have arbitrary distribution. This is done with an probabilistic transformation, based on the inverse distribution function.
In the following example, I generate a Sobol' sequence in 2 dimensions, based on the LowDiscrepancyExperiment
class. The marginals are uniform in the [1, 1] interval (which is the default Uniform distribution in OT). I suggest to use a sample size equal to a power of 2, because Sobol' sequence is based on base2 integer decomposition. The generate
method returns a ot.Sample
.
import openturns as ot
dim = 2
distribution = ot.ComposedDistribution([ot.Uniform()]*dim)
bounds = distribution.getRange()
sequence = ot.SobolSequence(dim)
samplesize = 2**5 # Sobol' sequences are in base 2
experiment = ot.LowDiscrepancyExperiment(sequence, distribution,
samplesize, False)
sample = experiment.generate()
print(samplesize[:5])
The previous sample has size 32. The first 5 elements are:
y0 y1
0 0 0
1 0.5 0.5
2 0.5 0.5
3 0.25 0.25
4 0.75 0.75
The Sobol' sequence in OT can generate an arbitrary sample size, in dimensions up to 1111.
With a little more work, we may plot the design.
import openturns.viewer as otv
fig = otv.PlotDesign(sample, bounds, 2**2, 2**1);
fig.set_size_inches(6, 6)
which produces:
See how there is exactly 4 points in each elementary interval.
If required, the sample
can be easily converted into a Numpy array, which may better fits into your Scipy requirement:
import numpy as np
array = np.array(sample)
Other examples are provided at: http://openturns.github.io/openturns/master/examples/reliability_sensitivity/design_of_experiments.html

This looks great and seems to be already to go in Python. Switching to accepted answer.– Bryan PFeb 1 at 4:06

It appears to be possible to generate scrambled sequences with LowDiscrepancyExperiment.setRandomize(True). This was not obvious from reading just the SobolSequence documentation. Jul 15 at 16:27
PyTorch provides some options now. One of them is scrambled sobol number generator that can generate quasi random number of higher dimensions of upto ~1k
https://pytorch.org/docs/stable/generated/torch.quasirandom.SobolEngine.html
Another option is to use Scipy that has this option now http://scipy.github.io/devdocs/generated/scipy.stats.qmc.Sobol.html

1
Chaospy is also a valid option. It allows to select several approaches towards lowdiscrepancy sampling (including 'Sobol, latin hypercube, etc)  for more details see the documentation.
In the context of sensivity analysis SALib library seems interesting It has a Sobol sample generator and uses SciPy. Link here : https://salib.readthedocs.io/en/latest/