Sherpa
4.14.1

Introduction

  • Installation
  • A quick guide to modeling and fitting in Sherpa
  • Sherpa and CIAO

User Documentation

  • What data is to be fit?
  • Creating model instances
  • Evaluating a model
  • Available Models
  • What statistic is to be used?
  • Optimisers: How to improve the current parameter values
    • Choosing an optimiser
    • Summary and best-buy strategies
    • Reference/API
      • The sherpa.optmethods module
      • The sherpa.optmethods.optfcts module
        • difevo
        • difevo_lm
        • difevo_nm
        • grid_search
        • lmdif
        • minim
        • montecarlo
        • neldermead
  • Fitting the data
  • Visualisation
  • Markov Chain Monte Carlo and Poisson data
  • Utility routines

Worked Examples

  • Simple Interpolation
  • Comparing Gaussian, Lorentzian, and Voigt 1D models
  • Simple user model

An interactive application

  • Using Sessions to manage models and data

Notebooks

  • Sherpa Quick Start
  • Notebook support in Sherpa
  • A sample of plots

Extra Functionality

  • Optimizing functions

Getting Help

  • Bug Reports
  • Contributing to Sherpa development
  • Indices and tables
Sherpa
  • »
  • Optimisers: How to improve the current parameter values »
  • The sherpa.optmethods.optfcts module »
  • grid_search
  • Edit on GitHub

grid_search

sherpa.optmethods.optfcts.grid_search(fcn, x0, xmin, xmax, num=16, sequence=None, numcores=1, maxfev=None, ftol=1.1920928955078125e-07, method=None, verbose=0)[source] [edit on github]

Grid Search optimization method.

This method evaluates the fit statistic for each point in the parameter space grid; the best match is the grid point with the lowest value of the fit statistic. It is intended for use with template models as it is very inefficient for general models.

Parameters
  • fcn (function reference) – Returns the current statistic and per-bin statistic value when given the model parameters.

  • x0 (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • xmin (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • xmax (sequence of number) – The starting point, minimum, and maximum values for each parameter.

  • num (int) – The size of the grid for each parameter when sequence is None, so npar^num fits will be evaluated, where npar is the number of free parameters. The grid spacing is uniform.

  • sequence (sequence of numbers or None) – The list through which to evaluate. Leave as None to use a uniform grid spacing as determined by the num attribute.

  • numcores (int or None) – The number of CPU cores to use. The default is 1 and a value of None will use all the cores on the machine.

  • maxfev (int or None) – The maxfev attribute if method is not None.

  • ftol (number) – The ftol attribute if method is not None.

  • method (str or None) – The optimization method to use to refine the best-fit location found using the grid search. If None then this step is not run.

  • verbose (int) – The amount of information to print during the fit. The default is 0, which means no output.

Returns

retval – A boolean indicating whether the optimization succeeded, the best-fit parameter values, the best-fit statistic value, a string message indicating the status, and a dictionary returning information from the optimizer.

Return type

tuple

Previous Next

© Copyright 2019-2022, Chandra X-ray Center, Smithsonian Astrophysical Observatory.. Revision 0cd152fb. Last updated on 11 Oct 2022.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: 4.14.1
Versions
latest
4.15.0
4.14.1
4.14.0
4.13.1
4.13.0
4.12.2
4.12.1
4.12.0
4.11.1
4.11.0
4.10.2
4.10.1
Downloads
On Read the Docs
Project Home
Builds