Hi Matt,
Hi Shelly,
Bruce says: P.S. Once again, on the topic of how people can contribute to the ifeffit project without writing code, volunteering to conceive of a battery of tests and then actually running them would be an excellent contribution. Any takers?
I would think that someone would want to write a perl script to execute a bunch of Athena/Artimis commands and then check the results. Then have the script write out a report. (Kind of like what tkperl does when you do install the software?) Can Athena/Airtimes commands be executed from a script? If someone was willing to figure out how to do this for one or two of the commands, I would be willing to extend it to the rest.
Testing ifeffit commands with the Ifeffit perl module is definitely possible. That may miss some artemis/athena capabilities and potential problems, but would still be useful. You could certainly emulate much of athena's functionality into perl scripts to do background subtraction, FFTs, and merging of data with a wide range of parameters and data sets.
A script like the simple one below might be pretty good place to start. (This could be done in languages other than perl and English). There is also a test.pl with the ifeffit source perl module (I think it's called t/ifeffit.t in horae), which mostly tests passing of data between perl and Ifeffit. Since the script below essentially runs an ifeffit script, there are several test/example scripts in the examples/ folder that could be used as the basis of other tests.
The main difficulty is deciding when the analysis or calculated values are "right", which makes detecting problems hard to automate.
If anyone wants more pointers on how to use the ifeffit from scripts (perl, python, tcl, ...), please let us know.
--Matt
#! /usr/bin/perl use Ifeffit; use Ifeffit qw(get_scalar);
my $xmu_file = "a.xmu"; my $expected_e0 = 8980.0; my $toler = 0.5;
print "Test Finding E0 for $xmu_file: ";
my $script =<<"END"; read_data(file = $xmu_file, prefix = my, type = xmu) pre_edge(my.energy, my.xmu) END
$ret = ifeffit($script); # should test $ret for errors. $e0 = get_scalar("e0"); print " found $e0, which is ";
if ( abs($e0 - $expected_e0) le $toler) { print "ok\n"; } else { print "outside of expected range\n"; }
##---- end test_e0.pl
This is the kind of script is what I had in mind. As you mentioned this script checks ifeffit directly. I would like to extend it so that Athena is checked. Does anyone know how to do that? This makes me think that if one was cleaver about the way that the test is written that it could be done to check both Athena and/or Ifeffit. That would make the tests more general diagnostic tools. Shelly