Skip to content

Commit

Permalink
fix flake8; import
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed Jun 22, 2024
1 parent 66940cc commit f23636e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions emg3d/inversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

from emg3d.inversion import pygimli
11 changes: 6 additions & 5 deletions emg3d/inversion/pygimli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def __dir__():
return __all__


@utils._requires('pygimli')
class Kernel(pygimli.Modelling):
class Kernel(pygimli.Modelling if pygimli else object):
"""Create a forward operator of emg3d to use within a pyGIMLi inversion.
Expand All @@ -57,6 +56,7 @@ class Kernel(pygimli.Modelling):
"""

@utils._requires('pygimli')
def __init__(self, simulation, markers=None, pgthreads=2):
"""Initialize a pyGIMLi(emg3d)-wrapper."""
super().__init__()
Expand Down Expand Up @@ -90,7 +90,7 @@ def __init__(self, simulation, markers=None, pgthreads=2):
self.markers = markers
else:
self.markes = np.zeros(simulation.model.size, dtype=int)
# Store original properties; required if a region is set to ``background``.
# Store original props; required if a region is set to ``background``.
self._model = simulation.model.property_x.copy()
# Store volumes; required if a region is set to ``single``.
self._volumes = simulation.model.grid.cell_volumes.reshape(
Expand Down Expand Up @@ -217,7 +217,7 @@ def model2emg3d(self, model):

return out

class Jacobian(pygimli.Matrix):
class Jacobian(pygimli.Matrix if pygimli else object):
"""Return Jacobian operator for pyGIMLi(emg3d)."""

def __init__(self, simulation,
Expand Down Expand Up @@ -253,9 +253,10 @@ def save(self, *args):


@utils._requires('pygimli')
class Inversion(pygimli.Inversion):
class Inversion(pygimli.Inversion if pygimli else object):
"""Thin wrapper, adding verbosity and taking care of data format."""

@utils._requires('pygimli')
def __init__(self, fop=None, inv=None, **kwargs):
"""Initialize an Inversion instance."""
super().__init__(fop=fop, inv=inv, **kwargs)
Expand Down

0 comments on commit f23636e

Please sign in to comment.