Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 simpeg/directives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
SaveDataGeoH5,
SaveLogFilesGeoH5,
SaveLPModelGroup,
SaveModelGroup,
SaveModelGeoH5,
SavePGIModel,
SavePropertyGroup,
Expand Down
26 changes: 26 additions & 0 deletions simpeg/directives/_save_geoh5.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,32 @@ def write(self, iteration: int, **_):
prop_group.add_properties(properties)


class SaveModelGroup(SavePropertyGroup):
"""
Save the model as a property group in the geoh5 file
"""

def __init__(
self,
h5_object,
group_type: GroupTypeEnum = GroupTypeEnum.MULTI,
**kwargs,
):
self.group_type = group_type

super().__init__(h5_object, **kwargs)

def get_names(
self, component: str, channel: int | None, iteration: int
) -> tuple[str, str]:
"""
Format the data and property_group name.
"""
channel_name, _ = super().get_names(component, channel, iteration)

return channel_name, component
Comment on lines +528 to +536


Comment thread
benk-mira marked this conversation as resolved.
class SaveLPModelGroup(SavePropertyGroup):
"""
Save the model as a property group in the geoh5 file
Expand Down
6 changes: 4 additions & 2 deletions simpeg/directives/_vector_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ def endIter(self):
self.opt.xc = model

if (
self.invProb.phi_d < self.target
) and self.mode == "cartesian" and self.inversion_type == "magnetic vector":
(self.invProb.phi_d < self.target)
and self.mode == "cartesian"
and self.inversion_type == "magnetic vector"
):
print("Switching MVI to spherical coordinates")
self.mode = "spherical"
self.cartesian_model = model
Expand Down
Loading