Skip to content

Commit

Permalink
make it work for athena and athenak (athenaC would need a parsing patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
teuben committed Aug 21, 2023
1 parent 2707cc4 commit 3d85a16
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions plot1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,19 @@ def mouse_moved(e):
# getting the variable names
with open(f[0]) as file:
file.readline()
variables = file.readline().split()[2:]
# regular tab file have as 2nd line
# i x1v rho ... for athena
# gid i x1v dens ... for athenak
line2 = file.readline()
variables = line2.split()[1:]

# history files have as 2nd line
# [1]=time [2]=dt [3]=mass ...
# @todo AthenaC has spaces in the column names, would need a different parsers
if args.hst:
print("DEBUG hst",line2)
variables = [v.split('=')[1] for v in variables]
print("tab variables detected:",variables)

var_len = len(variables)

Expand All @@ -221,10 +231,12 @@ def mouse_moved(e):

rax = fig.add_axes([rdleft, rbot, rwidth, rheight])

# @todo label_props and radio_props don't appear until python 3.10.x

radio = RadioButtons(rax,
tuple(variables),
# label_props={'color': ['white' for _ in variables]},
# radio_props={'color': ['#1f77b4' for _ in variables], 'edgecolor': ['black' for _ in variables]}
label_props={'color': ['white' for _ in variables]},
radio_props={'color': ['#1f77b4' for _ in variables], 'edgecolor': ['black' for _ in variables]}
)
rax.axis('off') # removes the border around the radio buttons
radio.on_clicked(select_h)
Expand All @@ -236,7 +248,8 @@ def mouse_moved(e):
rax = fig.add_axes([rdleft + 0.015, rbot, 0.25, rheight])
radio2 = RadioButtons(rax,
tuple(variables),
radio_props={'color': ['#1f77b4' for _ in variables], 'edgecolor': ['black' for _ in variables]})
radio_props={'color': ['#1f77b4' for _ in variables], 'edgecolor': ['black' for _ in variables]}
)
rax.axis('off')
radio2.on_clicked(select_v)

Expand Down

0 comments on commit 3d85a16

Please sign in to comment.