Skip to content

Commit

Permalink
Implemented basic osipi_fit method to the base class
Browse files Browse the repository at this point in the history
My thinking is that this is the default function for fitting. It basically passes arguements to the ivim_fit method of standardized version of the algorithm submission. But before a fit is performed, checks should be made to make sure algorithm requirements are fulfilled. This is yet to be implemented
  • Loading branch information
IvanARashid committed Aug 31, 2023
1 parent 01a5885 commit 3b58f43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/standardized/ETP_SRI_LinearFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ def ivim_fit(self, signals, bvalues=None, linear_fit_option=False):


## Simple test code...
#bvalues = np.array([0, 200, 500, 800])
bvalues = np.array([0, 200, 500, 800])

#def ivim_model(b, S0=1, f=0.1, Dstar=0.03, D=0.001):
#return S0*(f*np.exp(-b*Dstar) + (1-f)*np.exp(-b*D))
def ivim_model(b, S0=1, f=0.1, Dstar=0.03, D=0.001):
return S0*(f*np.exp(-b*Dstar) + (1-f)*np.exp(-b*D))

#signals = ivim_model(bvalues)
signals = ivim_model(bvalues)

#model = ETP_SRI_LinearFitting()
model = ETP_SRI_LinearFitting(thresholds=[200])
#results = model.ivim_fit(signals, bvalues)
results = model.osipi_fit(signals, bvalues)
print(results)
#test = model.osipi_simple_bias_and_RMSE_test(SNR=20, bvalues=bvalues, f=0.1, Dstar=0.03, D=0.001, noise_realizations=10)
6 changes: 3 additions & 3 deletions src/wrappers/OsipiBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def osipi_fit(self, data=None, bvalues=None, thresholds=None, bounds=None, initi
use_initial_guess = initial_guess if self.initial_guess is None else self.initial_guess

args = [data, use_bvalues, use_thresholds]
if reqired_bounds or required_bounds_optional:
if self.required_bounds or self.required_bounds_optional:
args.append(use_bounds)
if required_initial_guess or required_initial_guess_optional:
if self.required_initial_guess or self.required_initial_guess_optional:
args.append(use_initial_guess)

# Run a check_requirements method that makes sure that these inputs fulfil the requirements
Expand All @@ -44,7 +44,7 @@ def osipi_fit(self, data=None, bvalues=None, thresholds=None, bounds=None, initi
f, Dstar, D = self.ivim_fit(*args)

#self.parameter_estimates = self.ivim_fit(data, bvalues)
pass
return f, Dstar, D

def osipi_print_requirements(self):
"""
Expand Down

0 comments on commit 3b58f43

Please sign in to comment.