Commit d1644397 authored by Christoph Groth's avatar Christoph Groth
Browse files

make site arrays proper sequences

parent 5fd117c1
......@@ -19,7 +19,7 @@ import abc
import warnings
import operator
from copy import copy
from collections import namedtuple
import collections
from functools import total_ordering, lru_cache
import numpy as np
import tinyarray as ta
......@@ -96,7 +96,7 @@ class Site(tuple):
class SiteArray:
class SiteArray(
"""An array of sites, members of a `SiteFamily`.
......@@ -137,6 +137,12 @@ class SiteArray:
def __len__(self):
return len(self.tags)
def __getitem__(self, key):
if isinstance(key, slice):
return SiteArray(, self.tags[key])
return Site(, self.tags[key])
def __eq__(self, other):
if not isinstance(other, SiteArray):
raise NotImplementedError()
......@@ -527,7 +533,7 @@ class System(metaclass=abc.ABCMeta):
hamiltonian_submatrix = _system.hamiltonian_submatrix
Term = namedtuple(
Term = collections.namedtuple(
["subgraph", "symmetry_element", "hermitian", "parameters"],
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment