Ask Your Question

dyntools 33.12 error

asked 2020-03-26 12:12:45 -0600

anonymous user


I've created a piece of code that extracts results from all .out files in a directory. I have been using it with no issues in 33.7 but with the new version of 33.12 I am trying to get the code updated but I am seeing the following issue:

ine 398, in <module> shorttitle, chanid, chandata = MyChannel.getdata(channels=[], outfile = FaultName) File ".\", line 1483, in getdata KeyError: u'Faultp4_delay.out'

I have updated for the new dyntools but I am still getting the issue. My code is below

MyChannel = dyntools.CHNF(FaultName,outvrsn='0')

shorttitle, chanid, chandata = MyChannel.getdata(channels=[], outfile = FaultName)

Is there anything obvious I am doing incorrectly?

edit retag flag offensive close merge delete


Try.. MyChannel = dyntools.CHNF(FaultName) shorttitle, chanid, chandata = MyChannel.get_data()

Carlos G gravatar imageCarlos G ( 2020-04-03 11:56:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-03-26 14:19:00 -0600

jconto gravatar image

updated 2020-03-27 09:20:49 -0600

var outvrsn takes an INT. Enter 0 for old out format, 1 for new outx format.

The code below runs on PSSe33, it will extract data to excel, plot using matplotlib and then save to a pdf:

import matplotlib.pyplot as plt
import psse33
import dyntools

#user data
outfile = r"""outs\Bus152_6cycles.out"""
chan = 3
#data extraction from OUT file
chnfobj = dyntools.CHNF(outfile,outvrsn=0)
short_title, chanid, chandata = chnfobj.get_data()
XLSfile = 'channels.xls'
label0= chanid[chan].split()[0]
label = chanid[chan]
x = chandata['time']
y = chandata[chan]
#save to pdf
edit flag offensive delete link more


This is the only dyntools functions in use for the code. The rest is just math functions but for some reason it thinks there is a key error when it pulls the first file name in on the second line.

alex_me gravatar imagealex_me ( 2020-03-27 05:52:28 -0600 )edit

See example above.

jconto gravatar imagejconto ( 2020-03-27 09:21:10 -0600 )edit

I face problem while importing matplotlib.pyplot. I am using python2.7. Tried installing using pip but error pops up. Help please. Can I also create the above file for multiple channel plot?

brownkid gravatar imagebrownkid ( 2022-05-10 20:57:34 -0600 )edit

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


Asked: 2020-03-26 12:12:45 -0600

Seen: 551 times

Last updated: Mar 27 '20