-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw error if duplicate substrate or parameter #250
Throw error if duplicate substrate or parameter #250
Conversation
Check that each added substrate has a unique name. Same for parameters (for a given type). Also, clean up some code to improve maintainability/readability. Suggestion for future improvement: rename some of the many instances of "parameters" in the code. For example, UserParameters has one instance called parameters. Each instance of Parameters has a member called parameters. Many other objects in PhysiCell have parameters members. This makes it hard to track which ones belong where.
@drbergman, @heberlr, @MathCancer I am still voting for not thronging an Error, maybe not even a Warning. The reason is, that: If these are variables, then the
If we later on assign another value to a variable, Python will not through an error, complain that "a" already exists. Because it is a variable and not a constant, python will simply overwrite the variable content. In the same, in my opinion, should PhysiCell handle add_variable and add_parameter. |
If you, for whatever reason, insist that add_parameter and add_density through an error, then I request that at least the following:
This would solve my problem too. But I think throwing no Error and no Waring is what we actually should do. |
These suggestions would walk back the main purpose of this PR: don't let users define a substrate (or parameter) and quietly not use it because it turned out to be a duplicate. We discussed the reasons for this change previously (#232). If you want to work towards a solution that fits within the constraints of this PR, I would suggest the following:
|
@drbergman, the main purpose of the original pull request #232 (which actually was from me and not from you) was that parameters and densities variables can be reloaded without eating up memory, by every time generating a new variable with the same name. this pull request is here for a tool for other to use, and this is why it is critical that is properly resolved in the main code base and my "python example" above, that I later on came up with because I tried to deal with the new situation, should make quite clear what the real problem is. |
We discussed this over Zoom and in #232. I sided with you in #232. The rest of the community though agreed that this should result in an error. Heber had clear points on this in that thread. You asked for help amending that PR and that's why I made this one. You have not acknowledged the issue we are trying to prevent with throwing an error, and that makes it difficult to continue this conversation. I have tried to ask why you need to loop through "episodes" in your As for your python example, I'm going to pause my own activity on this thread until others weigh in. |
ok, i have now a version with add and update possibility and a flag that is by default set to add. |
@drbergman I made a pull request with my changes to this branch on your PhysiCell fork. |
44ab0c1
to
a3e9898
Compare
a3e9898
to
8f19f0b
Compare
Great! I'll take a look once the checks are all passing on #264. |
Thank you, @drbergman ! I looks like github has at this moment in general problem to run MacOSX jobs. Thank you, Elmar |
@vincent-noel and @drbergman |
This is the line that have to be changed in the yaml files:
Will try to figure out if there is something like I will change it in my pull request. |
@drbergman , i just have a chat with @vincent-noel ! thank you. |
So, @drbergman feel free to have a look at the pull request #264 already now ; ). |
Check that each added substrate has a unique name. Same for parameters (for a given type).
Also, clean up some code to improve maintainability/readability.
Suggestion for future improvement: rename some of the many instances of "parameters" in the code. For example, UserParameters has one instance called parameters. Each instance of Parameters has a member called parameters. Many other objects in PhysiCell have parameters members. This makes it hard to track which ones belong where.