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

Multiple point models refactor #12

Merged
merged 24 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4bc6b4c
cleaning of electrodes code
j-zimmermann Jan 13, 2024
48478d6
further code quality fixes
j-zimmermann Jan 13, 2024
f316686
fix example
j-zimmermann Jan 13, 2024
38ce0b7
fix code style in lead-dbs interface
j-zimmermann Jan 13, 2024
54c0e09
Merge branch 'LeadDBS_integration' into multiple_point_models_refactor
j-zimmermann Jan 17, 2024
6778915
move point model part from VCM
j-zimmermann Jan 18, 2024
1f26d2f
fix tuple
j-zimmermann Jan 19, 2024
0e26e29
fix frequency index
j-zimmermann Jan 19, 2024
7775318
fix field export
j-zimmermann Jan 19, 2024
8fa3a31
fix frequency index, run all tests
j-zimmermann Jan 21, 2024
a1833a5
export only real-valued data
j-zimmermann Jan 21, 2024
e62aebe
switch TimeDomain evaluation off for lattice and voxel lattice
j-zimmermann Jan 21, 2024
5284aa4
add more output
j-zimmermann Jan 21, 2024
da8581f
fix csv export
j-zimmermann Jan 21, 2024
228423a
print export frequency
j-zimmermann Jan 21, 2024
fca5f5e
always export
j-zimmermann Jan 23, 2024
fe4612e
first step towards new data structure
j-zimmermann Jan 28, 2024
316ea3b
first draft OOC
j-zimmermann Jan 30, 2024
0b54966
remove dask
j-zimmermann Jan 31, 2024
8352932
remove index and update name of pathway output
j-zimmermann Jan 31, 2024
4954306
fix VTA
j-zimmermann Feb 1, 2024
a2b3876
fix complex-number issue with h5py
j-zimmermann Feb 3, 2024
5601021
Merge branch 'LeadDBS_integration' into multiple_point_models_refactor
j-zimmermann Feb 3, 2024
8702d44
fix bug after merge and update manifest
j-zimmermann Feb 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ recursive-include input_files *.h5
recursive-include input_files *.json
recursive-include input_test_cases *.json
recursive-include input_test_cases *.md
recursive-include input_test_cases *.sh
recursive-include ossdbs *.py
101 changes: 52 additions & 49 deletions examples/MeshAPI/BrainVerciseMesh_SetMeshSizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,60 @@
into account during the meshing
process.
"""
from ngsolve import Draw

import ossdbs
from ngsolve import Draw, Redraw

settings = \
{"Electrodes":
[{"Name": "BostonScientificVercise",
"Rotation[Degrees]": 0,
"Direction": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 1},
"TipPosition": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 0},
"EncapsulationLayer":
{"Thickness[mm]": 0.0, # indicates that no encapsulation is modelled
},
"Contacts":
[{"Contact_ID": 1,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 1.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05
},
{"Contact_ID": 3,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05
settings = {
"Electrodes": [
{
"Name": "BostonScientificVercise",
"Rotation[Degrees]": 0,
"Direction": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 1},
"TipPosition": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 0},
"EncapsulationLayer": {
"Thickness[mm]": 0.0, # indicates that no encapsulation is modelled
},
{"Contact_ID": 5,
"Active": False,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSize": 0.1
}]
}],
"MaterialDistribution":
{"MRIPath": "../BrainGeometryAPI/segmask.nii.gz"
},
"BrainRegion":
{"Center": {"x[mm]": 5, "y[mm]": 14, "z[mm]": -4.5},
"Dimension": {"x[mm]": 50.0, "y[mm]": 50.0, "z[mm]": 50.0},
"Shape": "Ellipsoid"
},
"Mesh":
{"LoadMesh": False,
"SaveMesh": False
}
}
"Contacts": [
{
"Contact_ID": 1,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 1.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05,
},
{
"Contact_ID": 3,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05,
},
{
"Contact_ID": 5,
"Active": False,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSize": 0.1,
},
],
}
],
"MaterialDistribution": {"MRIPath": "../BrainGeometryAPI/segmask.nii.gz"},
"BrainRegion": {
"Center": {"x[mm]": 5, "y[mm]": 14, "z[mm]": -4.5},
"Dimension": {"x[mm]": 50.0, "y[mm]": 50.0, "z[mm]": 50.0},
"Shape": "Ellipsoid",
},
"Mesh": {"LoadMesh": False, "SaveMesh": False},
"ExportElectrode": False,
}

mesh = ossdbs.generate_mesh(settings)
print(mesh.boundaries)
Expand All @@ -68,6 +71,6 @@

bnd_dict = {}
for idx in range(1, 9):
bnd_dict["E1C{}".format(idx)] = idx
bnd_dict[f"E1C{idx}"] = idx

Draw(mesh.boundary_coefficients(bnd_dict), mesh.ngsolvemesh, "bnd")
86 changes: 42 additions & 44 deletions examples/MeshAPI/BrainVerciseMesh_SetMeshSizes_Encap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,51 @@
into account during the meshing
process.
"""
from ngsolve import Draw

import ossdbs
from ngsolve import Draw, Redraw

ossdbs.set_logger()

settings = \
{"Electrodes":
[{"Name": "BostonScientificVercise",
"Rotation[Degrees]": 0,
"Direction": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 1},
"TipPosition": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 0},
"EncapsulationLayer":
{"Thickness[mm]": 1.0,
"MaxMeshSize": 0.2
},
"Contacts":
[{"Contact_ID": 1,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 1.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05
},
{"Contact_ID": 3,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05
}]
},
],
"MaterialDistribution":
{"MRIPath": "../BrainGeometryAPI/segmask.nii.gz"
},
"BrainRegion":
{"Center": {"x[mm]": 5, "y[mm]": 14, "z[mm]": -4.5},
"Dimension": {"x[mm]": 50.0, "y[mm]": 50.0, "z[mm]": 50.0},
"Shape": "Ellipsoid"
},
"Mesh":
{"LoadMesh": False,
"SaveMesh": False
}
}
settings = {
"Electrodes": [
{
"Name": "BostonScientificVercise",
"Rotation[Degrees]": 0,
"Direction": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 1},
"TipPosition": {"x[mm]": 0, "y[mm]": 0, "z[mm]": 0},
"EncapsulationLayer": {"Thickness[mm]": 1.0, "MaxMeshSize": 0.2},
"Contacts": [
{
"Contact_ID": 1,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 1.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05,
},
{
"Contact_ID": 3,
"Active": True,
"Current[A]": 0.0,
"Voltage[V]": 0.0,
"Floating": False,
"SurfaceImpedance[Ohmm]": {"real": 0.0, "imag": 0.0},
"MaxMeshSizeEdge": 0.05,
},
],
},
],
"MaterialDistribution": {"MRIPath": "../BrainGeometryAPI/segmask.nii.gz"},
"BrainRegion": {
"Center": {"x[mm]": 5, "y[mm]": 14, "z[mm]": -4.5},
"Dimension": {"x[mm]": 50.0, "y[mm]": 50.0, "z[mm]": 50.0},
"Shape": "Ellipsoid",
},
"Mesh": {"LoadMesh": False, "SaveMesh": False},
"ExportElectrode": False,
}

mesh = ossdbs.generate_mesh(settings)
print(mesh.boundaries)
Expand All @@ -64,6 +62,6 @@

bnd_dict = {}
for idx in range(1, 9):
bnd_dict["E1C{}".format(idx)] = idx
bnd_dict[f"E1C{idx}"] = idx

Draw(mesh.boundary_coefficients(bnd_dict), mesh.ngsolvemesh, "bnd")
13 changes: 7 additions & 6 deletions input_test_cases/input_case4/input_multi_current.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@
{
"Contact_ID": 1,
"Active": true,
"Current[A]": -0.003
"Current[A]": -0.003,
"Voltage[V]": 0
},
{
"Contact_ID": 2,
"Active": true,
"Floating": true,
"Current[A]": 0.001
}
,
{
"Contact_ID": 3,
"Active": true,
"Floating": true,
"Current[A]": 0.001
}
,
{
"Contact_ID": 4,
"Active": true,
"Floating": true,
"Current[A]": 0.001
}
],
Expand Down Expand Up @@ -97,7 +98,7 @@
"Solver": {
"Type": "CG",
"Preconditioner": "bddc",
"PreconditionerKwargs": {},
"PreconditionerKwargs": {"coarsetype": "local"},
"PrintRates": true,
"MaximumSteps": 200,
"Precision": 1e-8
Expand Down Expand Up @@ -133,4 +134,4 @@
"ComputeImpedance": false,
"ExportVTK": true,
"ExportElectrode": true
}
}
2 changes: 1 addition & 1 deletion input_test_cases/input_case7/input_vta.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@
"ComputeImpedance": true,
"ExportVTK": true,
"ExportElectrode": true
}
}
Loading
Loading