Skip to content

Commit

Permalink
Merge pull request #127 from mitodl/release_v1.2
Browse files Browse the repository at this point in the history
Making release 1.2
  • Loading branch information
jolyonb authored Aug 12, 2018
2 parents d86f826 + f67432d commit 53f6382
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A library of graders for edX Custom Response problems.

Version 1.1.1 ([changelog](docs/changelog.md))
Version 1.2.0 ([changelog](docs/changelog.md))

Copyright 2017-2018 Jolyon Bloomfield and Chris Chudzicki

Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This version includes a number of new features and documentation updates.

* A new [documentation website](https://mitodl.github.io/mitx-grading-library/)
* Math parser now supports multivariable functions and array input (vector, matrix, etc).
* many improvements to our mathjax preprocessor
* Many improvements to our mathjax preprocessor
* Improvements to balanced bracket validator.
* Added new class `MatrixGrader` (see [MatrixGrader documentation](grading_math/matrix_grader/matrix_grader.md)) along with supporting sampling classes `RealMatrices` and `RealVectors`
* When `FormulaGrader` (and its subclasses) are used inside an ordered `ListGrader`, authors can now grade multiple student inputs in comparison to each other by specifying answers in terms of [sibling variables](grading_math/formula_grader.md/#sibling-variables)
Expand Down
2 changes: 1 addition & 1 deletion mitxgraders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MITx Grading Library
https://github.com/mitodl/mitx-grading-library
Copyright (c) 2017 Jolyon Bloomfield and Chris Chudzicki
Copyright (c) 2017-2018 Jolyon Bloomfield and Chris Chudzicki
All Rights Reserved
See version.py for version number
Expand Down
2 changes: 2 additions & 0 deletions mitxgraders/comparers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Comparers can be imported by using "from mitxgraders import comparers"
# and referenced as "comparers.comparer_name"
from comparers import (
equality_comparer,
congruence_comparer,
Expand Down
20 changes: 13 additions & 7 deletions mitxgraders/comparers/comparers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
When `FormulaGrader` (or its subclasses) call your custom comparer function,
`comparer_func`'s argument values are:
-`comparer_params_evals`: The `comparer_params` list, numerically evaluated
- `comparer_params_evals`: The `comparer_params` list, numerically evaluated
according to variable and function sampling.
- `student_eval`: The student's input, numerically evaluated according to
variable and function sampling
variable and function sampling.
- `utils`: A convenience object that may be helpful when writing custom
comparer functions. It has attributes:
Expand All @@ -34,14 +34,13 @@
- a boolean, or
- a dictionary with keys:
- `'grade_decimal'`: number between 0 and 1 (required)
- `'ok'`: `True` or `False` or `'partial'`(optional, inferred from
- `'ok'`: `True` or `False` or `'partial'` (optional, inferred from
grade_decimal by default)
- `'msg'`: a feedback message (defaults to `''`)
- `'msg'`: a feedback message (optional, defaults to `''`)
NOTE: doctests in this module show how the comparer function would be used
inside a grader
"""
from numbers import Number
import numpy as np
Expand All @@ -50,7 +49,7 @@
def equality_comparer(comparer_params_evals, student_eval, utils):
"""
Default comparer function used by FormulaGrader, NumericalGrader,
and MatrixGrader.
and MatrixGrader. Checks for equality.
comparer_params: ['expected_input']
"""
Expand All @@ -65,6 +64,8 @@ def equality_comparer(comparer_params_evals, student_eval, utils):

def between_comparer(comparer_params_evals, student_eval, utils):
"""
Used to check that input is real and between two parameters.
comparer_params: ['start', 'stop']
Example:
Expand All @@ -86,7 +87,6 @@ def between_comparer(comparer_params_evals, student_eval, utils):
>>> grader(None, '5e8+2e6*i')['ok']
Traceback (most recent call last):
InputTypeError: Input must be real.
"""
start, stop = comparer_params_evals

Expand All @@ -97,6 +97,9 @@ def between_comparer(comparer_params_evals, student_eval, utils):

def congruence_comparer(comparer_params_evals, student_eval, utils):
"""
Compares the student input to a target, moduli a given modulus.
Will often set modulus to 2*pi in order to compare angles.
comparer_params: [target, modulus]
Example usage:
Expand Down Expand Up @@ -126,6 +129,9 @@ def congruence_comparer(comparer_params_evals, student_eval, utils):

def eigenvector_comparer(comparer_params_evals, student_eval, utils):
"""
Used to check that a student's answer is an eigenvector of a matrix
with a given eigenvalue. Ignores scaling of the eigenvector.
comparer_params: [matrix, eigenvalue]
Example Usage:
Expand Down
18 changes: 18 additions & 0 deletions mitxgraders/helpers/calc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,26 @@
DEFAULT_SUFFIXES,
METRIC_SUFFIXES,
pauli,
cartesian_xyz,
cartesian_ijk,
within_tolerance
)
from mitxgraders.helpers.calc.math_array import MathArray, identity
from mitxgraders.helpers.calc.specify_domain import specify_domain
from mitxgraders.helpers.calc.exceptions import CalcError

__all__ = [
"evaluator",
"DEFAULT_VARIABLES",
"DEFAULT_FUNCTIONS",
"DEFAULT_SUFFIXES",
"METRIC_SUFFIXES",
"pauli",
"cartesian_xyz",
"cartesian_ijk",
"within_tolerance",
"MathArray",
"identity",
"specify_domain",
"CalcError"
]
12 changes: 12 additions & 0 deletions mitxgraders/helpers/calc/mathfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,18 @@ def merge_dicts(*source_dicts):
])
}

cartesian_xyz = {
'hatx': MathArray([1, 0, 0]),
'haty': MathArray([0, 1, 0]),
'hatz': MathArray([0, 0, 1])
}

cartesian_ijk = {
'hati': MathArray([1, 0, 0]),
'hatj': MathArray([0, 1, 0]),
'hatk': MathArray([0, 0, 1])
}

def within_tolerance(x, y, tolerance):
"""
Check that |x-y| <= tolerance with appropriate norm.
Expand Down
2 changes: 1 addition & 1 deletion mitxgraders/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Version number
"""

__version__ = "1.1.1"
__version__ = "1.2.0"
Binary file modified python_lib.zip
Binary file not shown.

0 comments on commit 53f6382

Please sign in to comment.