Observers

From ASCEND
Jump to: navigation, search

Note: numerous enhancements by Aakash Goenka have recently been added to this part of ASCEND

The Observer tab in PyGTK GUI of ASCEND lets you capture results of 'scenario' simulations. The idea is that you set ASCEND to 'observe' various variables from your model. You do whatever you need to do to solve the model (hopefully that just means you click 'Solve'). Then when you have some numbers that you want to keep, you click 'Keep', or ctrl-K. This adds a new row in your observer table.

Once you've built up a few rows, you can copy the output to the clipboard (and then directly paste it into a spreadsheet) or you can create a plot.

Plotting commands

If you click the 'plot' button, you will get a quick plot of the second column versus the first column.

If you want to do anything more, you need to use the Console. Here are some example of what you can do (this was with the models/johnpye/shm.a4c model from the Model Library. The resulting plots are generated using matplotlib, so you can use matplotlib/pylab commands to add labels, legends, etc to the plots.

O=browser.observers[0]
O.plot() # default: plot second col vs first col

O.plot(x=3) # use the 4th colum for the 'x' values
O.plot(x=0,y=1,y2=2) # plot the second column and the third column versus the first column

O.plot(y2=2) # default + additionally plot the third col
import pylab
pylab.title("a title for the graph")
pylab.xlabel("a new x-axis label")

Note that the x, y, y2 arguments are indexed from zero.

Error creating thumbnail: File missing
Plots created from the 'observer' tab, using the commands given above