Skip to content

numpydoc build for base.py #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/diffpy/srmise/modelevaluators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ class ModelEvaluator:
worse models."""

def __init__(self, method, higher_is_better):
"""method = name of method (string)
higher_is_better = boolean
"""Constructor of ModelEvaluator

Parameters
----------
method : str
The name of method
higher_is_better : bool
The boolean to compare higher or lower degree model.
"""
self.method = method
self.higher_is_better = higher_is_better
Expand Down Expand Up @@ -123,7 +129,16 @@ def __ge__(self, other):
return other.stat >= self.stat

def chi_squared(self, expected, observed, error):
"""Calculates chi-squared statistic."""
"""Calculates chi-squared statistic.

Parameters
----------
expected : float
The expected value.
observed : float
The observed value.
error : float
The error statistic."""

self.chisq = np.sum((expected - observed) ** 2 / error**2)
return self.chisq
Expand Down
Loading