Release notes
3.4.0
Added:
Add
make_equation,register_constant,register_argument,
register_operator, register_builder and deregister_builder to
EquationFactory, and wrap_argument, wrap_operator,
wrap_function and get_builder to diffpy.srfit.equation.builder.
* Add Equation.set_root, Operator.add_literal and make_operator to
diffpy.srfit.equation.
* Add get_args, get_expression and pretty_print to
diffpy.srfit.equation.visitors, and on_argument, on_operator and
on_equation to Visitor.
* Add parallel fitting example.
* Add add_observer, remove_observer and has_observer to
Observable, and has_tags and verify_tags to TagManager.
* Add is_identifier and validate_name to diffpy.srfit.util.nameutils,
convert_input_to_string to diffpy.srfit.util.inpututils, and
sort_key_for_numeric_string to diffpy.srfit.util.
* Document the *=, %=, +=, |=, and << shorthand operators in the diffpy.srfit.interface API reference.
* The public fitbase classes can now be imported directly from
diffpy.srfit, for example from diffpy.srfit import FitRecipe.
* The test suite now fails if srfit’s own source code calls one of srfit’s
deprecated names, so an internal caller missed during a deprecation is
caught in CI.
Changed:
OperatorABCnow requiresadd_literalinstead ofaddLiteral, and
Visitor subclasses now override on_argument, on_operator and
on_equation instead of onArgument, onOperator and
onEquation.
* Rewrite the diffpy.srfit.fitbase docstrings in NumPy style, and correct
those that described the wrong types, defaults or raised exceptions.
* The error raised for an invalid name now says how to fix it.
* Importing diffpy.srfit no longer imports matplotlib.pyplot or
changes the global matplotlib style. FitRecipe.plot_recipe still uses
the bg-style stylesheet, but only for the figures it creates.
Deprecated:
EquationFactory.makeEquation,registerConstant,registerArgument,
registerOperator, registerBuilder and deRegisterBuilder,
wrapArgument, wrapOperator, wrapFunction, getBuilder,
Equation.setRoot, Operator.addLiteral, makeOperator,
getArgs, getExpression, prettyPrint and Visitor.onArgument,
onOperator and onEquation are deprecated in favor of their
snake_case replacements. The old names still work and warn, and will be
removed in version 4.0.0.
* getValue is deprecated in favour of get_value on Parameter and on
the Literal hierarchy (Argument, Operator, Equation). The old
name still works and warns, and will be removed in version 4.0.0.
* Observable.addObserver, removeObserver and hasObserver,
TagManager.hasTags and verifyTags, isIdentifier,
validateName, inputToString and sortKeyForNumericString are
deprecated in favour of their snake_case replacements. The old names still
work and warn, and will be removed in version 4.0.0.
* ParameterSet.addParameter, ParameterSet.newParameter and
ParameterSet.removeParameter are deprecated in favour of
add_parameter, new_parameter and remove_parameter. The old names
still work and warn, and will be removed in version 4.0.0.
Fixed:
Fix the test check for observers left on global equation builders.
Fix the
equationFromStringdeprecation warning, which pointed to a
nonexistent RecipeOrganizer.get_equation_from_string instead of
diffpy.srfit.fitbase.recipeorganizer.get_equation_from_string.
* show() no longer fails when the recipe holds BVS or ObjCryst molecule restraints, or a Restraint added with register_soft_bounds.
* Set the scattering factor table through the scatteringfactortable property in setScatteringType instead of the setScatteringFactorTableByType method deprecated in diffpy.srreal.
* SASProfile now updates its wrapped SAS DataInfo object when the
observed profile is set through set_observed_profile or
load_parsed_data. Previously only the deprecated setObservedProfile
did this.
* FitRecipe tests no longer depend on the diffpy.srfit.pdf package.
* Apply restraints and constraints added to a FitContribution or ParameterSet after its FitRecipe has been evaluated. Before, they were ignored until the recipe was reset.
* Point the README CI badge at the matrix-and-codecov.yml workflow so it renders.
* Use get_space_group, position_formulas, and u_formulas in place of the deprecated diffpy.structure functions GetSpaceGroup, positionFormulas, and UFormulas to silence deprecation warnings.
* Use add_constraint and add_soft_bounds in the *= and %= operators of RecipeOrganizerInterface so they no longer raise deprecation warnings for constrain and restrain.
* Use pyobjcryst.crystal.create_crystal_from_cif, scipy.optimize.leastsq, and the particle_diameter argument of spherical_particle in the examples in place of deprecated or renamed APIs.
* Creating a FitRecipe no longer emits a DeprecationWarning about
pushFitHook.
* initializeRecipe now emits only its own DeprecationWarning instead of
also warning about resultsDictionary.
* Fix API docstrings so code examples in RecipeOrganizer.add_soft_bounds and iterate_over_parameters render, and fix docstring formatting errors in ProfileParser, PDFParser, lognormal_spherical_particle, and the interface module.
* Fix broken include of the examples README in the examples documentation page.
Removed:
Removed the undeclared
sixdependency and the leftover Python 2
compatibility code that used it.
3.3.1
Added:
Add regex parsing ability in
PDFParserfor file headers that do not have the structure output by xPDFsuite and PDFgetX.
3.3.0
Added:
Added
add_parameter_setmethod to replace deprecatedFitRecipe.addParameterSet.Added
add_parameter_setmethod to replace deprecatedParameterSet.addParameterSet.Added diffpy.structure back to the requirements and run the test
Added
add_constraintmethod toRecipeOrganizer.Added
remove_constraintmethod toRecipeOrganizer.Added
add_soft_boundsmethod toRecipeOrganizer.Added
remove_soft_boundsmethod toRecipeOrganizer.Added
register_soft_boundsmethod toRecipeOrganizer.Added
clear_all_soft_boundsmethod toRecipeOrganizer.Added
get_equation_from_stringmethod toRecipeOrganizer.Add
parse_filemethod toProfileParserto parse a file directly withload_datafromdiffpy.utils.Add
_parse_metadataand_parse_datahooks toProfileParser, which subclasses override to support a new data format.parse_fileis a template method that calls them.Add
get_num_banksmethod toProfileParserto replacegetNumBanks.Add
select_bankmethod toProfileParserto replaceselectBank.Add
get_formatmethod toProfileParserto replacegetFormat.Add
get_datamethod toProfileParserto replacegetData.Add
get_metadatamethod toProfileParserto replacegetMetaData.Added
get_equationmethod toBaseBuilder.Added
get_equationmethod toFitContribution.Add
plot_recipemethod toFitRecipe.Added
initialize_recipe_with_resultstoFitRecipe.Added
iterate_over_parametersmethod.Added
register_calculatormethod.Added
register_functionmethod.Added
register_string_functionmethod.Added
evaluate_equationmethod.Added
is_constrainedmethod.Added
get_constrained_parametersmethod.Added
clear_all_constraintsmethod.Added
add_profile_generatorto replace deprecated function.Added
is_constantmethod toParameter.Added
bound_rangemethod toParameter.Added
bound_windowmethod toParameter.Added
set_weightmethod toFitRecipeto replacesetWeight.Added
get_fit_hooksmethod toFitRecipeto replacegetFitHooks.Added
clear_fit_hooksmethod toFitRecipeto replaceclearFitHooks.Added
pop_fit_hookmethod toFitRecipeto replacepopFitHook.Added
push_fit_hookmethod toFitRecipeto replacepushFitHook.Add
spherical_particle,spheroidal_particle,lognormal_spherical_particle,sheet_particle, andshell_particletodiffpy.srfit.pdf.characteristicfunctions, replacingsphericalCF,spheroidalCF,lognormalSphericalCF,sheetCF, andshellCF.Add
constrain_as_space_grouptodiffpy.srfit.structure.sgconstraints, replacingconstrainAsSpaceGroup.Added
get_residual_equationmethod toFitContribution.Added
set_residual_equationmethod toFitContribution.Added
set_valuemethod todiffpy.srfit.fitbase.Parameter.Added
save_resultsmethod toFitResults.Added
print_resultsmethod toFitResults.Added
get_results_stringmethod toFitResults.Added
create_new_variablemethod toFitRecipe.Added
delete_variablemethod toFitRecipe.Added
add_variablemethod toFitRecipe.Added
scalar_residualmethod toFitRecipe.Added
remove_parameter_setmethod toFitRecipe.Added test for
remove_parameter_setmethod inFitRecipe.Added initialize_recipe_from_recipe to
FitRecipe.Added
convert_bounds_to_restraintsmethod toFitRecipe.Added
get_bounds_pairsmethod toFitRecipe.Added
get_bounds_arraymethod toFitRecipe.Added
get_namesmethod toFitRecipeandRecipeContainer.Added
get_valuesmethod toFitRecipeandRecipeContainer.Added
is_freemethod toFitRecipe.Added
set_equationmethod to replacesetEquation.Added
FitResults.get_results_dictionaryin replace ofresultsDictionary.Added
add_contributionin replace ofaddContribution.Support for Python 3.14
Added
load_parsed_datain replace ofloadParsedDatainProfileandSimpleRecipe.Added
set_observed_profilein replace ofsetObservedProfileinProfileandSimpleRecipe.Added
set_calculation_rangein replace ofsetCalculationRangeinProfileandSimpleRecipe.Added
set_calculation_pointsin replace ofsetCalculationPointsinProfileandSimpleRecipe.
Changed:
Change
PDFParserto inherit_parse_metadataand_parse_dataunchanged fromProfileParser, since PDFgetX and PDFgetN headers are now plainname = valuepairs.PDFParser.parse_filereturns the same data and metadata thatPDFParser.parseFiledid.Change
ProfileParser.parse_fileto accept the keyword arguments ofload_data, such asusecols,delimiterandcomments. Useusecolsto select columns from a file with more than four of them.Change
PDFContribution.loadDatato take a file name only.Change the headers of the
si-q27r60-xray.grandni-q27r100-neutron.grtest files to the moderndiffpy.pdfgetxand xPDFsuite configuration formats, replacing the 2008-era PDFgetX2/PDFgetN headers. The data values are unchanged.Change
spheroidalCF2andshellCF2indiffpy.srfit.pdf.characteristicfunctionsto be deprecated aliases that convert their arguments and callspheroidal_particleandshell_particle, instead of separate implementations.Change the current characteristic functions in
diffpy.srfit.pdf.characteristicfunctions(spherical_particle,spheroidal_particle,lognormal_spherical_particle,sheet_particleandshell_particle) to emit aRuntimeWarningwhen a non-physical shape parameter makes them return zero, since a zero return flattens the fit residual and stalls a refinement without any other sign to the user. The warning is issued once per process for each distinct problem so a refinement loop does not repeat it. The deprecated camel-case functions forward to these functions directly, so they emit the same warning and return the same result for non-physical input.Change
lognormal_spherical_particleindiffpy.srfit.pdf.characteristicfunctionsto return zero for a negativeparticle_diameter_sigmainstead of silently returningspherical_particle. Aparticle_diameter_sigmaof zero is still the sphere limit.Change
sheet_particleindiffpy.srfit.pdf.characteristicfunctionsto return an array of zeros for a non-positivesheet_thicknesswhenris an array, instead of a scalar zero.Change
ProfileParser.parse_fileto set unavailabledx/dyuncertainties toNoneinstead of0, matching the format-specific parsers.Change
Profile.set_observed_profileto leavedyobsasNonewhen no uncertainties are observed, instead of silently replacing them with an array of ones. The calculateddystill defaults to 1 at every calculation point, so unweighted fits refine exactly as before.Change
Profile._validateto accept aNonedyobs, since observed uncertainties are optional.x,y,dy,xobsandyobsare still required.Changed iterPars method to match all equal-type atoms to have same ADPs
Deprecated:
Deprecated
addParameterSetmethod inFitRecipe.Deprecate
addParameterSetmethod inParameterSet.Deprecated
constrainmethod ofRecipeOrganizer. Useadd_constraintinstead.Deprecated
unconstrainmethod ofRecipeOrganizer. Useremove_constraintinstead.Deprecated
restrainmethod ofRecipeOrganizer. Useadd_soft_boundsinstead.Deprecated
unrestrainmethods ofRecipeOrganizer. Useremove_soft_boundsinstead.Deprecated
addRestraintmethod ofRecipeOrganizer. Useregister_soft_boundsinstead.Deprecate
clearRestraintsmethod ofRecipeOrganizer. Useclear_all_soft_boundsinstead.Deprecated
equationFromStringmethod ofRecipeOrganizer. Useget_equation_from_stringinstead.Deprecate
getNumBanks,selectBank,getFormat,getData, andgetMetaDatainProfileParser.Deprecate
ProfileParser.parseFile, which now delegates toparse_file. Useparse_fileinstead.Deprecated
BaseBuilder.getEquationmethod for removal in 4.0.0.Deprecated
FitContributution.getEquationmethod for removal in 4.0.0.Deprecated
iterParsmethod. Useiterate_over_parametersinstead.Deprecated
registerCalculatormethod. Useregister_calculatorinstead.Deprecated
registerFunctionmethod. Useregister_functioninstead.Deprecated
registerStringFunctionmethod. Useregister_string_functioninstead.Deprecated
evaluateEquationmethod. Useevaluate_equationinstead.Deprecated
isConstrainedmethod. Useis_constrainedinstead.Deprecated
getConstrainedParsmethod. Useget_constrained_parametersinstead.Deprecated
clearConstraintsmethod. Useclear_all_constraintsinstead.Deprecate
setProfilefor removal in version 4.0.0.Deprecated
addProfileGeneratorfor removal in 4.0.0.Deprecated
isConstmethod ofParameter. Useis_constantinstead.Deprecated
boundRangemethod ofParameter. Usebound_rangeinstead.Deprecated
boundWindowmethod ofParameter. Usebound_windowinstead.Deprecated
setWeightinFitRecipefor removal in 4.0.0.Deprecated
getFitHooksinFitRecipefor removal in 4.0.0.Deprecated
clearFitHooksinFitRecipefor removal in 4.0.0.Deprecated
popFitHookinFitRecipefor removal in 4.0.0.Deprecated
pushFitHookinFitRecipefor removal in 4.0.0.Deprecate
sphericalCF,spheroidalCF,spheroidalCF2,lognormalSphericalCF,sheetCF,shellCF, andshellCF2indiffpy.srfit.pdf.characteristicfunctions.Deprecate
constrainAsSpaceGroupindiffpy.srfit.structure.sgconstraints.Deprecated
getResidualEquationmethod ofFitContributionfor removal in 4.0.0.Deprecated
setResidualEquationmethod ofFitContributionfor removal in 4.0.0.Deprecated
setValuemethod indiffpy.srfit.fitbase.Parameterfor removal in 4.0.0.Deprecated
saveResultsmethod for removal in 4.0.0.Deprecated
printResultsmethod for removal in 4.0.0.Deprecated
formatResultsmethod for removal in 4.0.0.Deprecated
newVarmethod for removal in 4.0.0.Deprecated
delVarmethod for removal in 4.0.0.Deprecated
addVarmethod for removal in 4.0.0.Deprecated
scalarResidualmethod for removal in 4.0.0.Deprecated
removeParameterSetmethod for removal in 4.0.0.Deprecated
boundsToRestraintsmethod for removal in 4.0.0.Deprecated
getBoundsmethod for removal in 4.0.0.Deprecated
getBounds2method for removal in 4.0.0.Deprecated
getNamesmethod for removal in 4.0.0.Deprecated
getValuesmethod for removal in 4.0.0.Deprecated
isFreemethod for removal in 4.0.0.Deprecated
setEquationfor removal in 4.0.0.Deprecated
resultsDictionaryfor removal in 4.0.0.Deprecated
addContributionfor removal in 4.0.0.Deprecated
loadParsedDatainProfileandSimpleRecipefor removal in 4.0.0.Deprecated
setObservedProfileinProfileandSimpleRecipefor removal in 4.0.0.Deprecated
setCalculationRangeinProfileandSimpleRecipefor removal in 4.0.0.Deprecated
setCalculationPointsinProfileandSimpleRecipefor removal in 4.0.0.
Fixed:
Fixed load new parsed data with updated Qmax attribute
Fix
PDFParser.parse_fileandPDFContribution.loadDatadiscarding PDF metadata. They parsed PDFgetX and PDFgetN headers as genericname = valuepairs, which droppedstype,qmin,qmax,qdampandqbroad, soPDFGeneratorsilently fell back to its default scattering type and Q range.Update codebase to scikit-package 0.3.0 standards.
Updated project to the latest scikit-package template
Fix
shell_particleindiffpy.srfit.pdf.characteristicfunctionsreturning a smoothly varying branch of unphysical values, some below negative one, for a negativethicknessorradius, which a refinement could mistake for a real solution. It now returns zero.Fix
shell_particleindiffpy.srfit.pdf.characteristicfunctionsreturning one at everyrfor a zerothickness, where the normalizing denominator vanishes. It now returns zero.Fix
spheroidal_particleindiffpy.srfit.pdf.characteristicfunctionsraisingZeroDivisionErrorfor a zeroequatorial_radius. It now returns zero.Fix
ProfileParser.parse_fileproducing zero-valued uncertainties for absent or invaliddx/dycolumns, which gave non-finite residuals for any file without usable uncertainties instead of falling back to an unweighted fit.Fix
Profile.dyobsreporting an array of ones for data that carries no uncertainties, which made an unweighted profile indistinguishable from one whose uncertainties were genuinely all 1.
Removed:
Remove
parseStringfromProfileParser, andPDFParser. Parsers read from a file, so a format is now supported by overriding the_parse_metadataand_parse_datahooks.Remove support for passing a data string or an open file object to
PDFContribution.loadData. Pass a file name instead.Support for Python 3.11
3.2.0
Changed:
Temporarily removed support for SAS characteristic functions until we can migrate to the new sasview api.
doc/ -> docs/
requirements/test.txt -> requirements/tests.txt
Fixed:
Better license designation in pyproject.toml
3.1.0
Version 3.0.0 – 2019-03-14
Added:
Support for Python 3.7, 3.6, 3.5 in addition to 2.7.
Changed:
Always use lower-case imports from diffpy.structure.
Use numeric-value sort to order variables in PrintFitHook.
Deprecated:
Variable __gitsha__ in the version module renamed to __git_commit__.
Removed:
Optional upper and lower-bound arguments in Parameter.setValue. The bounds can be set with Parameter.boundRange instead.
Unused classes ListOperator, SetOperator.
Fixed:
Metadata retrieval from PDFContribution hierarchy.
Refresh PDFGenerator when its rgrid is changed in-place.
Zero division in the nppdfsas.py example.
Crash in ellipsoidsas.py example because of bug in Parameter.setValue.
Pickling of ProfileGenerator objects and of bound class methods.
Invalid escape sequences in string values.