From 9a50c623ae59d33ee50cfb1b53e4c05e973beeb1 Mon Sep 17 00:00:00 2001 From: cslotboom <50510141+cslotboom@users.noreply.github.com> Date: Sun, 24 Jan 2021 21:03:59 -0800 Subject: [PATCH] removing some old refernces to functions Udating older functions so that there is no reference to them. The new environment class replaces all the old references. --- doc/readthedocs/hysteresis/__init__.py | 15 ++------------- doc/readthedocs/hysteresis/baseClass.py | 12 +++++++----- doc/readthedocs/hysteresis/climate.py | 2 +- doc/readthedocs/hysteresis/compare.py | 7 +++---- src/__init__.py | 15 ++------------- src/baseClass.py | 12 +++++++----- src/climate.py | 2 +- src/compare.py | 7 +++---- 8 files changed, 26 insertions(+), 46 deletions(-) diff --git a/doc/readthedocs/hysteresis/__init__.py b/doc/readthedocs/hysteresis/__init__.py index e95af2e..8d23c53 100644 --- a/doc/readthedocs/hysteresis/__init__.py +++ b/doc/readthedocs/hysteresis/__init__.py @@ -1,14 +1,3 @@ -# __all__ = ["hysteresis", "data"] - -# import hysteresis -# from hysteresis.hysteresis import * -# from hysteresis.data import * - -# import hysteresis.hysteresis -# __all__ = ["hysteresis"] - - - from .baseClass import Hysteresis, SimpleCycle, MonotonicCurve from .baseFuncs import concatenateHys, removeNegative from .resample import resample, resampleDx @@ -21,5 +10,5 @@ # from .env import HYSTERESIS_ENVIRONMENT # environment = HYSTERESIS_ENVIRONMENT() -from .env import environment -environment.restart() +# from .env import environment +# environment.restart() diff --git a/doc/readthedocs/hysteresis/baseClass.py b/doc/readthedocs/hysteresis/baseClass.py index 4886e22..3453240 100644 --- a/doc/readthedocs/hysteresis/baseClass.py +++ b/doc/readthedocs/hysteresis/baseClass.py @@ -5,8 +5,6 @@ from hysteresis import data -from .defaultDataFuncs import defaultAreaFunction, defaultSlopeFunction -from .defaultPlotFuncs import initializeFig, defaultPlotFunction, defaultShowCycles import hysteresis.env as env import matplotlib.pyplot as plt @@ -101,6 +99,10 @@ def __init__(self, XYData, xunit = '', yunit = ''): self.slopefunction = env.environment.fslope self.plotfunction = env.environment.fplot + self.initializeFig = env.environment.finit + self.plotfunction = env.environment.fplot + self.showCycles = env.environment.fcycles + self.colorDict = {0:'C0', 1:'C1', 2:'C3'} self.xunit = xunit @@ -252,7 +254,7 @@ def plotCumArea(self, plotCycles = False, plotPeaks = False, labelCycles = []): self.plotfunction(self, x ,y, plotCycles, plotPeaks, labelCycles) def initFig(self, xlims = [], ylims = []): - return initializeFig(xlims, ylims) + return self.initializeFig(xlims, ylims) # TODO: @@ -347,7 +349,7 @@ def plotCycles(self, Cycles = [], plotCycles = False, plotPeaks = False, Vectors = self.Cycles # fig, ax = initializeFig(xlim, ylim) - defaultShowCycles(self, xyHys[:,0], xyHys[:,1], plotCycles, plotPeaks, labelCycles, Cycles) + self.showCycles(self, xyHys[:,0], xyHys[:,1], plotCycles, plotPeaks, labelCycles, Cycles) colorDict = self.colorDict @@ -495,7 +497,7 @@ def plotSubCycles(self, SubCyclesIndicies = [], plotCycles = False, plotPeaks = xyMono = self.xy Vectors = self.SubCycles - defaultShowCycles(self, xyMono[:,0], xyMono[:,1], plotCycles, plotPeaks) + self.showCycles(self, xyMono[:,0], xyMono[:,1], plotCycles, plotPeaks) colorDict = self.colorDict if len(SubCyclesIndicies) == 0: diff --git a/doc/readthedocs/hysteresis/climate.py b/doc/readthedocs/hysteresis/climate.py index 3bb9634..1b798f4 100644 --- a/doc/readthedocs/hysteresis/climate.py +++ b/doc/readthedocs/hysteresis/climate.py @@ -1,7 +1,7 @@ import numpy as np -from .baseClass import CurveBase, initializeFig +from .baseClass import CurveBase import matplotlib.pyplot as plt from scipy.optimize import curve_fit diff --git a/doc/readthedocs/hysteresis/compare.py b/doc/readthedocs/hysteresis/compare.py index d61429c..a2b7368 100644 --- a/doc/readthedocs/hysteresis/compare.py +++ b/doc/readthedocs/hysteresis/compare.py @@ -1,6 +1,6 @@ import hysteresis.env as env -from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff +# from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff from .resample import resample @@ -9,8 +9,7 @@ # ============================================================================= # TODO: consider storing the sample function within the class itself. -def compareCycle(Curve1, Curve2, Nsample = 10, - sampleFunction = defaultSampleFunction): +def compareCycle(Curve1, Curve2, Nsample = 10): """ Compares two Curve objects by resampling them using linear interplation, then comparing the distance between both cycles in a comon domain. @@ -50,7 +49,7 @@ def compareCycle(Curve1, Curve2, Nsample = 10, return diff -def compareHys(Hys1, Hys2, combineDiff = defaultCombineDiff): +def compareHys(Hys1, Hys2): """ diff --git a/src/__init__.py b/src/__init__.py index e95af2e..8d23c53 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,14 +1,3 @@ -# __all__ = ["hysteresis", "data"] - -# import hysteresis -# from hysteresis.hysteresis import * -# from hysteresis.data import * - -# import hysteresis.hysteresis -# __all__ = ["hysteresis"] - - - from .baseClass import Hysteresis, SimpleCycle, MonotonicCurve from .baseFuncs import concatenateHys, removeNegative from .resample import resample, resampleDx @@ -21,5 +10,5 @@ # from .env import HYSTERESIS_ENVIRONMENT # environment = HYSTERESIS_ENVIRONMENT() -from .env import environment -environment.restart() +# from .env import environment +# environment.restart() diff --git a/src/baseClass.py b/src/baseClass.py index 4886e22..3453240 100644 --- a/src/baseClass.py +++ b/src/baseClass.py @@ -5,8 +5,6 @@ from hysteresis import data -from .defaultDataFuncs import defaultAreaFunction, defaultSlopeFunction -from .defaultPlotFuncs import initializeFig, defaultPlotFunction, defaultShowCycles import hysteresis.env as env import matplotlib.pyplot as plt @@ -101,6 +99,10 @@ def __init__(self, XYData, xunit = '', yunit = ''): self.slopefunction = env.environment.fslope self.plotfunction = env.environment.fplot + self.initializeFig = env.environment.finit + self.plotfunction = env.environment.fplot + self.showCycles = env.environment.fcycles + self.colorDict = {0:'C0', 1:'C1', 2:'C3'} self.xunit = xunit @@ -252,7 +254,7 @@ def plotCumArea(self, plotCycles = False, plotPeaks = False, labelCycles = []): self.plotfunction(self, x ,y, plotCycles, plotPeaks, labelCycles) def initFig(self, xlims = [], ylims = []): - return initializeFig(xlims, ylims) + return self.initializeFig(xlims, ylims) # TODO: @@ -347,7 +349,7 @@ def plotCycles(self, Cycles = [], plotCycles = False, plotPeaks = False, Vectors = self.Cycles # fig, ax = initializeFig(xlim, ylim) - defaultShowCycles(self, xyHys[:,0], xyHys[:,1], plotCycles, plotPeaks, labelCycles, Cycles) + self.showCycles(self, xyHys[:,0], xyHys[:,1], plotCycles, plotPeaks, labelCycles, Cycles) colorDict = self.colorDict @@ -495,7 +497,7 @@ def plotSubCycles(self, SubCyclesIndicies = [], plotCycles = False, plotPeaks = xyMono = self.xy Vectors = self.SubCycles - defaultShowCycles(self, xyMono[:,0], xyMono[:,1], plotCycles, plotPeaks) + self.showCycles(self, xyMono[:,0], xyMono[:,1], plotCycles, plotPeaks) colorDict = self.colorDict if len(SubCyclesIndicies) == 0: diff --git a/src/climate.py b/src/climate.py index 3bb9634..1b798f4 100644 --- a/src/climate.py +++ b/src/climate.py @@ -1,7 +1,7 @@ import numpy as np -from .baseClass import CurveBase, initializeFig +from .baseClass import CurveBase import matplotlib.pyplot as plt from scipy.optimize import curve_fit diff --git a/src/compare.py b/src/compare.py index d61429c..a2b7368 100644 --- a/src/compare.py +++ b/src/compare.py @@ -1,6 +1,6 @@ import hysteresis.env as env -from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff +# from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff from .resample import resample @@ -9,8 +9,7 @@ # ============================================================================= # TODO: consider storing the sample function within the class itself. -def compareCycle(Curve1, Curve2, Nsample = 10, - sampleFunction = defaultSampleFunction): +def compareCycle(Curve1, Curve2, Nsample = 10): """ Compares two Curve objects by resampling them using linear interplation, then comparing the distance between both cycles in a comon domain. @@ -50,7 +49,7 @@ def compareCycle(Curve1, Curve2, Nsample = 10, return diff -def compareHys(Hys1, Hys2, combineDiff = defaultCombineDiff): +def compareHys(Hys1, Hys2): """