Skip to content

Commit

Permalink
removing some old refernces to functions
Browse files Browse the repository at this point in the history
Udating older functions so that there is no reference to them. The new environment class replaces all the old references.
  • Loading branch information
cslotboom committed Jan 25, 2021
1 parent 6939a24 commit 9a50c62
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 46 deletions.
15 changes: 2 additions & 13 deletions doc/readthedocs/hysteresis/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,5 +10,5 @@
# from .env import HYSTERESIS_ENVIRONMENT
# environment = HYSTERESIS_ENVIRONMENT()

from .env import environment
environment.restart()
# from .env import environment
# environment.restart()
12 changes: 7 additions & 5 deletions doc/readthedocs/hysteresis/baseClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion doc/readthedocs/hysteresis/climate.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 3 additions & 4 deletions doc/readthedocs/hysteresis/compare.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import hysteresis.env as env
from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff
# from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff
from .resample import resample


Expand All @@ -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.
Expand Down Expand Up @@ -50,7 +49,7 @@ def compareCycle(Curve1, Curve2, Nsample = 10,

return diff

def compareHys(Hys1, Hys2, combineDiff = defaultCombineDiff):
def compareHys(Hys1, Hys2):
"""
Expand Down
15 changes: 2 additions & 13 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,5 +10,5 @@
# from .env import HYSTERESIS_ENVIRONMENT
# environment = HYSTERESIS_ENVIRONMENT()

from .env import environment
environment.restart()
# from .env import environment
# environment.restart()
12 changes: 7 additions & 5 deletions src/baseClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/climate.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/compare.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import hysteresis.env as env
from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff
# from .defaultDataFuncs import defaultSampleFunction, defaultCombineDiff
from .resample import resample


Expand All @@ -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.
Expand Down Expand Up @@ -50,7 +49,7 @@ def compareCycle(Curve1, Curve2, Nsample = 10,

return diff

def compareHys(Hys1, Hys2, combineDiff = defaultCombineDiff):
def compareHys(Hys1, Hys2):
"""
Expand Down

0 comments on commit 9a50c62

Please sign in to comment.