epix-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ePiX-users] Histograms, II


From: Marcus D. Hanwell
Subject: Re: [ePiX-users] Histograms, II
Date: Thu, 4 Jan 2007 14:28:05 +0000
User-agent: KMail/1.9.5

Not sure if I have made a mistake somewhere...

On Thursday 04 January 2007 02:44, Andrew D. Hwang wrote:
> Some preliminary (and not yet extensively tested) data plotting code is
> available here:
>
>    http://mathcs.holycross.edu/~ahwang/epix/dataplot.tar.bz2
>
> To use it, unpack it into the epix source directory and rebuild. (Maybe
> install in ${HOME}/tmp for now. :)
>
> There are data_file and data_bins classes. The data_bins class is pretty
> much as outlined in yesterday's post. Here are typical snippets, assuming
> mydat.txt is a data file containing enough columns:
>
> data_file file0("mydat.txt"); // counts # of entries in first row
> data_file file1(Cos, 0, M_PI, 60); // create "file" with one column
> data_file file2(Cos, Sin, 0, M_PI, 60); // or two (up to three)

This looks like a really good way of dealing with input data, and it seems to 
work to this point.
>
> file1.write("trig.dat"); // export file1 to disk file trig.dat
> file2.plot(BBOX);        // scatter plot
> file2.plot(PATH);        // connect the dots

These worked as expected for me too.

> file0.plot(DDOT, log_lin); // semi-log plot of first two columns of file0
> file0.plot(DDOT, log_lin, 2, 5); // semi-log plot of columns 2 and 5

These I could not get working and looking in the header file I couldn't find 
definitions of log_lin nor the overloaded function prototype for the plots 
used above. In fact I can only see two plot functions defined in that class.
>
> double mean(file2.avg(2)); // arithmetic mean of column 2
> file0.regression(2,3); // regression line for columns 2 and 3
>
> data_bins H(-1, 1, 20); // [-1,1] divided into 20 equal subintervals
> H.read(file1.column(1)); // sort and count first column of file1
> H.read(file0.column(4), Cos); // append cosines of 4th column of file0
> H.histogram(); // histogram; box height is population of bin

All of this worked as expected here and it seems like a much nicer way to do 
this - I can throw my slightly patched histogram function away now :)

> H.plot(); // smoothed histogram curve, not yet implemented
>
This didn't plot anything here for me although I am not sure why. I haven't 
dug through the new code as yet but if I take away the .histogram call then 
nothing is plotted on the graph.
>
> There are a few other features; please see the header file for full
> details. The manual will be updated within a few days (not until features
> stabilize... :) Log axis labels and (semi-)log coordinate grids are coming
> soon.

That sounds great - you have a willing tester here. The log scales and grids 
would be extremely useful but right now I can't get the log_lin graphing to 
work although I could write the code for it not with what you have told me!
>
> The old data plotting code emits "deprecated" warnings if its called. I'll
> probably add a couple of global (non-class) plot/histogram functions, but
> the call syntax will differ slightly from the old versions (the number of
> columns in the data file won't be required).
>
I have already thought of some cool features I would love to add to the 
data_file class such as data sorting - sorting the data clipping. I don't 
know if that would be best in the plot or the data functions - i.e. only plot 
in this x range or that y range. Right now points are plotted outside of the 
graph bounds here - they could just use the x_min/max values and not plot 
points outside of this range in the plot functions.

Then there is the possibility of extending the plots to plots with error bars 
in a third column. If it is helpful and I have begun to understand your style 
I could probably write some of this stuff and supply diffs/new functions?

A data manipulation method would be useful too - that may not be useful more 
widely but we often want to add to or multiply x/y data (adjusting background 
to match, offsetting plots to display more than one data set on the same x 
scale).

Thank you for the new functions - they are a big improvement in the data 
plotting capabilities of ePiX. Please let me know if there is any other way 
in which I can help with these changes. I am happy working with CVS/SVN ;)

Thanks,

Marcus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]