Skip to content

Commit 7f5cc01

Browse files
committed
Converts background function to python
1 parent 265668a commit 7f5cc01

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

RATapi/examples/non_polarised/DSPC_function_background.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def DSPC_function_background():
145145
# FIXME: replace this with a Python custom file when Python backgrounds are added!
146146
problem.custom_files.append(
147147
name="D2O Background Function",
148-
filename="backgroundFunction.m",
149-
language="matlab",
148+
filename="backgroundFunction.py",
149+
language="python",
150150
path=pathlib.Path(__file__).parent.resolve(),
151151
)
152152

RATapi/examples/non_polarised/backgroundFunction.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

RATapi/examples/non_polarised/backgroundFunction.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ def backgroundFunction(xdata, params):
88
back_const = params[2]
99

1010
# Make an exponential decay background
11-
background = np.zeros(len(xdata))
12-
for i in range(0, len(xdata)):
13-
background[i] = Ao * np.exp(-k * xdata[i]) + back_const
11+
background = Ao * np.exp(-k * np.array(xdata)) + back_const
1412

1513
return background

0 commit comments

Comments
 (0)