Skip to content
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

Only saving cells data when there are cells #348

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

vincent-noel
Copy link
Collaborator

Hi guys, I'm back and I found a bug !
When you try to run a simulation with 0 cells, we get a segmentation fault when writing the output files.
Here I'm just checking if there are cells before calling add_PhysiCell_cells_to_open_xml_pugi_v2. Maybe we should also print something ?

@heberlr
Copy link
Collaborator

heberlr commented Jan 15, 2025

Just a heads-up: this change will impact all applications that read PhysiCell cell simulation outputs. If all cells are eliminated, some applications—such as PhysiCell Studio, pcdataloader, and potentially others we may not be tracking—expect the following files to be present, even if they are empty:

  • output*_cells.mat
  • output*_attached_cells_graph.txt
  • output*_attached_cell_neighbor_graph.txt
  • output*_spring_cells_attached_cells_graph.txt

@MathCancer
Copy link
Owner

MathCancer commented Jan 16, 2025 via email

@vincent-noel
Copy link
Collaborator Author

I updated the PR, and now it is creating all the files, just empty.
The main problem was that (*all_cells)[0] was used to get the custom data of any cells. So I just added a check that there were cells every time this was used.

Copy link
Collaborator

@drbergman drbergman left a comment

Choose a reason for hiding this comment

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

Looks like a good solution to having no cells when writing output! Still produces all the files. I think I would prefer a solution that keeps the same label structure, but that seems like it would require storing the Death models and custom data structures outside of cell definitions. Ok, as I'm writing this I'm realizing that the Cell_Definition's still have phenotype and custom_data fields that should match with (*all_cells)[0]. Could we use those instead? Then we could avoid the structure of these files depending on the number of cells?

@drbergman
Copy link
Collaborator

Ok, as I'm writing this I'm realizing that the Cell_Definition's still have phenotype and custom_data fields that should match with (*all_cells)[0].

And match in terms of the number of/names/units/etc of the parameters being saved

@vincent-noel
Copy link
Collaborator Author

Hummm, you're right. We should use the cell definition there. I'll have a look...

Copy link
Collaborator

@drbergman drbergman left a comment

Choose a reason for hiding this comment

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

This looks good to me! cell_defaults is clearly the right struct for this.

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.

4 participants