Skip to content

Three state fitting#6

Open
FloAvis wants to merge 14 commits intoosvalB:mainfrom
FloAvis:main
Open

Three state fitting#6
FloAvis wants to merge 14 commits intoosvalB:mainfrom
FloAvis:main

Conversation

@FloAvis
Copy link
Copy Markdown
Collaborator

@FloAvis FloAvis commented Mar 16, 2026

Three state fitting with tests

@osvalB osvalB self-requested a review March 17, 2026 13:53

rng = np.random.default_rng(RNG_SEED)

def_params = {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Add tests with different Cp values, explore how much values differ from the true ones by assuming Cp=0. Remember to add options to give Cp or fit Cp. For the two-state models, Cp should be given or fitted. For three-state, the two alternatives are: asssume both cp are zero, or give total cp and fit cp1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added tests. The fitting of the CP1 value when CpTh value is not very accurate while the other parameters seem to be more stable, when tested in simulations at least

@FloAvis
Copy link
Copy Markdown
Collaborator Author

FloAvis commented Mar 24, 2026

I still have problems with the "normalise_to_global_max" option at select_conditions for the thermal oligomer functions. I believe the problem is the different signal scale the function fits to (0-100 for the normalised and ~0.001-0.1 for not normalised), screwing up the parameters.

It still fits well to the curves but the Tm and DH don't make sense while Cp0 is correct. Tm and Dhm are always lower than the corrct one of the simulation for dimer, trimer and tetramer which increases linearly with a larger number of subunits. I am unsure how to solve this nicely.

I would either
A. just use the normalisation for the visualisation of the plots while keeping the parameters same/also adjusting the parameters after fitting.
B. just remove the feature.

Not sure how to proceed

@osvalB
Copy link
Copy Markdown
Owner

osvalB commented Apr 8, 2026

Hi Flo,

ein Paar Kommentaren:

  1. Wenn ich die Tests im Komputer probiere, vier davon funktionieren nicht. Vllt wegen das atol.

FAILED tests/test_main_therm_oligo_three_state.py::test_fit_thermal_unfolding_three_state_global_global_tetramer_monomeric - AssertionError:
Not equal to tolerance rtol=0.2, atol=1.5

Mismatched elements: 1 / 4 (25%)
Max absolute difference among violations: 61.77682001
Max relative difference among violations: 0.20592273
ACTUAL: array([ 71.202769, 262.786957, 80.07184 , 238.22318 ])
DESIRED: array([ 70, 300, 80, 300])
FAILED tests/test_main_therm_oligo_three_state.py::test_fit_thermal_unfolding_three_state_global_trimer_trimeric - RuntimeError: Optimal parameters not found: The maximum number of function evaluations is exceeded.
FAILED tests/test_main_therm_oligo_three_state.py::test_fit_thermal_unfolding_three_state_global_global_trimer_trimeric - RuntimeError: Optimal parameters not found: The maximum number of function evaluations is exceeded.
FAILED tests/test_main_therm_oligo_three_state.py::test_fit_thermal_unfolding_three_state_global_global_global_trimer_trimeric - RuntimeError: Optimal parameters not found: The maximum number of function evaluations is exceeded.

  1. estimate_baseline_parameters ist sowohl in main.py als auch in thermal_oligomer.py, aber die Klasse ThermalOligomer (thermal_oligomer.py) ist teil der Klasse Sample (main.py).

  2. Die Tests sollten "echte" Cp values haben, nicht null :)

LG,

Osva

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