@@ -371,7 +371,7 @@ def filter(
371371 return self [:].filter (snap , rprofs , fields , func )
372372
373373
374- class Snaps ( Steps ) :
374+ class Snaps :
375375 """Collection of snapshots.
376376
377377 The `StagyyData.snaps` attribute is an instance of this class.
@@ -385,9 +385,10 @@ class Snaps(Steps):
385385 """
386386
387387 def __init__ (self , sdat : StagyyData ):
388+ self .sdat = sdat
388389 self ._isteps : dict [int , int | None ] = {}
389390 self ._all_isteps_known = False
390- super (). __init__ ( sdat )
391+ self . _len : int | None = None
391392
392393 def __repr__ (self ) -> str :
393394 return f"{ self .sdat !r} .snaps"
@@ -450,6 +451,9 @@ def __len__(self) -> int:
450451 self ._len = length + 1
451452 return self ._len
452453
454+ def __iter__ (self ) -> Iterator [Step ]:
455+ return iter (self [:])
456+
453457 def at_time (self , time : float , after : bool = False ) -> Step :
454458 """Return snap corresponding to a given physical time.
455459
@@ -487,6 +491,16 @@ def _bind(self, isnap: int, istep: int) -> None:
487491 self ._isteps [isnap ] = istep
488492 self .sdat .steps [istep ]._isnap = isnap
489493
494+ def filter (
495+ self ,
496+ snap : bool = False ,
497+ rprofs : bool = False ,
498+ fields : Iterable [str ] | None = None ,
499+ func : Callable [[Step ], bool ] | None = None ,
500+ ) -> StepsView :
501+ """Build a `StepsView` with requested filters."""
502+ return self [:].filter (snap , rprofs , fields , func )
503+
490504
491505@dataclass (frozen = True )
492506class Filters :
0 commit comments