Skip to content

Commit

Permalink
Merge branch 'master' into 234_fix_readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew McCluskey committed Sep 20, 2019
2 parents 4ca7f76 + 2a961b2 commit 89fd8b2
Show file tree
Hide file tree
Showing 53 changed files with 410 additions and 545 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Report an error which requires fixing
title: ''
labels: bug
labels: Bug

---

Expand Down
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Documentation
about: Suggest a improvement to user, developer or other documentation
title: ''
labels: Documentation

---

**Description of the documentation**
A description of what area can benefit from better documentation.

**Additional details**
Add any other context or screenshots about this request.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest a new feature
title: ''
labels: enhancement
labels: Enhancement

---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Test
about: Specify a test that needs to be implemented
title: ''
labels: testing
labels: Testing

---

Expand Down
8 changes: 4 additions & 4 deletions fitbenchmarking/fitbenchmark_one_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import sys
import numpy as np

from fitting import prerequisites as prereq
from fitting import misc
from fitting.plotting import plots
from fitbenchmarking.fitting import prerequisites as prereq
from fitbenchmarking.fitting import misc
from fitbenchmarking.fitting.plotting import plots

from utils.logging_setup import logger
from fitbenchmarking.utils.logging_setup import logger


def fitbm_one_prob(user_input, problem):
Expand Down
1 change: 0 additions & 1 deletion fitbenchmarking/fitting/mantid/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

13 changes: 7 additions & 6 deletions fitbenchmarking/fitting/mantid/externals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
from __future__ import (absolute_import, division, print_function)

import mantid.simpleapi as msapi
from utils.logging_setup import logger
from fitbenchmarking.utils.logging_setup import logger


def gen_func_obj(function_name, params_set):
"""
Generates a mantid function object.
@param function_name :: the name of the function to be generated
@params_set :: set of parameters per function extracted from the problem definition file
@params_set :: set of parameters per function extracted from the
problem definition file
@returns :: mantid function object that can be called in python
"""
params_set = (params_set.split(', ties'))[0]

exec "function_object = msapi." + function_name + "("+ params_set +")"
exec "function_object = msapi." + function_name + "(" + params_set + ")"

return function_object

Expand All @@ -39,12 +40,12 @@ def set_ties(function_object, ties):
for tie in ties_per_func:
"""
param_str is a string of the parameter name in the mantid format
For a Mantid Composite Function, a formatted parameter name would
For a Mantid Composite Function, a formatted parameter name would
start with the function number and end with the parameter name.
For instance, f0.A would refer to a parameter A of the first
For instance, f0.A would refer to a parameter A of the first
function is a Composite Function.
"""
param_str = 'f'+str(idx)+'.'+(tie.split("'"))[0]
param_str = 'f' + str(idx) + '.' + (tie.split("'"))[0]
function_object.fix(param_str)

return function_object
Expand Down
15 changes: 7 additions & 8 deletions fitbenchmarking/fitting/mantid/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import numpy as np
import mantid.simpleapi as msapi

from utils.logging_setup import logger
from fitting import misc
from fitting.plotting import plot_helper
from fitbenchmarking.utils.logging_setup import logger
from fitbenchmarking.fitting import misc
from fitbenchmarking.fitting.plotting import plot_helper


MAX_FLOAT = sys.float_info.max
Expand Down Expand Up @@ -41,13 +41,14 @@ def benchmark(problem, wks_created, function, minimizers, cost_function):
chi_sq, min_chi_sq, best_fit = \
chisq(status, fit_wks, min_chi_sq, best_fit, minimizer)
individual_result = \
misc.create_result_entry(problem, status, chi_sq, runtime, minimizer,
function, fin_function_def)
misc.create_result_entry(problem, status, chi_sq, runtime,
minimizer, function, fin_function_def)

results_problem.append(individual_result)

return results_problem, best_fit


def fit(problem, wks_created, function, minimizer,
cost_function='Least squares'):
"""
Expand All @@ -65,8 +66,6 @@ def fit(problem, wks_created, function, minimizer,
the final function definition
and how much time it took for the fit to finish (float)
"""


fit_result, t_start, t_end = None, None, None
try:
ignore_invalid = get_ignore_invalid(problem, cost_function)
Expand Down Expand Up @@ -127,7 +126,7 @@ def parse_result(fit_result, t_start, t_end):

status = 'failed'
fit_wks, fin_function_def, runtime = None, None, np.nan
if not fit_result is None:
if fit_result is not None:
status = fit_result.OutputStatus
fit_wks = fit_result.OutputWorkspace
fin_function_def = str(fit_result.Function)
Expand Down
5 changes: 2 additions & 3 deletions fitbenchmarking/fitting/mantid/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

from __future__ import (absolute_import, division, print_function)

import copy
import numpy as np
import mantid.simpleapi as msapi

from utils.logging_setup import logger


def wks_cost_function(problem, use_errors=True):
"""
Expand Down Expand Up @@ -38,6 +35,7 @@ def wks_cost_function(problem, use_errors=True):

return wks_created, cost_function


def setup_errors(problem):
"""
Gets errors on the data points from the problem object if there are
Expand All @@ -57,6 +55,7 @@ def setup_errors(problem):
# True errors
return problem.data_e


def convert_back(wks_used, problem, use_errors):
"""
Convert back so data is of equal lengths.
Expand Down
1 change: 0 additions & 1 deletion fitbenchmarking/fitting/mantid/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Loading

0 comments on commit 89fd8b2

Please sign in to comment.