File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 11"""Plot radial profiles."""
2- import re
3-
42import matplotlib .pyplot as plt
53
64from . import conf , misc
@@ -17,10 +15,7 @@ def plot_rprofs(rprofs, lovs):
1715 produced by :func:`stagpy.misc.list_of_vars`.
1816 """
1917 try :
20- stepstr = repr (rprofs .steps )
21- reg = re .compile (
22- r'^StagyyData\(.*\)\.(steps|snaps)\[(.*)\](?:.filter\(.*\))?$' )
23- stepstr = '_' .join (reg .match (stepstr ).groups ())
18+ stepstr = rprofs .steps .stepstr
2419 except AttributeError :
2520 stepstr = str (rprofs .step .istep )
2621 sdat = rprofs .step .sdat
Original file line number Diff line number Diff line change @@ -547,15 +547,25 @@ def rprofs_averaged(self):
547547 self ._rprofs_averaged = _RprofsAveraged (self )
548548 return self ._rprofs_averaged
549549
550- def __repr__ (self ):
551- rep = repr (self ._col )
550+ @crop
551+ def stepstr (self ):
552+ """String representation of the requested set of steps."""
552553 items = []
554+ no_slice = True
553555 for item in self ._items :
554556 if isinstance (item , slice ):
555557 items .append ('{}:{}:{}' .format (* item .indices (len (self ._col ))))
558+ no_slice = False
556559 else :
557560 items .append (repr (item ))
558- rep += '[{}]' .format (',' .join (items ))
561+ item_str = ',' .join (items )
562+ if no_slice and len (items ) == 1 :
563+ item_str += ','
564+ colstr = repr (self ._col ).rsplit ('.' , maxsplit = 1 )[- 1 ]
565+ return f'{ colstr } [{ item_str } ]'
566+
567+ def __repr__ (self ):
568+ rep = f'{ self ._col .sdat !r} .{ self .stepstr } '
559569 flts = []
560570 for flt in ('snap' , 'rprofs' , 'fields' ):
561571 if self ._flt [flt ]:
You can’t perform that action at this time.
0 commit comments