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

Cecile/heterogeneity #72

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Cecile/heterogeneity #72

wants to merge 9 commits into from

Conversation

cdaversin
Copy link
Contributor

Support heterogeneous tissue parametrization from :

  • A mesh marking defining the different regions (loaded from an existing xdmf file, or configuring regions of the slab) marked for examples with "1" and "2"
  • A json file containing heterogeneous parameters as for example:
    { "scale_ICaL": { "1": 1.02, "2": 1.01 }, "scale_INaL": { "1": 2.3, "2": 2.1 } }

…ous cell parameters (cannot use dict_to_h5 with dolfin.Function type)
…and load homogeneous and heterogeneous parameters separately, as two distinct dictionaries) + fix dict_to_h5 function to avoid overwriting h5 files (but require to make all dict_to_h5 calls before any HDF5File.write(...))
@cdaversin cdaversin marked this pull request as ready for review August 9, 2022 12:12
Comment on lines +41 to +60
if h5file.keys() != "":
# Creating a temporary h5file and copy to initial file to avoid overwriting
# FIXME : Is there a more elegant way to do this ?
if isinstance(h5name, str):
tmp_name = str(os.path.splitext(h5name)[0]) + "_tmp.h5"
elif isinstance(h5name, os.PathLike):
tmp_name = h5name.with_name(f"{h5name.stem}_tmp.h5")
else:
logger.error(
"dict_to_h5 : h5name has wrong type (supported : str / path)",
)

with h5pyfile(tmp_name, "w") as h5file_tmp:
if h5group == "":
group = h5file_tmp
else:
group = h5file_tmp.create_group(h5group)
for k, v in data.items():
group.create_dataset(k, data=v)
h5file_tmp.copy(group, h5file, name=h5group)
Copy link
Member

Choose a reason for hiding this comment

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

Just trying to understand what you want to do here. I check if h5file.keys() != "" which should be equivalent of saying that the file exist, right?

And if it does exist then you copy all the data to a new temporary file?

Comment on lines +228 to +229
# FIXME : Might be worth moving to a dedicated function
# Update cellmodel in case of heterogeneous tissue
Copy link
Member

Choose a reason for hiding this comment

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

Agree, we should move this to a dedicated function.

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