I'm pleased to say that my programming in Python is going really well and I've managed to write about 70% of the codes I need (for a data analysis program) and now I'm starting with the last 30%. :)

I have a text file containing data from a set of observations. The data covers about a year's worth of observations. What I would like to do is create an interactive plot window that allows me to:
a) Display the data for a certain day and then when I'm done with it, clear the plot window and plot the next day's data and so on, until all days have been looked at.
b) Select data points that should be deleted (outliers etc., this can be done while part a is running) and write the "good data" to a file.
c) Use the good data to search (by eye) for certain events in the data, such as a drop in intensity, and then fit a straight line to the data (either in the window or write the data to a file and run a separate analysis) and write the regression parameters of the line to a file for later use.

I have a code for the regression analysis but I'm trying to figure out how to write the code for the interactive data analysis. I've installed matplotlib but I do know that it has a tendency to crash when you run the program for a second time (e.g. when you use plt.show()). I can do basic plots in matplotlib but I'm unsure how to write a code for parts a - c. If I can be directed to a pdf or a website or even get a bit of code to push me in the right direction, it will be greatly appreciated.

Kind Regards


I've downloaded iPython and I've developed a code that loops through all my data and does what I need it to do.

One of the things that is really useful is the event handling of matplotlib. Most codes I've seen print the data of a mouse click on a plot window. What I want to do, is write the event data to a text file which will be used later on. Because I have so much data, I'll most probably have a couple of mouse clicks per plot. How can I get my code to open a text file, write the event data to it (without overwriting previous entries) all the while as I go through my data?