Ask Your Question
0

TIME ARRAY EXTRACTION

asked 2016-01-11 23:50:48 -0600

MAMAMO gravatar image

Hi After running simulations, I want to extract simulation running time (from 0 to 20s, with defined time step,around 2000 numbers in array) as an array. Because I want to work on outputs and change their scales and then plot them with time array to have accurate results. Could you help me to make this? A hint could be so helpful. thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-19 00:33:29 -0600

IanMelbourne93 gravatar image

Hey try this. Will help you extract your time and then separate your data into a list format rather than the default dictionary. Once you have this, you can plot it with Matplotlibs. Let me know how you go

import dyntools

# Run dyntools to extract the data
chnfobj = dyntools.CHNF(os.path.join(folder, outfile))
sh_ttl, ch_id, ch_data = chnfobj.get_data()

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

# Number of channels, (-1 as 'time' is represented in channel data)
count = len(ch_id) - 1

# Extract channel data
data = [ch_data[x + 1] for x in xrange(count)]
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

Stats

Asked: 2016-01-11 23:50:48 -0600

Seen: 3,506 times

Last updated: Feb 19 '16