Skip to content
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

test #39

Closed
wants to merge 20 commits into from
Closed

test #39

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5684c18
Lint check & fix to python3 format (#18)
stevenhua0320 Jul 29, 2024
a4221ff
lint check & change to python3 & pre-commit check (#19)
stevenhua0320 Jul 29, 2024
866e714
lint check and fix print and exception python2 issue (#20)
stevenhua0320 Jul 29, 2024
c28b97b
lint check and fix python2 print and exception issues (#21)
stevenhua0320 Jul 29, 2024
ff0fc58
finish parenthesizing print statements (#24)
sbillinge Jul 29, 2024
7c77b11
fix too many leading #, import modules, and unused var (#29)
stevenhua0320 Jul 30, 2024
21d1a53
requirements (#30)
sbillinge Jul 30, 2024
181a54a
fix import module not used & string check (#25)
stevenhua0320 Jul 30, 2024
8772a95
fix too many leading "#" in string block (#26)
stevenhua0320 Jul 30, 2024
ffe5fc7
lint check, remove unused import modules & remove too many "#". (#27)
stevenhua0320 Jul 30, 2024
edaa35d
remove unused modules, ambiguous variable name (#28)
stevenhua0320 Jul 30, 2024
1f67292
cleaning (#31)
sbillinge Jul 30, 2024
30d0909
Copyright (#32)
sbillinge Jul 30, 2024
7dd69bc
lint check, fix break import modules, remove unused import modules, r…
stevenhua0320 Jul 30, 2024
81b261b
fix break import modules, remove unused import modules, fix docstring…
stevenhua0320 Jul 30, 2024
978dca1
fix formatting issue and typo in copyright (#35)
stevenhua0320 Jul 30, 2024
b61a877
clean out inits
sbillinge Jul 31, 2024
ab27182
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Jul 31, 2024
cf2e82f
dataclusters.py, modelevaluators/aicc and modelparts.py
sbillinge Jul 31, 2024
caeb1fc
Merge branch 'test' of github.com:sbillinge/diffpy.srmise into test
sbillinge Jul 31, 2024
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
8 changes: 4 additions & 4 deletions devutils/makesdist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ sys.path.insert(0, BASEDIR)
from setup import versiondata
timestamp = versiondata.getint('DEFAULT', 'timestamp')

print 'Run "setup.py sdist --formats=tar"',
print('Run "setup.py sdist --formats=tar"',)
cmd_sdist = [sys.executable] + 'setup.py sdist --formats=tar'.split()
ec = subprocess.call(cmd_sdist, cwd=BASEDIR, stdout=open(os.devnull, 'w'))
if ec: sys.exit(ec)
print "[done]"
print("[done]")

tarname = max(glob.glob(BASEDIR + '/dist/*.tar'), key=os.path.getmtime)

Expand All @@ -36,8 +36,8 @@ def fixtarinfo(tinfo):
return tinfo


print 'Filter %s --> %s.gz' % (2 * (os.path.basename(tarname),)),
print('Filter %s --> %s.gz' % (2 * (os.path.basename(tarname),)),)
for ti in tfin:
tfout.addfile(fixtarinfo(ti), tfin.extractfile(ti))
os.remove(tarname)
print "[done]"
print("[done]")
52 changes: 27 additions & 25 deletions devutils/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

__basedir__ = os.getcwdu()

from numpy.compat import unicode

# Example imports


Expand All @@ -18,20 +20,21 @@ def __init__(self):

def test(self, call, *args, **kwds):
m = sys.modules[call.__module__]
testname = m.__name__+'.'+call.__name__
testname = m.__name__ + "." + call.__name__
path = os.path.dirname(m.__file__)
os.chdir(path)
try:
call(*args, **kwds)
self.messages.append("%s: success" %testname)
except Exception, e:
self.messages.append("%s: error, details below.\n%s" %(testname, e))
self.messages.append("%s: success" % testname)
except Exception as e:
self.messages.append("%s: error, details below.\n%s" % (testname, e))
finally:
os.chdir(__basedir__)

def report(self):
print '==== Results of Tests ===='
print '\n'.join(self.messages)
print("==== Results of Tests ====")
print("\n".join(self.messages))


def scrubeol(directory, filerestr):
"""Use unix-style endlines for files in directory matched by regex string.
Expand All @@ -50,11 +53,11 @@ def scrubeol(directory, filerestr):
text = unicode(original.read())
original.close()

updated = io.open(f, 'w', newline='\n')
updated = io.open(f, "w", newline="\n")
updated.write(text)
updated.close()

print "Updated %s to unix-style endlines." %f
print("Updated %s to unix-style endlines." % f)


def rm(directory, filerestr):
Expand All @@ -72,30 +75,31 @@ def rm(directory, filerestr):
for f in files:
os.remove(f)

print "Deleted %s." %f

print("Deleted %s." % f)


if __name__ == "__main__":

# Temporarily add examples to path
lib_path = os.path.abspath(os.path.join('..','doc','examples'))
lib_path = os.path.abspath(os.path.join("..", "doc", "examples"))
sys.path.append(lib_path)

# Delete existing files that don't necessarily have a fixed name.
rm("../doc/examples/output", r"known_dG.*\.pwa")
rm("../doc/examples/output", r"unknown_dG.*\.pwa")

### Testing examples
# Testing examples
examples = Test()
test_names = ["extract_single_peak",
"parameter_summary",
"fit_initial",
"query_results",
"multimodel_known_dG1",
"multimodel_known_dG2",
"multimodel_unknown_dG1",
"multimodel_unknown_dG2"]
test_names = [
"extract_single_peak",
"parameter_summary",
"fit_initial",
"query_results",
"multimodel_known_dG1",
"multimodel_known_dG2",
"multimodel_unknown_dG1",
"multimodel_unknown_dG2",
]

test_modules = []
for test in test_names:
Expand All @@ -106,10 +110,8 @@ def rm(directory, filerestr):

examples.report()

### Convert output of example files to Unix-style endlines for sdist.
if os.linesep != '\n':
print "==== Scrubbing Endlines ===="
# Convert output of example files to Unix-style endlines for sdist.
if os.linesep != "\n":
print("==== Scrubbing Endlines ====")
# All *.srmise and *.pwa files in examples directory.
scrubeol("../doc/examples/output", r".*(\.srmise|\.pwa)")


26 changes: 2 additions & 24 deletions diffpy/srmise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
##############################################################################
#
# SrMise by Luke Granlund
# (c) 2014 trustees of the Michigan State University.
# (c) 2014 trustees of the Michigan State University
# (c) 2024 trustees of Columia University in the City of New York
# All rights reserved.
#
# File coded by: Luke Granlund
Expand All @@ -13,28 +14,5 @@

"""Tools for peak extraction from PDF."""

__all__ = [
"basefunction",
"srmiseerrors",
"srmiselog",
"dataclusters",
"modelcluster",
"modelparts",
"pdfdataset",
"pdfpeakextraction",
"peakextraction",
"peakstability",
"multimodelselection",
]

from basefunction import BaseFunction
from dataclusters import DataClusters
from modelcluster import ModelCluster, ModelCovariance
from modelparts import ModelPart, ModelParts
from multimodelselection import MultimodelSelection
from pdfdataset import PDFDataSet
from pdfpeakextraction import PDFPeakExtraction
from peakextraction import PeakExtraction
from peakstability import PeakStability

from diffpy.srmise.version import __version__
3 changes: 2 additions & 1 deletion diffpy/srmise/applications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
##############################################################################
#
# SrMise by Luke Granlund
# (c) 2014 trustees of the Michigan State University.
# (c) 2014 trustees of the Michigan State University
# (c) 2024 trustees of Columia University in the City of New York
# All rights reserved.
#
# File coded by: Luke Granlund
Expand Down
Loading
Loading