From 978dca163b9920eea63b0cf148e5934f48a649ce Mon Sep 17 00:00:00 2001 From: Rundong Hua <157993340+stevenhua0320@users.noreply.github.com> Date: Wed, 31 Jul 2024 02:16:07 +0800 Subject: [PATCH] fix formatting issue and typo in copyright (#35) --- diffpy/srmise/basefunction.py | 3 +-- diffpy/srmise/baselines/arbitrary.py | 14 +++++++------- diffpy/srmise/baselines/base.py | 2 +- diffpy/srmise/baselines/fromsequence.py | 2 +- diffpy/srmise/baselines/nanospherical.py | 4 ++-- diffpy/srmise/baselines/polynomial.py | 10 ++++------ diffpy/srmise/dataclusters.py | 2 +- diffpy/srmise/modelcluster.py | 2 +- diffpy/srmise/modelevaluators/aic.py | 2 +- diffpy/srmise/modelevaluators/aicc.py | 2 +- diffpy/srmise/modelevaluators/base.py | 2 +- diffpy/srmise/peaks/base.py | 2 +- diffpy/srmise/peaks/gaussian.py | 2 +- diffpy/srmise/peaks/gaussianoverr.py | 2 +- diffpy/srmise/peaks/terminationripples.py | 2 +- 15 files changed, 25 insertions(+), 28 deletions(-) diff --git a/diffpy/srmise/basefunction.py b/diffpy/srmise/basefunction.py index d0049a5..d5dd220 100644 --- a/diffpy/srmise/basefunction.py +++ b/diffpy/srmise/basefunction.py @@ -3,8 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/baselines/arbitrary.py b/diffpy/srmise/baselines/arbitrary.py index 6d1fe0d..bda2494 100644 --- a/diffpy/srmise/baselines/arbitrary.py +++ b/diffpy/srmise/baselines/arbitrary.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund @@ -89,11 +89,12 @@ def __init__(self, npars, valuef, jacobianf=None, estimatef=None, Cache=None): # TODO: figure out how the metadict can be used to save the functions # and use them again when a file is loaded... - metadict = {} - metadict["npars"] = (npars, repr) - metadict["valuef"] = (valuef, repr) - metadict["jacobianf"] = (jacobianf, repr) - metadict["estimatef"] = (estimatef, repr) + metadict = { + "npars": (npars, repr), + "valuef": (valuef, repr), + "jacobianf": (jacobianf, repr), + "estimatef": (estimatef, repr), + } BaselineFunction.__init__(self, parameterdict, formats, default_formats, metadict, None, Cache) # Methods required by BaselineFunction #### @@ -182,7 +183,6 @@ def _transform_parametersraw(self, pars, in_format, out_format): def _valueraw(self, pars, r): """Return value of polynomial for the given parameters and r values. - Parameters Parameters pars: Sequence of parameters pars[0] = a_0 diff --git a/diffpy/srmise/baselines/base.py b/diffpy/srmise/baselines/base.py index 7324f8d..ca58155 100644 --- a/diffpy/srmise/baselines/base.py +++ b/diffpy/srmise/baselines/base.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/baselines/fromsequence.py b/diffpy/srmise/baselines/fromsequence.py index 120a359..4d4c553 100644 --- a/diffpy/srmise/baselines/fromsequence.py +++ b/diffpy/srmise/baselines/fromsequence.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/baselines/nanospherical.py b/diffpy/srmise/baselines/nanospherical.py index 4781312..b45113b 100644 --- a/diffpy/srmise/baselines/nanospherical.py +++ b/diffpy/srmise/baselines/nanospherical.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund @@ -35,7 +35,7 @@ class NanoSpherical(BaselineFunction): scale factor is 4*pi*rho_0, where rho_r is the nanoparticle density. gamma_0(r) Reference: - Guinier et. al. (1955). Small-angle Scattering from X-rays. New York: John Wiley & Sons, Inc. + Guinier et al. (1955). Small-angle Scattering from X-rays. New York: John Wiley & Sons, Inc. """ def __init__(self, Cache=None): diff --git a/diffpy/srmise/baselines/polynomial.py b/diffpy/srmise/baselines/polynomial.py index d7ba84a..70498be 100644 --- a/diffpy/srmise/baselines/polynomial.py +++ b/diffpy/srmise/baselines/polynomial.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund @@ -49,8 +49,7 @@ def __init__(self, degree, Cache=None): parameterdict["a_" + str(d)] = self.degree - d formats = ["internal"] default_formats = {"default_input": "internal", "default_output": "internal"} - metadict = {} - metadict["degree"] = (degree, repr) + metadict = {"degree": (degree, repr)} BaselineFunction.__init__(self, parameterdict, formats, default_formats, metadict, None, Cache) # Methods required by BaselineFunction #### @@ -95,12 +94,11 @@ def estimate_parameters(self, r, y): import numpy.linalg as la - A = np.array([r[cut_idx]]).T - slope = la.lstsq(A, y[cut_idx])[0][0] + a = np.array([r[cut_idx]]).T + slope = la.lstsq(a, y[cut_idx])[0][0] return np.array([slope, 0.0]) except Exception as e: emsg = "Error during estimation -- " + str(e) - raise raise SrMiseEstimationError(emsg) def _jacobianraw(self, pars, r, free): diff --git a/diffpy/srmise/dataclusters.py b/diffpy/srmise/dataclusters.py index 6b64333..d87a6b9 100644 --- a/diffpy/srmise/dataclusters.py +++ b/diffpy/srmise/dataclusters.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/modelcluster.py b/diffpy/srmise/modelcluster.py index d7d1742..cf952b2 100644 --- a/diffpy/srmise/modelcluster.py +++ b/diffpy/srmise/modelcluster.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/modelevaluators/aic.py b/diffpy/srmise/modelevaluators/aic.py index a8d870b..e3ee9e4 100644 --- a/diffpy/srmise/modelevaluators/aic.py +++ b/diffpy/srmise/modelevaluators/aic.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/modelevaluators/aicc.py b/diffpy/srmise/modelevaluators/aicc.py index 18e950b..be1052f 100644 --- a/diffpy/srmise/modelevaluators/aicc.py +++ b/diffpy/srmise/modelevaluators/aicc.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/modelevaluators/base.py b/diffpy/srmise/modelevaluators/base.py index b51e965..2e97b3a 100644 --- a/diffpy/srmise/modelevaluators/base.py +++ b/diffpy/srmise/modelevaluators/base.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/peaks/base.py b/diffpy/srmise/peaks/base.py index 47e7a78..653a0e3 100644 --- a/diffpy/srmise/peaks/base.py +++ b/diffpy/srmise/peaks/base.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/peaks/gaussian.py b/diffpy/srmise/peaks/gaussian.py index 2c12788..ad2530b 100644 --- a/diffpy/srmise/peaks/gaussian.py +++ b/diffpy/srmise/peaks/gaussian.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/peaks/gaussianoverr.py b/diffpy/srmise/peaks/gaussianoverr.py index d5e8656..a5f9794 100644 --- a/diffpy/srmise/peaks/gaussianoverr.py +++ b/diffpy/srmise/peaks/gaussianoverr.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund diff --git a/diffpy/srmise/peaks/terminationripples.py b/diffpy/srmise/peaks/terminationripples.py index f916d3b..e814820 100644 --- a/diffpy/srmise/peaks/terminationripples.py +++ b/diffpy/srmise/peaks/terminationripples.py @@ -3,7 +3,7 @@ # # SrMise by Luke Granlund # (c) 2014 trustees of the Michigan State University -# (c) 2024 trustees of Columia University in the City of New York +# (c) 2024 trustees of Columbia University in the City of New York # All rights reserved. # # File coded by: Luke Granlund