PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v1.0.1 »
- SDSS Utilities (`pydl.pydlutils`) »
- computechi2

# computechi2

class pydl.pydlutils.math.computechi2(bvec, sqivar, amatrix)

  Bases: `object`

  Solve the linear set of equations \(A x = b\) using SVD.

  The attributes of this class are all read-only properties, implemented with `lazyproperty`.

  Parameters:
    bvec `numpy.ndarray`

      The \(b\) vector in \(A x = b\). This vector has length \(N\).

    sqivar `numpy.ndarray`

      The reciprocal of the errors in `bvec`. The name comes from the square root of the inverse variance, which is what this is.

    amatrix `numpy.ndarray`

      The matrix \(A\) in \(A x = b\). The shape of this matrix is (\(N\), \(M\)).

  Initialize the object and perform initial computations.

  Attributes Summary

  `acoeff` | (`ndarray`) The fit parameters, \(x\), in \(A x = b\).
  `chi2` | (`float`) The \(\chi^2\) value of the fit.
  `covar` | (`ndarray`) The covariance matrix.
  `dof` | (`int`) The degrees of freedom of the fit.
  `var` | (`ndarray`) The variances of the fit.
  `yfit` | (`ndarray`) The evaluated best-fit at each point.

  Attributes Documentation

  acoeff

    (`ndarray`) The fit parameters, \(x\), in \(A x = b\). This vector has length \(M\).

  chi2

    (`float`) The \(\chi^2\) value of the fit.

  covar

    (`ndarray`) The covariance matrix. The shape of this matrix is (\(M\), \(M\)).

  dof

    (`int`) The degrees of freedom of the fit. This is the number of values of `bvec` that have `sqivar` > 0 minus the number of fit paramaters, which is equal to \(M\).

  var

    (`ndarray`) The variances of the fit. This is identical to the diagonal of the covariance matrix. This vector has length \(M\).

  yfit

    (`ndarray`) The evaluated best-fit at each point. This vector has length \(N\).