Skip to content

Commit 6fd61ab

Browse files
committed
Minor edits
1 parent 7e0b23b commit 6fd61ab

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2022 Simula Reaseach Laboratory
1+
Copyright 2022 Simula Research Laboratory
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

code/pre_processing.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
"""
2-
Script for converting gmsh files to dolfin format
2+
Script for converting GMSH files to Dolfin format
33
using cardiac geometries
44
55
https://computationalphysiology.github.io/cardiac_geometries/
66
7+
SPDX-License-Identifier: MIT
78
"""
89
import typing
910
from pathlib import Path
10-
11+
import logging
1112
import cardiac_geometries
1213
import config
1314
from cardiac_geometries.geometry import Geometry
1415
from cardiac_geometries.geometry import H5Path
16+
import sys
17+
18+
# We set default log level to be info
19+
logger = logging.Logger("Preprocessing", level=logging.INFO)
20+
logger.addHandler(logging.StreamHandler(sys.stdout))
21+
# Mute FFC and UFL errors at this stage
22+
logging.getLogger('FFC').setLevel(logging.WARNING)
23+
logging.getLogger('UFL').setLevel(logging.WARNING)
1524

1625
schema = {
1726
"mesh": H5Path(
@@ -35,10 +44,15 @@ def convert_mesh(
3544
msh_file: typing.Union[Path, str],
3645
outfile: typing.Union[Path, str],
3746
) -> None:
47+
"""
48+
Convert an .msh file to DOLFIN h5 format
3849
39-
print("Converting 'msh' file to dolfin xdmf format")
50+
Args:
51+
msh_file (typing.Union[Path, str]): Path to input mesh (.msh extension)
52+
outfile (typing.Union[Path, str]): Path to outfile (.h5 extension)
53+
"""
4054
geometry = cardiac_geometries.gmsh2dolfin(msh_file, unlink=True)
41-
55+
logger.info(f"Converting {msh_file}")
4256
geo = Geometry(
4357
mesh=geometry.mesh,
4458
markers=geometry.markers,
@@ -47,10 +61,16 @@ def convert_mesh(
4761
)
4862

4963
geo.save(outfile)
50-
print(f"Saved to {outfile}")
64+
logger.info(f"Saved to {outfile}")
5165

5266

5367
def main() -> int:
68+
"""
69+
Convert meshes from `../data/mesh/heart0*.msh` to `../data/heart_0*.h5`
70+
71+
Returns:
72+
int: 0 if code runs as expected
73+
"""
5474
for heart_nr in [1, 2]:
5575
msh_file = config.get_msh_path(heart_nr=heart_nr)
5676
outfile = config.get_h5_path(heart_nr=heart_nr)

docs/docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Running in Docker
1+
# Running in Docker
22

33
We have created a docker image containing all the dependencies as well as the source code in the repository. To get the most recent version of the docker image, make sure to pull the latest image first
44
```bash

docs/refs.bib

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ @article{bayer2012novel
66
number={10},
77
pages={2243--2254},
88
year={2012},
9-
publisher={Springer}
9+
publisher={Springer},
10+
doi={10.1007/s10439-012-0593-5}
1011
}
1112

1213
@misc{martinez2019repository,
1314
title={Repository for modelling acute myocardial ischemia: simulation scripts and torso-heart mesh},
1415
author={Martinez-Navarro, Hector and Rodriguez, Blanca and Bueno-Orovio, Alfonso and Minchole, Ana},
1516
year={2019},
16-
publisher={University of Oxford}
17+
publisher={University of Oxford},
18+
doi={10.5287/bodleian:9RxJPo9po}
1719
}

0 commit comments

Comments
 (0)