Skip to content

Comments

deprecate: Deprecate remaining methods of FitRecipe#157

Merged
sbillinge merged 8 commits intodiffpy:v3.3.0from
cadenmyers13:fitrecipe-dep
Feb 21, 2026
Merged

deprecate: Deprecate remaining methods of FitRecipe#157
sbillinge merged 8 commits intodiffpy:v3.3.0from
cadenmyers13:fitrecipe-dep

Conversation

@cadenmyers13
Copy link
Contributor

deprecated,

  • removeParameterSet
  • scalarResidual
  • addVar
  • delVar
  • newVar

I also added a test for remove_parameter_set since it didn't exist

@cadenmyers13
Copy link
Contributor Author

@sbillinge ready for review

Also, this is where we are with deprecations in srfit, 40 functions deprecated!

tests/test_builder.py::testBuildEquation
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_builder.py:269: DeprecationWarning: 'diffpy.srfit.equation.builder.BaseBuilder.getEquation' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.equation.builder.BaseBuilder.get_equation' instead.
    eq4 = (3 * E(A, D) - 1).getEquation()

tests/test_contribution.py::TestContribution::testAddProfileGenerator
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_contribution.py:61: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.addProfileGenerator' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.add_profile_generator' instead.
    fc.addProfileGenerator(gen, "gen")

tests/test_contribution.py::TestContribution::test_getResidualEquation
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_contribution.py:175: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.getResidualEquation' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.get_residual_equation' instead.
    self.assertEqual("((eq - y) / dy)", fc.getResidualEquation())

tests/test_contribution.py::TestContribution::test_getResidualEquation
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_contribution.py:176: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.setResidualEquation' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.set_residual_equation' instead.
    fc.setResidualEquation("2 * (eq - y)")

tests/test_contribution.py::TestContribution::testset_profile
  /opt/miniconda3/envs/srfit/lib/python3.13/unittest/case.py:238: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.setProfile' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.set_profile' instead.
    callable_obj(*args, **kwargs)

tests/test_contribution.py::test_setEquation
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_contribution.py:299: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.setEquation' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.set_equation' instead.
    fc.setEquation("x + 5")

tests/test_contribution.py::test_getEquation
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_contribution.py:329: DeprecationWarning: 'diffpy.srfit.fitbase.FitContribution.getEquation' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitContribution.get_equation' instead.
    assert "(A * sin((x + 5)))" == fc.getEquation()

tests/test_fitrecipe.py: 16 warnings
tests/test_fitresults.py: 3 warnings
tests/test_sgconstraints.py: 1 warning
  /opt/miniconda3/envs/srfit/lib/python3.13/site-packages/diffpy/srfit/fitbase/fitrecipe.py:192: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.pushFitHook' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.push_fit_hook' instead.
    self.pushFitHook(PrintFitHook())

tests/test_fitrecipe.py::TestFitRecipe::testVars
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:158: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.addVar' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.add_variable' instead.
    recipe.addVar(con.c, 0)

tests/test_fitrecipe.py::TestFitRecipe::testVars
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:159: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.newVar' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.create_new_variable' instead.
    recipe.newVar("B", 0)

tests/test_fitrecipe.py::TestFitRecipe::testVars
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:171: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.delVar' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.delete_variable' instead.
    recipe.delVar(recipe.B)

tests/test_fitrecipe.py::testPrintFitHook
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:319: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.addContribution' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.add_contribution' instead.
    recipe.addContribution(fitcontribution)

tests/test_fitrecipe.py::testPrintFitHook
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:323: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.getFitHooks' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.get_fit_hooks' instead.
    (pfh,) = recipe.getFitHooks()

tests/test_fitrecipe.py::testPrintFitHook
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/conftest.py:141: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.scalarResidual' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.scalar_residual' instead.
    f(*args, **kwargs)

tests/test_fitrecipe.py::test_add_and_remove_ParameterSet
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:346: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.addParameterSet' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.add_parameter_set' instead.
    recipe.addParameterSet(parameter_to_add)

tests/test_fitrecipe.py::test_add_and_remove_ParameterSet
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:351: DeprecationWarning: 'diffpy.srfit.fitbase.FitRecipe.removeParameterSet' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.FitRecipe.remove_parameter_set' instead.
    recipe.removeParameterSet(parameter_to_add)

tests/test_fitrecipe.py::test_plot_recipe_labels_from_gr_file_overwrite_deprecated
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_fitrecipe.py:469: DeprecationWarning: 'diffpy.srfit.fitbase.profile.Profile.loadParsedData' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.profile.Profile.load_parsed_data' instead.
    profile.loadParsedData(parser)

tests/test_parameterset.py::TestParameterSet::testAddParameterSet
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_parameterset.py:38: DeprecationWarning: 'diffpy.srfit.fitbase.parameterset.ParameterSet.addParameterSet' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.parameterset.ParameterSet.add_parameter_set' instead.
    self.parset.addParameterSet(parset2)

tests/test_profile.py::TestProfile::testSetCalculationPoints
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_profile.py:251: DeprecationWarning: 'diffpy.srfit.fitbase.profile.Profile.setCalculationPoints' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.profile.Profile.set_calculation_points' instead.
    prof.setCalculationPoints(xcalc)

tests/test_profile.py::TestProfile::testSetCalculationRange
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_profile.py:213: DeprecationWarning: 'diffpy.srfit.fitbase.profile.Profile.setCalculationRange' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.profile.Profile.set_calculation_range' instead.
    prof.setCalculationRange()

tests/test_profile.py::TestProfile::testSetObservedProfile
  /Users/cadenmyers/billingelab/dev/diffpy.srfit/tests/test_profile.py:102: DeprecationWarning: 'diffpy.srfit.fitbase.profile.Profile.setObservedProfile' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.srfit.fitbase.profile.Profile.set_observed_profile' instead.
    self.profile.setObservedProfile(x, y, dy)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

@cadenmyers13 cadenmyers13 changed the title deprecate: Deprecate remaining methods of Fitrecipe deprecate: Deprecate remaining methods of FitRecipe Feb 20, 2026
return


def test_add_and_remove_ParameterSet():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A similar test for this exists in test_parameterset, but no test existed for the FitRecipe.removeParameterSet.

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 98.93617% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.06%. Comparing base (1a3aa78) to head (644cc97).
⚠️ Report is 10 commits behind head on v3.3.0.

Files with missing lines Patch % Lines
tests/test_sgconstraints.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           v3.3.0     #157      +/-   ##
==========================================
+ Coverage   70.63%   71.06%   +0.43%     
==========================================
  Files          25       25              
  Lines        3606     3660      +54     
==========================================
+ Hits         2547     2601      +54     
  Misses       1059     1059              
Files with missing lines Coverage Δ
tests/conftest.py 91.48% <100.00%> (ø)
tests/test_fitrecipe.py 99.81% <100.00%> (+0.02%) ⬆️
tests/test_fitresults.py 98.41% <100.00%> (ø)
tests/test_sgconstraints.py 10.06% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbillinge sbillinge merged commit 9e7a7c8 into diffpy:v3.3.0 Feb 21, 2026
6 checks passed
@sbillinge
Copy link
Contributor

This is amazing. I love the new function names and appreciate the tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants