Skip to content

fix import modules, py2->py3 #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/diffpy/srmise/peakextraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import numpy as np

from diffpy.srmise import srmiselog
from diffpy.srmise.baselines import Baseline
from diffpy.srmise.baselines.base import Baseline
from diffpy.srmise.dataclusters import DataClusters
from diffpy.srmise.modelcluster import ModelCluster, ModelCovariance
from diffpy.srmise.peaks import Peak, Peaks
from diffpy.srmise.peaks.base import Peak, Peaks
from diffpy.srmise.srmiseerrors import SrMiseDataFormatError, SrMiseEstimationError, SrMiseFileError

logger = logging.getLogger("diffpy.srmise")
Expand Down Expand Up @@ -131,7 +131,7 @@ def setvars(self, quiet=False, **kwds):
initial_peaks: Peaks instance. These peaks are present at the start of extraction.
rng: Sequence specifying the least and greatest x-values over which to extract peaks.
"""
for k, v in kwds.iteritems():
for k, v in kwds.items():
if k in self.extractvars:
if quiet:
logger.debug("Setting variable %s=%s", k, v)
Expand Down Expand Up @@ -183,7 +183,7 @@ def defaultvars(self, *args):
self.effective_dy = self.effective_dy * np.ones(len(self.x))

if self.pf is None or "pf" in args:
from diffpy.srmise.peaks import GaussianOverR
from diffpy.srmise.peaks.gaussianoverr import GaussianOverR

# TODO: Make a more useful default.
self.pf = [GaussianOverR(self.x[-1] - self.x[0])]
Expand All @@ -208,13 +208,13 @@ def defaultvars(self, *args):
self.baseline = None

if self.baseline is None or "baseline" in args:
from diffpy.srmise.baselines import Polynomial
from diffpy.srmise.baselines.polynomial import Polynomial

bl = Polynomial(degree=-1)
self.baseline = bl.actualize(np.array([]), "internal")

if self.error_method is None or "error_method" in args:
from diffpy.srmise.modelevaluators import AIC
from diffpy.srmise.modelevaluators.aic import AIC

self.error_method = AIC

Expand Down Expand Up @@ -1307,8 +1307,8 @@ def fit_single(self):

from numpy.random import randn

from diffpy.srmise.modelevaluators import AICc
from diffpy.srmise.peaks import GaussianOverR
from diffpy.srmise.modelevaluators.aicc import AICc
from diffpy.srmise.peaks.gaussianoverr import GaussianOverR

srmiselog.setlevel("info")
srmiselog.liveplotting(False)
Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/srmise/peakstability.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import matplotlib.pyplot as plt
import numpy as np

from diffpy.srmise import ModelCluster, PDFPeakExtraction
from diffpy.srmise.modelcluster import ModelCluster
from diffpy.srmise.pdfpeakextraction import PDFPeakExtraction


# This is a total hack-job right now, and isn't suitable for
Expand Down
1 change: 0 additions & 1 deletion src/diffpy/srmise/srmiselog.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def read(self, filename):
err,
)
raise SrMiseFileError(emsg)
return None

def readstr(self, datastring):
"""Read tracer ModelCluster from string.
Expand Down
Loading