Skip to content

Type object 'type' has no attribute 'domain' #145

@longqianh

Description

@longqianh

Following the jwave tutorial (https://ucl-bug.github.io/jwave/notebooks/prerequisites.html#fields), I got an error when calling z = field_on_plane(coords).

The error is: AttributeError: type object 'type' has no attribute 'domain'/

I found the error was in Linear.eq function where it called .domain (discretization.py, line 25)

I solved this bug by adding a Field class check:

  # def __eq__(self, other):
  #   return tree_equal(self, other) * (self.domain == other.domain)
  def __eq__(self, other):
    if not isinstance(other, self.__class__):
        return False
    return tree_equal(self, other) and (self.domain == other.domain)

I hope this makes sense to you, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions