py4sci

Previous topic

TestProgram

Next topic

Examples

This Page

PSweep Reference

class puq.PSweep(iteration_cb=None)
run(sweep, dryrun=False)

Gets the parameters then adds the command plus parameters to the host object job list. Then tells the host to run. After all jobs have completed, collect the data and call analyze(). If iteration_cb is defined, call it.

The callback must take two parameters. The first one is the sweep object, the second is the handle to the hdf5 file of the run. It must return a boolean. If True is returned, the sweep is over. If false, the sweep parameters may be changed and it will continue.

Returns True on success.

class puq.LHS(params, num, ds=False, response=True, iteration_cb=None)

Class implementing Latin hypercube sampling (LHS).

Parameters:
  • params – Input list of Parameters.
  • num – Number of samples to use.
  • ds (boolean) – Use a modified LHS which always picks the center of the Latin square.
  • response (boolean) – Generate a response surface using the sample points.
  • iteration_cb (function) – A function to call after completion.
class puq.MonteCarlo(params, num, response=True, iteration_cb=None)

Class implementing Monte Carlo sampling.

Parameters:
  • params – Input list of Parameters.
  • num – Number of samples to use.
  • response (boolean) – Generate a response surface using the sample points.
  • iteration_cb (function) – A function to call after completion.
class puq.Smolyak(params, level, iteration_cb=None)

Class implementing gPC using Smolyak Sparse Grids

Parameters:
  • params – Input list of Parameters.
  • level – Polynomial degree for the response function.

If level is set too low, then the response surface will not precisely fit the observed responses. The goodness of the fit is calculated as by RMSE. A perfect fit will have RMSE=0.

class puq.SimpleSweep(params, valarray=None, response=False, iteration_cb=None)

Class implementing a simple sweep.

This sweep does evaluations at the given points.

Parameters:
  • params – Input list of Parameters.
  • valarray – A 2D array with rows = number of params and columns = parameter values. If valarray is set, it is used instead of .values attribute of each parameter.
  • response (boolean) – Generate a response surface using the sample points.
  • iteration_cb (function) – A function to call after completion.