PhysiCell-Tools / PhysiCell-Studio

PhysiCell Studio is a graphical tool to allow easy editing of a (XML) model, create initial positions of cells, run a simulation, and visualize results. To contribute, fork and make PRs to the development branch.
GNU General Public License v3.0
19 stars 11 forks source link

Rules plots for set rules do not track updated base value #176

Open drbergman opened 3 months ago

drbergman commented 3 months ago

As reported by a user, once a rule is set in the rules tab, the base value is fixed for plotting purposes of that rule, i.e. clicking Plot rule when that row is selected.

All other parameters, i.e., those defined within the Rules tab and shown in the table, do affect the plot when changed in the table.

Here's a rule with base value initially set to 1.0 when added to the table, followed by updating the base value (migrtion bias) to 0.5, and the rule plotted again and the base value remains at 1.0:

Initial base value

image

Initial plot

image

Update base value

image

Plot not updated even after clicking Plot rule

image

rheiland commented 3 months ago

We're getting awfully close to trying to read the user's mind. In the use case above, let's say they entered a saturation value of 0.6 (with 1.0 as original base value) and saved that into the table. Then they change the base value to 0.5. I guess we would need to check the table, see that they have a rule still with decreasing bias from the new 0.5 base value "down" to 0.6, and either 1) tell them it's ill-defined, please fix it or 2) automagically change the 0.6 to a new default of 0.05 (0.1 0.5). I'll just do something* I guess, then we can modify later.

drbergman commented 3 months ago

I think the simple solution here is grabbing the base value when the user clicks Plot rule.

MathCancer commented 3 months ago

I think keeping the “base” synced with the current cell definition is a good practice.

In principle, uers in the “rules” tab should only be editing the responses, not the base values.

Thanks!

rheiland commented 3 months ago

Wondering if I'm missing something obvious @drbergman . It doesn't seem that simple to me, but maybe I still don't understand rules, in general. Repeating the point I was trying to make earlier... I create rule 2 initially with a base value of 0.5. and specified it will be increasing with a saturation value of 1.0. Then I return to the secretion subtab and set the base value for secretion rate = 1.7. Then I return to the Rules tab, select this rule in the table, click "Plot rule" (with some of my local edits, not in the repo yet) and it plots the decreasing (not increasing as stated on the rule) plot from the 1.7 down to 1.0. So, do I automatically change "increases" to "decreases" in the rule? Do I notify the user that there's an inconsistency and I can't read their mind? Other?

Note that running PhysiCell does not generate any warning either:

Adding rule for default cells:
    substrate decreases migration bias towards 0.5 with a Hill response, with half-max 20 and Hill power 4.
Adding rule for default cells:
    substrate increases substrate secretion towards 1.0 with a Hill response, with half-max 42 and Hill power 4.
Done!
Screenshot 2024-04-14 at 11 51 19 AM
rheiland commented 3 months ago

It feels a bit rushed, but I hope I fixed/improved this issue in the latest release: https://github.com/PhysiCell-Tools/PhysiCell-Studio/releases/tag/v2.36.0 . I'll wait to hear from disgruntled users.

rheiland commented 3 months ago

The question remains whether PhysiCell should also check for a consistent "increases" or "decreases" direction in a rule (assuming I'm interpreting the situation correctly).

rheiland commented 2 months ago

Do we know if this issue can be closed?

drbergman commented 2 months ago

I think so. It looks like it worked as I played around with a couple rules, even changing the Direction as the base value decreased below a min value or increased above a max value