From c76b12ebf8e93e79b9c441ff63716f835d022228 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 21 Oct 2016 12:23:56 +0000 Subject: [PATCH] Corrected 2D Miscellaneous Gunary and 2D Peak LorentzianModifiedPeakA equations, removed unused variables and imports --- DataCache/DataCache.py | 2 +- ExtendedVersionHandlers/ExtendedVersionHandler_Default.py | 1 - ExtendedVersionHandlers/ExtendedVersionHandler_Inverse.py | 1 - .../ExtendedVersionHandler_InverseWithOffset.py | 1 - .../ExtendedVersionHandler_LinearDecay.py | 1 - .../ExtendedVersionHandler_LinearDecayAndOffset.py | 1 - .../ExtendedVersionHandler_LinearGrowth.py | 1 - .../ExtendedVersionHandler_LinearGrowthAndOffset.py | 1 - ExtendedVersionHandlers/ExtendedVersionHandler_Offset.py | 1 - ExtendedVersionHandlers/ExtendedVersionHandler_Reciprocal.py | 1 - .../ExtendedVersionHandler_ReciprocalWithOffset.py | 1 - Models_2D/Miscellaneous.py | 5 ++--- Models_2D/Optical.py | 2 -- Models_2D/Peak.py | 4 ++-- Models_2D/Spline.py | 5 ----- Models_2D/UserDefinedFunction.py | 2 +- Models_3D/BioScience.py | 1 - Models_3D/Spline.py | 5 ----- Models_3D/UserDefinedFunction.py | 2 +- Services/SolverService.py | 3 +-- 20 files changed, 8 insertions(+), 33 deletions(-) diff --git a/DataCache/DataCache.py b/DataCache/DataCache.py index 95280cb..69bcea4 100644 --- a/DataCache/DataCache.py +++ b/DataCache/DataCache.py @@ -12,7 +12,7 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import sys, os, unittest +import sys, os if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..') not in sys.path: sys.path.append(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..')) import pyeq3 diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_Default.py b/ExtendedVersionHandlers/ExtendedVersionHandler_Default.py index bc0e6f6..c558cbc 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_Default.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_Default.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_Inverse.py b/ExtendedVersionHandlers/ExtendedVersionHandler_Inverse.py index 3c99c43..81c022d 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_Inverse.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_Inverse.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_InverseWithOffset.py b/ExtendedVersionHandlers/ExtendedVersionHandler_InverseWithOffset.py index a651d02..c7c5533 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_InverseWithOffset.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_InverseWithOffset.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecay.py b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecay.py index 79c9be6..7c1d39c 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecay.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecay.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecayAndOffset.py b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecayAndOffset.py index 51bc01c..75ddf4d 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecayAndOffset.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearDecayAndOffset.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowth.py b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowth.py index 0d11c0f..b63b9e2 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowth.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowth.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowthAndOffset.py b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowthAndOffset.py index 4103616..4d07aa6 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowthAndOffset.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_LinearGrowthAndOffset.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_Offset.py b/ExtendedVersionHandlers/ExtendedVersionHandler_Offset.py index 985ee1a..153d775 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_Offset.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_Offset.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_Reciprocal.py b/ExtendedVersionHandlers/ExtendedVersionHandler_Reciprocal.py index 6d3e87f..538b4d4 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_Reciprocal.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_Reciprocal.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/ExtendedVersionHandlers/ExtendedVersionHandler_ReciprocalWithOffset.py b/ExtendedVersionHandlers/ExtendedVersionHandler_ReciprocalWithOffset.py index be364cf..0c675b0 100644 --- a/ExtendedVersionHandlers/ExtendedVersionHandler_ReciprocalWithOffset.py +++ b/ExtendedVersionHandlers/ExtendedVersionHandler_ReciprocalWithOffset.py @@ -12,7 +12,6 @@ # # License: BSD-style (see LICENSE.txt in main source directory) -import pyeq3 from . import IExtendedVersionHandler diff --git a/Models_2D/Miscellaneous.py b/Models_2D/Miscellaneous.py index 70a82e4..b7112fb 100644 --- a/Models_2D/Miscellaneous.py +++ b/Models_2D/Miscellaneous.py @@ -1384,14 +1384,14 @@ def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): c = inCoeffs[2] try: - temp = x_in / (a + b * x_in + x_PowX_half) + temp = x_in / (a + b * x_in + c * x_PowX_half) return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self) except: return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300 def SpecificCodeCPP(self): - s = "\ttemp = x_in / (a + b * x_in + pow(x_in, 0.5));\n" + s = "\ttemp = x_in / (a + b * x_in + c * pow(x_in, 0.5));\n" return s @@ -2424,7 +2424,6 @@ def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): temp = a * numpy.power(x_in, b) * numpy.exp(c / x_NegX) return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self) except: - x = inDataCacheDictionary['DependentData'] return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300 diff --git a/Models_2D/Optical.py b/Models_2D/Optical.py index a656bb4..f6005ed 100644 --- a/Models_2D/Optical.py +++ b/Models_2D/Optical.py @@ -1398,7 +1398,6 @@ def GetDataCacheFunctions(self): def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): - x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once x_PowX2 = inDataCacheDictionary['PowX_2.0'] # only need to perform this dictionary look-up once x_PowX4 = inDataCacheDictionary['PowX_4.0'] # only need to perform this dictionary look-up once x_PowX6 = inDataCacheDictionary['PowX_6.0'] # only need to perform this dictionary look-up once @@ -1462,7 +1461,6 @@ def GetDataCacheFunctions(self): def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): - x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once x_PowX2 = inDataCacheDictionary['PowX_2.0'] # only need to perform this dictionary look-up once x_PowX4 = inDataCacheDictionary['PowX_4.0'] # only need to perform this dictionary look-up once x_PowX6 = inDataCacheDictionary['PowX_6.0'] # only need to perform this dictionary look-up once diff --git a/Models_2D/Peak.py b/Models_2D/Peak.py index c955f50..6ace9bb 100644 --- a/Models_2D/Peak.py +++ b/Models_2D/Peak.py @@ -1397,14 +1397,14 @@ def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): b = inCoeffs[1] try: - temp = 1.0 / (1.0 + numpy.square(x_in-a)) + temp = 1.0 / (1.0 + numpy.power(x_in-a, b)) return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self) except: return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300 def SpecificCodeCPP(self): - s = "\ttemp = 1.0 / (1.0 + pow(x_in-a, 2.0));\n" + s = "\ttemp = 1.0 / (1.0 + pow(x_in-a, b));\n" return s diff --git a/Models_2D/Spline.py b/Models_2D/Spline.py index 42a7150..6cef956 100644 --- a/Models_2D/Spline.py +++ b/Models_2D/Spline.py @@ -16,11 +16,6 @@ if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..') not in sys.path: sys.path.append(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..')) -import numpy -try: - import scipy.interpolate -except: - pass import pyeq3 diff --git a/Models_2D/UserDefinedFunction.py b/Models_2D/UserDefinedFunction.py index 454d678..f2a0b85 100644 --- a/Models_2D/UserDefinedFunction.py +++ b/Models_2D/UserDefinedFunction.py @@ -17,7 +17,7 @@ import numpy # implicitly required by compiling the userFunctionCodeObject in the method EvaluateCachedData() below numpy.seterr(all= 'ignore') -import io, parser, types +import io, parser import pyeq3.Model_2D_BaseClass diff --git a/Models_3D/BioScience.py b/Models_3D/BioScience.py index 10d55d9..ae89899 100644 --- a/Models_3D/BioScience.py +++ b/Models_3D/BioScience.py @@ -169,7 +169,6 @@ def GetDataCacheFunctions(self): def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary): - x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once x_plus_y = inDataCacheDictionary['XPLUSY'] # only need to perform this dictionary look-up once diff --git a/Models_3D/Spline.py b/Models_3D/Spline.py index 0f4ec5e..7ec6393 100644 --- a/Models_3D/Spline.py +++ b/Models_3D/Spline.py @@ -16,11 +16,6 @@ if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..') not in sys.path: sys.path.append(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..')) -import numpy -try: - import scipy.interpolate -except: - pass import pyeq3 diff --git a/Models_3D/UserDefinedFunction.py b/Models_3D/UserDefinedFunction.py index c9bc986..567a5d7 100644 --- a/Models_3D/UserDefinedFunction.py +++ b/Models_3D/UserDefinedFunction.py @@ -21,7 +21,7 @@ import numpy # implicitly required by compiling the userFunctionCodeObject in the method EvaluateCachedData() below numpy.seterr(all= 'ignore') -import io, parser, types +import io, parser diff --git a/Services/SolverService.py b/Services/SolverService.py index 5071c33..90c80a2 100644 --- a/Services/SolverService.py +++ b/Services/SolverService.py @@ -19,7 +19,6 @@ pass numpy.seterr(all= 'ignore') -import pyeq3 from . import diffev class custom_prng_for_diffev(numpy.random.mtrand.RandomState): @@ -171,7 +170,7 @@ def SolveUsingSelectedAlgorithm(self, inModel, inAlgorithmName): def SolveUsingODR(self, inModel): - data = inModel.dataCache.FindOrCreateAllDataCache(inModel) + inModel.dataCache.FindOrCreateAllDataCache(inModel) modelObject = scipy.odr.odrpack.Model(inModel.WrapperForODR) if len(inModel.dataCache.allDataCacheDictionary['Weights']): dataObject = scipy.odr.odrpack.Data(inModel.dataCache.allDataCacheDictionary['IndependentData'], inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.dataCache.allDataCacheDictionary['Weights'])