Skip to content

Commit

Permalink
peakextraction.py and init
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Jul 31, 2024
1 parent c0d43e6 commit 1248ed4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions diffpy/srmise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@


from diffpy.srmise.version import __version__

# silence the pyflakes syntax checker
assert __version__ or True
17 changes: 8 additions & 9 deletions diffpy/srmise/peakextraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@
import matplotlib.pyplot as plt
import numpy as np

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

logger = logging.getLogger("diffpy.srmise")

from diffpy.srmise import srmiselog


class PeakExtraction(object):
"""Class for peak extraction.
Expand Down Expand Up @@ -461,8 +459,8 @@ def readstr(self, datastring):
# raise SrMiseDataFormatError if something goes wrong
try:
for line in start_data.split("\n"):
l = line.split()
if len(arrays) != len(l):
split_line = line.split()
if len(arrays) != len(split_line):
emsg = "Number of value fields does not match that given by '%s'" % start_data_info
for a, v in zip(arrays, line.split()):
a.append(float(v))
Expand Down Expand Up @@ -892,7 +890,8 @@ def extract_single(self, recursion_depth=1):
# left_data, right_data: indices defining the extent of the "interpeak range" for x, etc.
near_peaks = np.array([], dtype=np.int)

# interpeak range goes from peak to peak of next nearest peaks, although their contributions to the data are still removed.
# interpeak range goes from peak to peak of next nearest peaks, although their contributions
# to the data are still removed.
if pivot == 0:
# No peaks left of border_x!
left_data = full_cluster.slice.indices(len(x))[0]
Expand Down Expand Up @@ -1035,7 +1034,8 @@ def extract_single(self, recursion_depth=1):
# left_data, right_data: indices defining the extent of the "interpeak range" for x, etc.
near_peaks = np.array([], dtype=np.int)

# interpeak range goes from peak to peak of next nearest peaks, although their contributions to the data are still removed.
# interpeak range goes from peak to peak of next nearest peaks, although their contributions
# to the data are still removed.
if pivot == 0:
# No peaks left of border_x!
left_data = new_cluster.slice.indices(len(x))[0]
Expand Down Expand Up @@ -1307,7 +1307,6 @@ def fit_single(self):

from numpy.random import randn

from diffpy.srmise import srmiselog
from diffpy.srmise.modelevaluators import AICc
from diffpy.srmise.peaks import GaussianOverR

Expand Down

0 comments on commit 1248ed4

Please sign in to comment.