-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: master
Are you sure you want to change the base?
Conversation
…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(...))
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) |
There was a problem hiding this comment.
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?
# FIXME : Might be worth moving to a dedicated function | ||
# Update cellmodel in case of heterogeneous tissue |
There was a problem hiding this comment.
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.
Support heterogeneous tissue parametrization from :
{ "scale_ICaL": { "1": 1.02, "2": 1.01 }, "scale_INaL": { "1": 2.3, "2": 2.1 } }