Ask Your Question
0

how to extract out file and plot with matplotlib

asked 2021-08-10 19:35:58 -0500

anonymous user

Anonymous

updated 2021-08-11 10:20:30 -0500

jconto gravatar image

Hi all,

I have some issue to plot out file with matplotlib. Here is the code i've used.

outfile=tk.askopenfilename(title="Select a .out file",filetypes=(("PSS/E outfile","*.out"),("all files","*.*")))

### Run dyntools to extract the data###
chnfobj = dyntools.CHNF(outfile)

short_title, chanid_dict, chandata_dict = chnfobj.get_data()


### Extract time as a variable###
time = chandata_dict ['time']

f = chandata_dict['freq']

Here is the error

Traceback (most recent call last):
  File "C:\Users\dyntoolstest.py", line 34, in <module>
    f = chandata_dict['freq']
KeyError: 'freq'

What should i put in [] of f ?

Thank you in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2021-08-11 04:00:35 -0500

perolofl gravatar image

The dictionary is indexed with the channel number (integer).

I.e. f = chandata_dict[24] to get the values for channel 24

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2021-08-10 19:35:58 -0500

Seen: 451 times

Last updated: Aug 11 '21