diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt index 04b4fcfa..3e653cfb 100644 --- a/.codespell/ignore_words.txt +++ b/.codespell/ignore_words.txt @@ -6,3 +6,9 @@ mater ;; Frobenius norm used in np.linalg.norm fro + +;; nin is a legit variable in builder +nin + +;; highT is used for high Temperature in examples/debymodelII +highT diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3de77be9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,118 +0,0 @@ -dist: xenial -language: generic - -os: - - linux - - osx - -env: - - MYUSEMC=true MYPYTHON_VERSION=2.7 - - MYUSEMC=true MYPYTHON_VERSION=3.5 - - MYUSEMC=true MYPYTHON_VERSION=3.6 - - MYUSEMC=true MYPYTHON_VERSION=3.7 - - MYUSEMC=false - -git: - depth: 999999 - -branches: - except: - - /^v[0-9]/ - -before_install: - - MYNAME=diffpy.srfit - - MYCOMMIT="$(git rev-parse HEAD)" - - umask 022 - - git fetch origin --tags - - MYPYTHON=python; MYPIP=pip - - NOSYS=true; NOAPT=true; NOBREW=true; NOMC=true - - if ${MYUSEMC}; then - NOMC=false; - elif [[ ${TRAVIS_OS_NAME} == linux ]]; then - NOAPT=false; NOSYS=false; - MYPIPFLAGS="--user"; - elif [[ ${TRAVIS_OS_NAME} == osx ]]; then - NOBREW=false; NOSYS=false; - MYPYTHON=python3; - MYPIP=pip3; - MYPIPFLAGS="--user"; - fi - - MYMCREPO=https://repo.anaconda.com/miniconda - - case ${TRAVIS_OS_NAME} in - linux) - MYMCBUNDLE=Miniconda3-latest-Linux-x86_64.sh ;; - osx) - MYMCBUNDLE=Miniconda3-latest-MacOSX-x86_64.sh ;; - *) - echo "Unsupported operating system." >&2; - exit 2 ;; - esac - - MYRUNDIR=${PWD}/build/rundir - - - mkdir -p ~/pkgs - - mkdir -p ${MYRUNDIR} - - cp .coveragerc ${MYRUNDIR}/ - - - $NOMC || pushd ~/pkgs - - $NOMC || wget --timestamping ${MYMCREPO}/${MYMCBUNDLE} - - $NOMC || test -x ~/mc/bin/conda || bash ${MYMCBUNDLE} -b -f -p ~/mc - - $NOMC || popd - - $NOMC || source ~/mc/bin/activate base - - $NOMC || conda update --yes conda - - $NOMC || conda install --yes conda-build conda-verify jinja2 - - $NOMC || conda create --name=testenv --yes python=${MYPYTHON_VERSION} coverage - - $NOMC || conda config --add channels diffpy - - - $NOAPT || test "${TRAVIS_OS_NAME}" = "linux" || exit $? - - $NOAPT || PATH="$(echo "$PATH" | sed 's,:/opt/pyenv/[^:]*,,g')" - - $NOAPT || test "$(which python)" = "/usr/bin/python" || ( - which python; exit 1) - - $NOAPT || sudo apt-get update -qq - - $NOAPT || sudo apt-get install -y - python-dev python-setuptools python-numpy - build-essential - - - $NOBREW || test "${TRAVIS_OS_NAME}" = "osx" || exit $? - - $NOBREW || brew update - - $NOBREW || brew upgrade python - - $NOBREW || brew install gcc || brew link --overwrite gcc - - - $NOSYS || devutils/makesdist - - $NOSYS || MYTARBUNDLE="$(ls -t "${PWD}"/dist/*.tar.gz | head -1)" - -install: - - $NOMC || conda build --python=${MYPYTHON_VERSION} conda-recipe - - $NOMC || conda render --python=${MYPYTHON_VERSION} --output conda-recipe | - sed 's,.*/,,; s/[.]tar[.]bz2$//; s/-/=/g' > /tmp/mypackage.txt - - $NOMC || source activate testenv - - $NOMC || conda install --yes --use-local --file=/tmp/mypackage.txt - - $NOMC || conda install --yes - diffpy.structure pyobjcryst "diffpy.srreal>=1.3.0" - # TODO - always install srfit-sasview when ready for Python 3. - - if $MYUSEMC && [[ "$MYPYTHON_VERSION" == 2.7 ]]; then - conda install --yes srfit-sasview; - fi - - - $NOSYS || $MYPIP install $MYPIPFLAGS coverage - - $NOSYS || $MYPIP install $MYPIPFLAGS pycifrw - - $NOSYS || $MYPIP install $MYPIPFLAGS diffpy.structure - - $NOSYS || $MYPIP install $MYPIPFLAGS "${MYTARBUNDLE}" - - - cd ${MYRUNDIR} - - MYGIT_REV=$($MYPYTHON -c "import ${MYNAME}.version as v; print(v.__git_commit__)") - - if [[ "${MYCOMMIT}" != "${MYGIT_REV}" ]]; then - echo "Version mismatch ${MYCOMMIT} vs ${MYGIT_REV}."; - exit 1; - fi - -before_script: - - $NOBREW || USER_BASE="$(python3 -c 'import site; print(site.USER_BASE)')" - - $NOBREW || PATH="${USER_BASE}/bin:${PATH}" - -script: - - coverage run --source ${MYNAME} -m ${MYNAME}.tests.run - -after_success: - # do not post coverage reports when testing with system Python. - - $NOMC || $MYPIP install $MYPIPFLAGS codecov - - $NOMC || codecov diff --git a/doc/examples/coreshellnp.py b/doc/examples/coreshellnp.py index 2ac0a2c5..8030a346 100644 --- a/doc/examples/coreshellnp.py +++ b/doc/examples/coreshellnp.py @@ -101,7 +101,7 @@ def makeRecipe(stru1, stru2, datname): recipe.constrain(generator_zns.scale, "1 - scale_CdS") # We also want the resolution factor to be the same on each. - # Vary the gloabal scale as well. + # Vary the global scale as well. recipe.addVar(contribution.scale, 0.3) # Now we can configure the structural parameters. We tag the different diff --git a/doc/examples/crystalpdf.py b/doc/examples/crystalpdf.py index d770b11c..0d668da5 100644 --- a/doc/examples/crystalpdf.py +++ b/doc/examples/crystalpdf.py @@ -16,7 +16,7 @@ This is example of fitting the fcc nickel structure to measured PDF data. The purpose of this example is to demonstrate and describe the -classes in configuraiton options involved with setting up a fit in this +classes in configuration options involved with setting up a fit in this way. The main benefit of using SrFit for PDF refinement is the flexibility of modifying the PDF profile function for specific needs, adding restraints to a fit and the ability to simultaneously refine a diff --git a/doc/examples/crystalpdfall.py b/doc/examples/crystalpdfall.py index ea2990bb..918b7a9d 100644 --- a/doc/examples/crystalpdfall.py +++ b/doc/examples/crystalpdfall.py @@ -132,7 +132,7 @@ def makeRecipe( recipe.constrain(xgenerator_sini_si.scale, "1 - pscale_sini_ni") # The qdamp parameters are too correlated to vary so we fix them based on - # previous measurments. + # previous measurements. xgenerator_ni.qdamp.value = 0.055 xgenerator_si.qdamp.value = 0.051 ngenerator_ni.qdamp.value = 0.030 diff --git a/doc/examples/crystalpdftwodata.py b/doc/examples/crystalpdftwodata.py index 12e9e9f1..cd2aa0c6 100644 --- a/doc/examples/crystalpdftwodata.py +++ b/doc/examples/crystalpdftwodata.py @@ -117,7 +117,7 @@ def makeRecipe(ciffile, xdatname, ndatname): recipe.addVar(ngenerator.scale, 1, "nscale") recipe.addVar(xgenerator.qdamp, 0.01, "xqdamp") recipe.addVar(ngenerator.qdamp, 0.01, "nqdamp") - # delta2 is a non-structual material propery. Thus, we constrain together + # delta2 is a non-structual material property. Thus, we constrain together # delta2 Parameter from each PDFGenerator. delta2 = recipe.newVar("delta2", 2) recipe.constrain(xgenerator.delta2, delta2) diff --git a/doc/examples/crystalpdftwophase.py b/doc/examples/crystalpdftwophase.py index a5958554..b0fcf30d 100644 --- a/doc/examples/crystalpdftwophase.py +++ b/doc/examples/crystalpdftwophase.py @@ -96,7 +96,7 @@ def makeRecipe(niciffile, siciffile, datname): recipe.constrain(generator_ni.qdamp, "qdamp") recipe.constrain(generator_si.qdamp, "qdamp") - # Vary the gloabal scale as well. + # Vary the global scale as well. recipe.addVar(contribution.scale, 1) # Now we can configure the structural parameters. Since we're using diff --git a/doc/examples/debyemodel.py b/doc/examples/debyemodel.py index a53d24f2..0ec673a7 100644 --- a/doc/examples/debyemodel.py +++ b/doc/examples/debyemodel.py @@ -145,7 +145,7 @@ def makeRecipe(): # We would like to 'suggest' that the offset should remain positive. This # is somethine that we know about the system that might help the refinement # converge to a physically reasonable result. We will do this with a soft - # contraint, or restraint. Here we restrain the offset variable to between + # constraint, or restraint. Here we restrain the offset variable to between # 0 and infinity. We tell the recipe that we want to scale the penalty for # breaking the restraint by the point-average chi^2 value so that the # restraint is roughly as significant as any other data point throughout diff --git a/doc/examples/ellipsoidsas.py b/doc/examples/ellipsoidsas.py index ece4f73a..b3e8d18e 100644 --- a/doc/examples/ellipsoidsas.py +++ b/doc/examples/ellipsoidsas.py @@ -71,7 +71,7 @@ def makeRecipe(datname): ## Configure the fit variables # The SASGenerator uses the parameters from the params and dispersion - # attribues of the model. These vary from model to model, but are adopted + # attributes of the model. These vary from model to model, but are adopted # as SrFit Parameters within the generator. Whereas the dispersion # parameters are accessible as, e.g. "radius.width", within the # SASGenerator these are named like "radius_width". diff --git a/doc/examples/gaussianrecipe.py b/doc/examples/gaussianrecipe.py index d82ad4d0..8f762ba7 100644 --- a/doc/examples/gaussianrecipe.py +++ b/doc/examples/gaussianrecipe.py @@ -31,7 +31,7 @@ Extensions -After reading through the code, try to perform the folowing tasks. The process +After reading through the code, try to perform the following tasks. The process will leave you with a much better understanding of how SrFit works. - Play around with setting the values of the Variables and Parameters. What diff --git a/doc/examples/npintensity.py b/doc/examples/npintensity.py index 5cad99a6..64498fc6 100644 --- a/doc/examples/npintensity.py +++ b/doc/examples/npintensity.py @@ -508,7 +508,7 @@ def makeData(strufile, q, datname, scale, a, Uiso, sig, bkgc, nl=1): y += bkgd - # Multipy by a scale factor + # Multiply by a scale factor y *= scale # Calculate the uncertainty diff --git a/doc/examples/simplepdftwophase.py b/doc/examples/simplepdftwophase.py index af1c1dae..526c4780 100644 --- a/doc/examples/simplepdftwophase.py +++ b/doc/examples/simplepdftwophase.py @@ -52,7 +52,7 @@ def makeRecipe(niciffile, siciffile, datname): # for free by the PDFContribution. We simply need to add it to the recipe. recipe.addVar(contribution.qdamp, 0.03) - # Vary the gloabal scale as well. + # Vary the global scale as well. recipe.addVar(contribution.scale, 1) # Now we can configure the structural parameters. Since we're using diff --git a/src/diffpy/srfit/equation/builder.py b/src/diffpy/srfit/equation/builder.py index 8e76a105..d19a17a4 100644 --- a/src/diffpy/srfit/equation/builder.py +++ b/src/diffpy/srfit/equation/builder.py @@ -368,7 +368,7 @@ def _getUndefinedArgs(self, eqstr): # builders. These will be treated as arguments that need to be # generated. for tok in set(args): - # Move genuine varibles to the eqargs dictionary + # Move genuine variables to the eqargs dictionary if ( # Check registered builders tok in self.builders @@ -427,13 +427,13 @@ def __evalBinary(self, other, OperatorClass, onleft=True): Other can be an BaseBuilder or a constant. onleft -- Indicates that the operator was passed on the left side - (defualt True). + (default True). """ # Create the Operator op = OperatorClass() # onleft takes care of non-commutative operators, and assures that the - # ordering is perserved. + # ordering is preserved. if onleft: # Add the literals to the operator op.addLiteral(self.literal) diff --git a/src/diffpy/srfit/equation/equationmod.py b/src/diffpy/srfit/equation/equationmod.py index 80f6262d..091f7a55 100644 --- a/src/diffpy/srfit/equation/equationmod.py +++ b/src/diffpy/srfit/equation/equationmod.py @@ -164,7 +164,7 @@ def setRoot(self, root): def __call__(self, *args, **kw): """Call the equation. - New Argument values are acceped as arguments or keyword + New Argument values are accepted as arguments or keyword assignments (or both). The order of accepted arguments is given by the args attribute. The Equation will remember values set in this way. diff --git a/src/diffpy/srfit/equation/literals/argument.py b/src/diffpy/srfit/equation/literals/argument.py index eed3803a..9f9f1cd7 100644 --- a/src/diffpy/srfit/equation/literals/argument.py +++ b/src/diffpy/srfit/equation/literals/argument.py @@ -14,7 +14,7 @@ ############################################################################## """Argument class. -Arguments are the leaves of an equation tree, in essense a variable or a +Arguments are the leaves of an equation tree, in essence a variable or a constant. """ diff --git a/src/diffpy/srfit/equation/visitors/argfinder.py b/src/diffpy/srfit/equation/visitors/argfinder.py index b0338c92..089c8bcc 100644 --- a/src/diffpy/srfit/equation/visitors/argfinder.py +++ b/src/diffpy/srfit/equation/visitors/argfinder.py @@ -34,7 +34,7 @@ def __init__(self, getconsts=True): """Initialize. Arguments - getconsts -- Flag indicating whether to grap constant arguments + getconsts -- Flag indicating whether to parse constant arguments (default True). """ self.args = [] diff --git a/src/diffpy/srfit/fitbase/configurable.py b/src/diffpy/srfit/fitbase/configurable.py index 8de392e1..4aecfd5e 100644 --- a/src/diffpy/srfit/fitbase/configurable.py +++ b/src/diffpy/srfit/fitbase/configurable.py @@ -26,8 +26,8 @@ class Configurable(object): A Configurable has state of which a FitRecipe must be aware. Attributes - _configobjs -- Set of Configureables in a hierarcy or instances. - Messasges get passed up the hierarcy to a FitReciple + _configobjs -- Set of Configureables in a hierarchy or instances. + Messages get passed up the hierarchy to a FitReciple via these objects. """ diff --git a/src/diffpy/srfit/fitbase/fitcontribution.py b/src/diffpy/srfit/fitbase/fitcontribution.py index 3de608d4..7b5abbf1 100644 --- a/src/diffpy/srfit/fitbase/fitcontribution.py +++ b/src/diffpy/srfit/fitbase/fitcontribution.py @@ -19,7 +19,7 @@ optionally one or more ProfileGenerators or Calculators that help in this, and a Profile that holds the observed and calculated signals. -See the examples in the documention for how to use a FitContribution. +See the examples in the documentation for how to use a FitContribution. """ __all__ = ["FitContribution"] @@ -36,7 +36,7 @@ class FitContribution(ParameterSet): FitContributions organize an Equation that calculates the signal, and a Profile that holds the signal. ProfileGenerators and Calculators can be - used as well. Contraints and Restraints can be created as part of a + used as well. Constraints and Restraints can be created as part of a FitContribution. Attributes diff --git a/src/diffpy/srfit/fitbase/fitrecipe.py b/src/diffpy/srfit/fitbase/fitrecipe.py index 8539ab53..f6f0cbd7 100644 --- a/src/diffpy/srfit/fitbase/fitrecipe.py +++ b/src/diffpy/srfit/fitbase/fitrecipe.py @@ -517,7 +517,7 @@ def newVar(self, name, value=None, fixed=False, tag=None, tags=[]): This method lets new variables be created that are not tied to a Parameter. Orphan variables may cause a fit to fail, depending on the optimization routine, and therefore should only be created to be used - in contraint or restraint equations. + in constraint or restraint equations. name -- The name of the variable. The variable will be able to be used by this name in restraint and constraint equations. diff --git a/src/diffpy/srfit/fitbase/fitresults.py b/src/diffpy/srfit/fitbase/fitresults.py index 4a12974c..26c32f5b 100644 --- a/src/diffpy/srfit/fitbase/fitresults.py +++ b/src/diffpy/srfit/fitbase/fitresults.py @@ -155,7 +155,7 @@ def update(self): self.residual = numpy.dot(res, res) self._calculateMetrics() - # Calcualte the restraints penalty + # Calculate the restraints penalty w = self.chi2 / len(res) self.penalty = sum([r.penalty(w) for r in recipe._restraintlist]) @@ -600,7 +600,7 @@ def _init(self, con, weight, fitres): # FIXME: factor rw, chi2, cumrw, cumchi2 to separate functions. def _calculateMetrics(self): - """Calculte chi2 and Rw of the recipe.""" + """Calculate chi2 and Rw of the recipe.""" # We take absolute values in case the signal is complex num = numpy.abs(self.y - self.ycalc) y = numpy.abs(self.y) diff --git a/src/diffpy/srfit/fitbase/profile.py b/src/diffpy/srfit/fitbase/profile.py index df129e5b..0da465fb 100644 --- a/src/diffpy/srfit/fitbase/profile.py +++ b/src/diffpy/srfit/fitbase/profile.py @@ -278,7 +278,7 @@ def setCalculationPoints(self, x): if (self.dyobs == 1).all(): self.dy = numpy.ones_like(self.x) else: - # FIXME - This does not follow error propogation rules and it + # FIXME - This does not follow error propagation rules and it # introduces (more) correlation between the data points. self.dy = rebinArray(self.dyobs, self.xobs, self.x) diff --git a/src/diffpy/srfit/fitbase/profileparser.py b/src/diffpy/srfit/fitbase/profileparser.py index 36ae244f..c38af1a0 100644 --- a/src/diffpy/srfit/fitbase/profileparser.py +++ b/src/diffpy/srfit/fitbase/profileparser.py @@ -46,7 +46,7 @@ class ProfileParser(object): dy -- A numpy array containing the uncertainty read from the file. This is None if the uncertainty cannot be read. - _x -- Indpendent variable from the chosen bank + _x -- Independent variable from the chosen bank _y -- Profile from the chosen bank _dx -- Uncertainty in independent variable from the chosen bank _dy -- Uncertainty in profile from the chosen bank diff --git a/src/diffpy/srfit/fitbase/recipeorganizer.py b/src/diffpy/srfit/fitbase/recipeorganizer.py index a39041f1..e4902734 100644 --- a/src/diffpy/srfit/fitbase/recipeorganizer.py +++ b/src/diffpy/srfit/fitbase/recipeorganizer.py @@ -479,7 +479,7 @@ def registerFunction(self, f, name=None, argnames=None): passed in the equation string, as this will be handled automatically. f -- The callable to register. If this is an Equation - instance, then all that needs to be provied is a name. + instance, then all that needs to be provided is a name. name -- The name of the function to be used in equations. If this is None (default), the method will try to determine the name of the function automatically. @@ -722,7 +722,7 @@ def unconstrain(self, *pars): def getConstrainedPars(self, recurse=False): """Get a list of constrained managed Parameters in this object. - recurse -- Recurse into managed objects and retrive their constrained + recurse -- Recurse into managed objects and retrieve their constrained Parameters as well (default False). """ const = self._getConstraints(recurse) @@ -762,7 +762,7 @@ def restrain(self, res, lb=-inf, ub=inf, sig=1, scaled=False, ns={}): The penalty is calculated as (max(0, lb - val, val - ub)/sig)**2 - and val is the value of the calculated equation. This is multipled by + and val is the value of the calculated equation. This is multiplied by the average chi^2 if scaled is True. Raises ValueError if ns uses a name that is already used for a diff --git a/src/diffpy/srfit/fitbase/restraint.py b/src/diffpy/srfit/fitbase/restraint.py index a80486d2..f7f2da3c 100644 --- a/src/diffpy/srfit/fitbase/restraint.py +++ b/src/diffpy/srfit/fitbase/restraint.py @@ -43,7 +43,7 @@ class Restraint(Validatable): The penalty is calculated as (max(0, lb - val, val - ub)/sig)**2 - and val is the value of the calculated equation. This is multipled by the + and val is the value of the calculated equation. This is multiplied by the average chi^2 if scaled is True. """ diff --git a/src/diffpy/srfit/pdf/basepdfgenerator.py b/src/diffpy/srfit/pdf/basepdfgenerator.py index 8eeb58da..3fd58805 100644 --- a/src/diffpy/srfit/pdf/basepdfgenerator.py +++ b/src/diffpy/srfit/pdf/basepdfgenerator.py @@ -89,7 +89,7 @@ def __init__(self, name="pdf"): _parnames = ["delta1", "delta2", "qbroad", "scale", "qdamp"] def _setCalculator(self, calc): - """Set the SrReal calulator instance. + """Set the SrReal calculator instance. Setting the calculator creates Parameters from the variable attributes of the SrReal calculator. diff --git a/src/diffpy/srfit/pdf/characteristicfunctions.py b/src/diffpy/srfit/pdf/characteristicfunctions.py index febdf269..3f8a1473 100644 --- a/src/diffpy/srfit/pdf/characteristicfunctions.py +++ b/src/diffpy/srfit/pdf/characteristicfunctions.py @@ -193,7 +193,7 @@ def lognormalSphericalCF(r, psize, psig): psize -- The mean particle diameter psig -- The log-normal width of the particle diameter - Here, r is the independent variable, mu is the mean of the distrubution + Here, r is the independent variable, mu is the mean of the distribution (not of the particle size), and s is the width of the distribution. This is the characteristic function for the lognormal distribution of particle diameter: diff --git a/src/diffpy/srfit/pdf/pdfcontribution.py b/src/diffpy/srfit/pdf/pdfcontribution.py index 981cb91f..b6b0740d 100644 --- a/src/diffpy/srfit/pdf/pdfcontribution.py +++ b/src/diffpy/srfit/pdf/pdfcontribution.py @@ -86,7 +86,7 @@ def loadData(self, data): """Load the data in various formats. This uses the PDFParser to load the data and then passes it to the - build-in profile with loadParsedData. + built-in profile with loadParsedData. data -- An open file-like object, name of a file that contains data or a string containing the data. diff --git a/src/diffpy/srfit/pdf/pdfparser.py b/src/diffpy/srfit/pdf/pdfparser.py index 6211211b..9eb5595f 100644 --- a/src/diffpy/srfit/pdf/pdfparser.py +++ b/src/diffpy/srfit/pdf/pdfparser.py @@ -50,7 +50,7 @@ class PDFParser(ProfileParser): dy -- A numpy array containing the uncertainty read from the file. This is 0 if the uncertainty cannot be read. - _x -- Indpendent variable from the chosen bank + _x -- Independent variable from the chosen bank _y -- Profile from the chosen bank _dx -- Uncertainty in independent variable from the chosen bank _dy -- Uncertainty in profile from the chosen bank @@ -163,7 +163,7 @@ def parseString(self, patstring): if res: meta["doping"] = float(res.groups()[0]) - # parsing gerneral metadata + # parsing general metadata if metadata: regexp = r"\b(\w+)\ *=\ *(%(f)s)\b" % rx while True: diff --git a/src/diffpy/srfit/sas/sasparser.py b/src/diffpy/srfit/sas/sasparser.py index f5bd5680..69f94904 100644 --- a/src/diffpy/srfit/sas/sasparser.py +++ b/src/diffpy/srfit/sas/sasparser.py @@ -48,7 +48,7 @@ class SASParser(ProfileParser): dy -- A numpy array containing the uncertainty read from the file. This is 0 if the uncertainty cannot be read. - _x -- Indpendent variable from the chosen bank + _x -- Independent variable from the chosen bank _y -- Profile from the chosen bank _dx -- Uncertainty in independent variable from the chosen bank _dy -- Uncertainty in profile from the chosen bank diff --git a/src/diffpy/srfit/structure/objcrystparset.py b/src/diffpy/srfit/structure/objcrystparset.py index 24ff151f..3dab67f2 100644 --- a/src/diffpy/srfit/structure/objcrystparset.py +++ b/src/diffpy/srfit/structure/objcrystparset.py @@ -201,7 +201,7 @@ def __init__(self, name, molecule, parent=None): ObjCrystScattererParSet.__init__(self, name, molecule, parent) self.stru = molecule - # Add orientiation quaternion + # Add orientation quaternion self.addParameter(ParameterAdapter("q0", self.scat, attr="Q0")) self.addParameter(ParameterAdapter("q1", self.scat, attr="Q1")) self.addParameter(ParameterAdapter("q2", self.scat, attr="Q2")) @@ -1486,7 +1486,7 @@ def _createSpaceGroup(sgobjcryst): sgobjcryst -- A pyobjcryst.spacegroup.SpaceGroup instance. This uses the actual space group operations from the - pyobjcryst.spacegroup.SpaceGroup instance so there is no abiguity about + pyobjcryst.spacegroup.SpaceGroup instance so there is no ambiguity about the actual space group. """ import copy diff --git a/src/diffpy/srfit/structure/sgconstraints.py b/src/diffpy/srfit/structure/sgconstraints.py index 21bb8378..c3b0d005 100644 --- a/src/diffpy/srfit/structure/sgconstraints.py +++ b/src/diffpy/srfit/structure/sgconstraints.py @@ -58,7 +58,7 @@ def constrainAsSpaceGroup( U22, etc.). The names must be given in the same order as stdUsymbols. isosymbol -- Symbol for isotropic ADP (default "Uiso"). If None, - isotropic ADPs will be constrainted via the anisotropic ADPs. + isotropic ADPs will be constrained via the anisotropic ADPs. New Parameters that are used in constraints are created within a SpaceGroupParameters object, which is returned from this function. @@ -239,7 +239,7 @@ def __init__( same order as diffpy.structure.symmetryutilities.stdUsymbols. isosymbol -- Symbol for isotropic ADP (default "Uiso"). If None, - isotropic ADPs will be constrainted via the anisotropic + isotropic ADPs will be constrained via the anisotropic ADPs. """ BaseSpaceGroupParameters.__init__(self) diff --git a/src/diffpy/srfit/util/inpututils.py b/src/diffpy/srfit/util/inpututils.py index 4117de0b..0645354a 100644 --- a/src/diffpy/srfit/util/inpututils.py +++ b/src/diffpy/srfit/util/inpututils.py @@ -19,13 +19,13 @@ import os.path -def inputToString(inpt): +def inputToString(input): """Convert input from various modes to a string. This is useful when you want a method to accept a string, open file object or file name. - inpt -- An open file-like object, name of a file + input -- An open file-like object, name of a file or a string containing the input. Returns the input in a string @@ -34,15 +34,15 @@ def inputToString(inpt): """ # Get the input into a string inptstr = "" - if hasattr(inpt, "read"): - inptstr = inpt.read() + if hasattr(input, "read"): + inptstr = input.read() # TODO remove handling of string input accept only file or filename # FIXME check for typos in the file name - elif os.path.exists(inpt) or (len(inpt) < 80 and inpt.count("\n") == 0): - with open(inpt, "r") as infile: + elif os.path.exists(input) or (len(input) < 80 and input.count("\n") == 0): + with open(input, "r") as infile: inptstr = infile.read() else: - inptstr = inpt + inptstr = input return inptstr diff --git a/src/diffpy/srfit/util/observable.py b/src/diffpy/srfit/util/observable.py index d638af47..ff71b7d5 100644 --- a/src/diffpy/srfit/util/observable.py +++ b/src/diffpy/srfit/util/observable.py @@ -43,9 +43,9 @@ def notify(self, other=()): """Notify all observers.""" # build a list before notification, just in case the observer's # callback behavior involves removing itself from our callback set - semaphors = (self,) + other + semaphores = (self,) + other for callable in tuple(self._observers): - callable(semaphors) + callable(semaphores) return # callback management @@ -81,11 +81,11 @@ def __init__(self, **kwds): # Local helpers -------------------------------------------------------------- -def _fbRemoveObserver(fobs, semaphors): +def _fbRemoveObserver(fobs, semaphores): # Remove WeakBoundMethod `fobs` from the observers of notifying object. # This is called from Observable.notify when the WeakBoundMethod # associated object dies. - observable = semaphors[0] + observable = semaphores[0] observable.removeObserver(fobs) return diff --git a/tests/test_builder.py b/tests/test_builder.py index d453a122..81f5eb9f 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -263,7 +263,7 @@ def _f(a, b): eq = beq.getEquation() E = builder.wrapOperator("eq", eq) eq2 = (2 * E).getEquation() - # Make sure these evaulate to the same thing + # Make sure these evaluate to the same thing self.assertEqual(eq.args, [A.literal, B.literal]) self.assertEqual(2 * eq(), eq2()) # Pass new arguments to the equation diff --git a/tests/test_literals.py b/tests/test_literals.py index d131b6f8..8155d64a 100644 --- a/tests/test_literals.py +++ b/tests/test_literals.py @@ -27,7 +27,7 @@ class TestArgument(unittest.TestCase): def testInit(self): - """Test that everthing initializes as expected.""" + """Test that everything initializes as expected.""" a = literals.Argument() self.assertEqual(None, a._value) self.assertTrue(False is a.const) @@ -70,7 +70,7 @@ def setUp(self): return def testInit(self): - """Test that everthing initializes as expected.""" + """Test that everything initializes as expected.""" op = self.op self.assertEqual("+", op.symbol) self.assertEqual(numpy.add, op.operation)