diff --git a/environments/py-3.10-linux-64-dev.conda.lock.yml b/environments/py-3.10-linux-64-dev.conda.lock.yml index 9cf402bf..61f28f13 100644 --- a/environments/py-3.10-linux-64-dev.conda.lock.yml +++ b/environments/py-3.10-linux-64-dev.conda.lock.yml @@ -304,7 +304,7 @@ dependencies: - zstd=1.5.7=hb8e6e7a_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.10-linux-64.conda.lock.yml b/environments/py-3.10-linux-64.conda.lock.yml index 3c925de8..45337112 100644 --- a/environments/py-3.10-linux-64.conda.lock.yml +++ b/environments/py-3.10-linux-64.conda.lock.yml @@ -157,7 +157,7 @@ dependencies: - zstd=1.5.7=hb8e6e7a_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.10-win-64-dev.conda.lock.yml b/environments/py-3.10-win-64-dev.conda.lock.yml index d06999ec..6b70eebd 100644 --- a/environments/py-3.10-win-64-dev.conda.lock.yml +++ b/environments/py-3.10-win-64-dev.conda.lock.yml @@ -295,7 +295,7 @@ dependencies: - zstd=1.5.7=hbeecb71_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.10-win-64.conda.lock.yml b/environments/py-3.10-win-64.conda.lock.yml index cf1097fb..d88dea88 100644 --- a/environments/py-3.10-win-64.conda.lock.yml +++ b/environments/py-3.10-win-64.conda.lock.yml @@ -146,7 +146,7 @@ dependencies: - zstd=1.5.7=hbeecb71_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.11-linux-64-dev.conda.lock.yml b/environments/py-3.11-linux-64-dev.conda.lock.yml index feb54a3c..d2c1a511 100644 --- a/environments/py-3.11-linux-64-dev.conda.lock.yml +++ b/environments/py-3.11-linux-64-dev.conda.lock.yml @@ -308,7 +308,7 @@ dependencies: - zstd=1.5.7=hb8e6e7a_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.11-linux-64.conda.lock.yml b/environments/py-3.11-linux-64.conda.lock.yml index ea5274ef..549d81ea 100644 --- a/environments/py-3.11-linux-64.conda.lock.yml +++ b/environments/py-3.11-linux-64.conda.lock.yml @@ -160,7 +160,7 @@ dependencies: - zstd=1.5.7=hb8e6e7a_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.11-win-64-dev.conda.lock.yml b/environments/py-3.11-win-64-dev.conda.lock.yml index 64942e46..7ef8cb98 100644 --- a/environments/py-3.11-win-64-dev.conda.lock.yml +++ b/environments/py-3.11-win-64-dev.conda.lock.yml @@ -299,7 +299,7 @@ dependencies: - zstd=1.5.7=hbeecb71_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.11-win-64.conda.lock.yml b/environments/py-3.11-win-64.conda.lock.yml index 02c2ead9..17571fd4 100644 --- a/environments/py-3.11-win-64.conda.lock.yml +++ b/environments/py-3.11-win-64.conda.lock.yml @@ -149,7 +149,7 @@ dependencies: - zstd=1.5.7=hbeecb71_1 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.12-linux-64-dev.conda.lock.yml b/environments/py-3.12-linux-64-dev.conda.lock.yml index 0ca45eb7..712467d4 100644 --- a/environments/py-3.12-linux-64-dev.conda.lock.yml +++ b/environments/py-3.12-linux-64-dev.conda.lock.yml @@ -308,7 +308,7 @@ dependencies: - zstd=1.5.6=ha6fb4c9_0 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.12-linux-64.conda.lock.yml b/environments/py-3.12-linux-64.conda.lock.yml index 6fd8e612..a56cec6c 100644 --- a/environments/py-3.12-linux-64.conda.lock.yml +++ b/environments/py-3.12-linux-64.conda.lock.yml @@ -160,7 +160,7 @@ dependencies: - zstd=1.5.6=ha6fb4c9_0 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.12-win-64-dev.conda.lock.yml b/environments/py-3.12-win-64-dev.conda.lock.yml index 4663d22a..cb7b5d4c 100644 --- a/environments/py-3.12-win-64-dev.conda.lock.yml +++ b/environments/py-3.12-win-64-dev.conda.lock.yml @@ -299,7 +299,7 @@ dependencies: - zstd=1.5.6=h0ea2cb4_0 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/environments/py-3.12-win-64.conda.lock.yml b/environments/py-3.12-win-64.conda.lock.yml index 379635ee..c4dda0df 100644 --- a/environments/py-3.12-win-64.conda.lock.yml +++ b/environments/py-3.12-win-64.conda.lock.yml @@ -149,7 +149,7 @@ dependencies: - zstd=1.5.6=h0ea2cb4_0 - pip: - geoapps-utils @ git+https://github.com/MiraGeoscience/geoapps-utils.git@6ba24321d5311bbaf7ab460261ce6730ed541131 - - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + - geoh5py @ git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 - mira-simpeg @ git+https://github.com/MiraGeoscience/simpeg.git@275985aa18af76d70d55311e45dcfed149e62089 - octree-creation-app @ git+https://github.com/MiraGeoscience/octree-creation-app.git@3c479f5d098332ff1c6e0eca0d56be6cc01e0911 - param-sweeps @ git+https://github.com/MiraGeoscience/param-sweeps.git@39de1da1495aff6d16641d408317619e23adbdb4 diff --git a/py-3.10.conda-lock.yml b/py-3.10.conda-lock.yml index 8fce0291..4ce470d5 100644 --- a/py-3.10.conda-lock.yml +++ b/py-3.10.conda-lock.yml @@ -8558,12 +8558,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: geoh5py @@ -8575,12 +8575,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: mira-simpeg diff --git a/py-3.11.conda-lock.yml b/py-3.11.conda-lock.yml index dc776a1d..aeb80aff 100644 --- a/py-3.11.conda-lock.yml +++ b/py-3.11.conda-lock.yml @@ -8672,12 +8672,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: geoh5py @@ -8689,12 +8689,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: mira-simpeg diff --git a/py-3.12.conda-lock.yml b/py-3.12.conda-lock.yml index b11dd981..b02cbc4a 100644 --- a/py-3.12.conda-lock.yml +++ b/py-3.12.conda-lock.yml @@ -8674,12 +8674,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: geoh5py @@ -8691,12 +8691,12 @@ package: numpy: '>=1.26.0,<1.27.0' pillow: '>=10.3.0,<10.4.0' pydantic: '>=2.5.2,<3.0.0' - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 hash: - sha256: 99300455d1d5627d8a2e95a7217da2bab4921f48 + sha256: c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 source: type: url - url: git+https://github.com/MiraGeoscience/geoh5py.git@99300455d1d5627d8a2e95a7217da2bab4921f48 + url: git+https://github.com/MiraGeoscience/geoh5py.git@c5f762ae16395629d8a8e4e04dc7488a6c9c53f1 category: main optional: false - name: mira-simpeg diff --git a/simpeg_drivers-assets/uijson/gravity_inversion.ui.json b/simpeg_drivers-assets/uijson/gravity_inversion.ui.json index 162eb5d9..73f35933 100644 --- a/simpeg_drivers-assets/uijson/gravity_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/gravity_inversion.ui.json @@ -19,9 +19,7 @@ "{6a057fdc-b355-11e3-95be-fd84a7ffcb88}", "{f26feba3-aded-494b-b9e9-b2bbcbe298e1}", "{48f5054a-1c5c-4ca4-9048-80f36dc60a06}", - "{b020a277-90e2-4cd7-84d6-612ee3f25051}", - "{b54f6be6-0eb5-4a4e-887a-ba9d276f9a83}", - "{5ffa3816-358d-4cdd-9b7d-e1f7f5543e05}" + "{b020a277-90e2-4cd7-84d6-612ee3f25051}" ], "value": "" }, @@ -770,6 +768,11 @@ "parent": "data_object", "isValue": true, "property": "", + "dataType": "Float", + "association": [ + "Vertex", + "Cell" + ], "value": 1, "min": 1, "max": 1000, diff --git a/simpeg_drivers/potential_fields/gravity/uijson.py b/simpeg_drivers/potential_fields/gravity/uijson.py new file mode 100644 index 00000000..f968cb3b --- /dev/null +++ b/simpeg_drivers/potential_fields/gravity/uijson.py @@ -0,0 +1,145 @@ +# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +# Copyright (c) 2025 Mira Geoscience Ltd. ' +# ' +# This file is part of simpeg-drivers package. ' +# ' +# simpeg-drivers is distributed under the terms and conditions of the MIT License ' +# (see LICENSE file at the root of this source code package). ' +# ' +# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +from pathlib import Path +from typing import ClassVar + +from geoh5py.ui_json.forms import ( + BoolForm, + ChoiceForm, + DataForm, + FileForm, + FloatForm, + GroupForm, + IntegerForm, + ObjectForm, + StringForm, +) +from geoh5py.ui_json.ui_json import BaseUIJson + +from simpeg_drivers import assets_path +from simpeg_drivers.uijson import SimPEGDriversUIJson + + +class GravityForwardUIJson(SimPEGDriversUIJson): + """Gravity Forward UIJson.""" + + default_ui_json: ClassVar[Path] = assets_path() / "gravity_forward.ui.json" + + inversion_type: str + forward_only: bool + data_object: ObjectForm + z_from_topo: BoolForm + receivers_radar_drape: DataForm + receivers_offset_z: FloatForm + gps_receivers_offset: str + gz_channel_bool: BoolForm + gx_channel_bool: BoolForm + gy_channel_bool: BoolForm + guv_channel_bool: BoolForm + gxy_channel_bool: BoolForm + gxx_channel_bool: BoolForm + gyy_channel_bool: BoolForm + gzz_channel_bool: BoolForm + gxz_channel_bool: BoolForm + gyz_channel_bool: BoolForm + mesh: ObjectForm + starting_model: DataForm + topography_object: ObjectForm + topography: DataForm + active_model: DataForm + output_tile_files: bool + parallelized: BoolForm + n_cpu: IntegerForm + tile_spatial: DataForm + max_chunk_size: IntegerForm + chunk_by_rows: BoolForm + out_group: GroupForm + ga_group: str + generate_sweep: BoolForm + distributed_workers: str + + +class GravityInversionUIJson(SimPEGDriversUIJson): + """Gravity Inversion UIJson.""" + + default_ui_json: ClassVar[Path] = assets_path() / "gravity_inversionforward.ui.json" + + inversion_type: str + forward_only: bool + data_object: ObjectForm + gz_channel: DataForm + gz_uncertainty: DataForm + gx_channel: DataForm + gx_uncertainty: DataForm + gy_channel: DataForm + gy_uncertainty: DataForm + guv_channel: DataForm + guv_uncertainty: DataForm + gxy_channel: DataForm + gxy_uncertainty: DataForm + gxx_channel: DataForm + gxx_uncertainty: DataForm + gyy_channel: DataForm + gyy_uncertainty: DataForm + gzz_channel: DataForm + gzz_uncertainty: DataForm + gxz_channel: DataForm + gxz_uncertainty: DataForm + gyz_channel: DataForm + gyz_uncertainty: DataForm + mesh: ObjectForm + starting_model: DataForm + reference_model: DataForm + lower_bound: DataForm + upper_bound: DataForm + topography_object: ObjectForm + topography: DataForm + active_model: DataForm + output_tile_files: bool + inversion_style: str + alpha_s: DataForm + length_scale_x: DataForm + length_scale_y: DataForm + length_scale_z: DataForm + s_norm: DataForm + x_norm: DataForm + y_norm: DataForm + z_norm: DataForm + gradient_type: ChoiceForm + max_irls_iterations: IntegerForm + starting_chi_factor: FloatForm + beta_tol: FloatForm + prctile: IntegerForm + chi_factor: FloatForm + auto_scale_misfits: BoolForm + initial_beta_ratio: FloatForm + initial_beta: FloatForm + coolingFactor: FloatForm + coolingRate: IntegerForm + max_global_iterations: IntegerForm + max_line_search_iterations: IntegerForm + max_cg_iterations: IntegerForm + tol_cg: FloatForm + f_min_change: FloatForm + sens_wts_threshold: FloatForm + every_iteration_bool: BoolForm + save_sensitivities: BoolForm + parallelized: BoolForm + n_cpu: IntegerForm + tile_spatial: DataForm + store_sensitivities: ChoiceForm + max_ram: str + max_chunk_size: IntegerForm + chunk_by_rows: BoolForm + out_group: GroupForm + ga_group: str + generate_sweep: BoolForm + distributed_workers: str diff --git a/simpeg_drivers/uijson.py b/simpeg_drivers/uijson.py index a8a577f8..e8bcbd5c 100644 --- a/simpeg_drivers/uijson.py +++ b/simpeg_drivers/uijson.py @@ -20,8 +20,9 @@ logger = logging.getLogger(__name__) -class CoreUIJson(BaseUIJson): - version: str = simpeg_drivers.__version__ +class SimPEGDriversUIJson(BaseUIJson): + icon: str + documentation: str @field_validator("version", mode="before") @classmethod diff --git a/tests/uijson_test.py b/tests/uijson_test.py index 5be5f385..1f4ccbcb 100644 --- a/tests/uijson_test.py +++ b/tests/uijson_test.py @@ -13,10 +13,14 @@ from pathlib import Path from typing import ClassVar +import numpy as np from geoh5py import Workspace -import simpeg_drivers -from simpeg_drivers.uijson import CoreUIJson +from simpeg_drivers.params import ActiveCellsOptions +from simpeg_drivers.potential_fields.gravity.params import GravityInversionOptions +from simpeg_drivers.potential_fields.gravity.uijson import GravityInversionUIJson +from simpeg_drivers.uijson import SimPEGDriversUIJson +from simpeg_drivers.utils.testing import setup_inversion_workspace logger = logging.getLogger(__name__) @@ -26,9 +30,11 @@ def test_version_warning(tmp_path, caplog): workspace = Workspace(tmp_path / "test.geoh5") with caplog.at_level(logging.WARNING): - _ = CoreUIJson( + _ = SimPEGDriversUIJson( version="0.2.0", title="My app", + icon="", + documentation="", geoh5=str(workspace.h5file), run_command="myapp.driver", monitoring_directory="", @@ -51,7 +57,7 @@ def test_write_default(tmp_path): with open(default_path, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=4) - class MyUIJson(CoreUIJson): + class MyUIJson(SimPEGDriversUIJson): default_ui_json: ClassVar[Path] = default_path version: str = "0.2.0" @@ -60,4 +66,50 @@ class MyUIJson(CoreUIJson): with open(default_path, encoding="utf-8") as f: data = json.load(f) - assert data["version"] == simpeg_drivers.__version__ + assert data["version"] == "0.3.0-alpha.1" + + +def test_gravity_uijson(tmp_path): + geoh5, _, starting_model, survey, topography = setup_inversion_workspace( + tmp_path, background=0.0, anomaly=0.75, inversion_type="gravity" + ) + + opts = GravityInversionOptions( + geoh5=geoh5, + data_object=survey, + gz_channel=survey.add_data({"gz": {"values": np.ones(survey.n_vertices)}}), + gz_uncertainty=survey.add_data( + {"gz_unc": {"values": np.ones(survey.n_vertices)}} + ), + mesh=starting_model.parent, + starting_model=starting_model, + active_cells=ActiveCellsOptions( + topography_object=topography, + ), + ) + params_uijson_path = tmp_path / "from_params.ui.json" + opts.write_ui_json(params_uijson_path) + + uijson = GravityInversionUIJson.read(params_uijson_path) + uijson_path = tmp_path / "from_uijson.ui.json" + uijson.write(uijson_path) + with open(params_uijson_path, encoding="utf-8") as f: + params_data = json.load(f) + with open(uijson_path, encoding="utf-8") as f: + uijson_data = json.load(f) + + params_data_nobraces = {} + for param, data in params_data.items(): + if isinstance(data, dict): + field_data_nobraces = {} + for field, value in data.items(): + if isinstance(value, str): + value = value.removeprefix("{").removesuffix("}") + if isinstance(value, list): + value = [v.removeprefix("{").removesuffix("}") for v in value] + field_data_nobraces[field] = value + else: + field_data_nobraces = data + params_data_nobraces[param] = field_data_nobraces + + assert uijson_data == params_data_nobraces