|
Some functions to get faster Monte Carlo tests
|
Imported modules
|
|
import RandomArray
import pyclimate.pyclimateexcpt
|
|
Functions
|
|
getrandomsubsample
getrandomsubsample2
|
|
|
getrandomsubsample
|
getrandomsubsample (
items,
totalitems,
sorted=0,
)
Get a random selection of indices without repeating them.
Arguments:
-
items
- Number of samples in the subsample
-
totalitems
- Number of samples in the whole sample
-
sorted
- If non-zero, sort the subsample (Defaullt: 0)
Returns a NumPy array of indices from the array [0...totalitems-1]
Raises MCTestException if items > totalitems
|
Exceptions
|
|
pe.MCTestException( items, totalitems )
|
|
|
|
getrandomsubsample2
|
getrandomsubsample2 (
items,
totalitems,
sorted=0,
)
Get a random selection of indices without repeating them.
Arguments:
-
items
- Number of samples in the subsample
-
totalitems
- Number of samples in the whole sample
-
sorted
- If non-zero, sort the subsample
Returns a tuple of NumPy arrays of indices from the array [0...totalitems-1]
and the elements which did not enter the selection [totalitems....]
Raises MCTestException if items > totalitems
|
Exceptions
|
|
pe.MCTestException( items, totalitems )
|
|
|