First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

how to extract out file and plot with matplotlib

asked Aug 11 '1

anonymous user

Anonymous

updated Aug 11 '1

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.

1 answer

Sort by » oldest newest most voted
0

answered Aug 11 '1

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

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Aug 11 '1

Seen: 478 times

Last updated: Aug 11 '21