Skip to content

[BUG] Notebook examples - AttributeError: 'Loop3DView' object has no attribute 'add_scalar_field' or 'add_isosurface' #263

Open

Description

@gpirot

Describe your issue

Working with LoopStructural v1.6.16, I get the AttributeError: 'Loop3DView' object has no attribute 'add_scalar_field' or AttributeError: 'Loop3DView' object has no attribute 'add_isosurface'

when running the provided example notebooks (2b. Refolded folds, 3a. Modelling faults using structural frames, 3c. Defining the fault displacement function)

Minimal reproducing code example

https://loop3d.org/LoopStructural/_auto_examples/2_fold/_refolded_folds.html

https://loop3d.org/LoopStructural/_auto_examples/3_fault/_faulted_intrusion.html

https://loop3d.org/LoopStructural/_auto_examples/3_fault/_define_fault_displacement.html

Error message

ERROR 2b.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 5
      3 s2 = model.create_and_add_fold_frame("s2", nelements=10000, buffer=0.5, solver="lu", damp=True)
      4 viewer = Loop3DView(model)
----> 5 viewer.add_scalar_field(s2[0], cmap="prism")
      6 viewer.add_isosurface(s2[0], slices=[0, 1])
      7 viewer.add_data(s2[0])

AttributeError: 'Loop3DView' object has no attribute 'add_scalar_field'


ERROR 3a.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 8
      3 fault = model.create_and_add_fault(
      4     "fault", 500, nelements=10000, steps=4, interpolatortype="FDI", buffer=0.3
      5 )
      7 viewer = Loop3DView(model)
----> 8 viewer.add_isosurface(
      9     fault,
     10     isovalue=0,
     11     #                       slices=[0,1]#nslices=10
     12 )
     13 xyz = model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]].to_numpy()
     14 xyz = xyz[fault.evaluate(xyz).astype(bool), :]

AttributeError: 'Loop3DView' object has no attribute 'add_isosurface'


ERROR 3c.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 21
     18 import LoopStructural.visualisation as vis
     20 view = vis.Loop3DView(model)
---> 21 view.add_isosurface(model.features[0], slices=[0])
     22 view.add_isosurface(model.features[1], nslices=5, paint_with=model.features[1])
     23 # view.add_vector_field(model["fault"][1], locations=model.regular_grid()[::100])

AttributeError: 'Loop3DView' object has no attribute 'add_isosurface'

Activity

  1. lachlangrose commented on Aug 4, 2025

    @lachlangrose
    Member

    This example wasn't updated for the new visualisation using pyvista. I've updated it and the docs are being re-run.

  2. gpirot commented on Aug 8, 2025

    @gpirot
    Author

    After upgrading to 1.6.18, I still have a few similar errors in some notebooks (downloaded from the last built of the doc) and python scripts (downloaded from github).
    Assignining model.create_and_add_foliation to a strati object (among others), and updating the call to the viewer solves it.

    AttributeError: 'Loop3DView' object has no attribute 'add_model_surfaces'
    4_advanced/_model_from_geological_map
    4_advanced/_5_using_logging

    AttributeError: 'Loop3DView' object has no attribute 'add_isosurface'
    4_advanced/_7_local_weights
    3_fault/_faulted_intrusion
    3_fault/_define_fault_displacement

  3. reopened this on Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions