Ifeffit(3pm)
π NAME π
Ifeffit β the Perl interface to the IFEFFIT XAFS Analysis library. yes bestie, it's giving "glue your Perl script directly to an XAFS analysis engine" and honestly? iconic. π¦
β¨ SYNOPSIS β¨
use Ifeffit;
use Ifeffit qw(put_scalar put_string put_array);
use Ifeffit qw(get_scalar get_string get_array);
my ($kmin, $my_file, $file_type ) = (0.01, "Cu.xmu", "xmu");
put_scalar("rbkg", 1.1);
put_scalar("kmin", $kmin);
put_string("filename", $my_file);
ifeffit(" read_data($my_file, prefix= my,");
ifeffit(" type= $file_type)");
ifeffit(" newplot (energy, xmu ) ");
my $e0 = get_scalar("e0");
print "e0 = $e0 , rbkg = " ,get_scalar("rbkg"), "\n";
πΈ DESCRIPTION πΈ
The Ifeffit Perl Module hands you the keys to the ifeffit library for XAFS analysis. π It gives you seven perl functions, no more no less: ifeffit, put_scalar, get_scalar, put_string, get_string, put_array, and get_array.
Okay so here's the tea: ifeffit is always provided for you β it's exported automatically by the use Ifeffit; pragma, no asking required π
. But the other commands? Those you have to explicitly import yourself, exactly like it's shown up there in the synopsis. no free rides bestie π
π§ ifeffit
The ifeffit function is the main character here β it's the primary interface to the ifeffit engine. π
Whatever character string you hand it gets interpreted as an ifeffit command. And it reports back like a good bestie:
- it returns
0if a valid command was sent and fully processed β¨ - it returns
-1if only a partial command was sent (so it'll be sitting there waiting for the rest of the command next time you call it π) - it returns
1if the"quit"command was sent - and it returns other non-zero values on error π
The syntax for and meaning of the command lines themselves is described in The Ifeffit Reference Manual of the Ifeffit distribution β go read that, I'm not making it up, fr fr.
The syntax for the perl function is:
"$i = ifeffit("plot(my.x, my.y)");"
π put_scalar
This one sets the value of a named scalar inside the list of ifeffit data. The value you set gets returned back to you on successful execution. π«Ά
The syntax is:
"$i = put_scalar("kweight", 2.0);".
which is equivalent to:
"$i = ifeffit("kweight = 2.0");"
But likeβ¦ having a choice? That's just the perl way, lowkey. π
π get_scalar
This returns the value of a named ifeffit scalar. The syntax is:
"$value = get_scalar("x");"
π put_string
This sets the value of a named ifeffit string. The value is returned on successful execution. The syntax is:
"$i = put_text("home", "the merry old land of oz");".
The same effect could be achieved with the command:
"$i = ifeffit("set \$home = 'the merry old land of oz'");".
but put_text takes care of that icky leading dollar sign for you π and it returns the string instead of a simple exit status. so it's basically the upgrade. β¨
π¦ get_string
This returns the value of a named ifeffit string. The syntax is:
"$bg = get_string("plot_bg");"
π put_array
This copies a perl array of numeric values over to an ifeffit array. The syntax is:
"put_array("my.array",\@array);"
which creates (or overwrites β it does not care π
) the ifeffit array my.array, and fills it with the values of the perl array @array.
β οΈ Note that the reference to the array is passed into put_array, not the whole array itself! Don't forget that backslash bestie, it's the whole vibe check of this function.
β get_array
This gets the values of an ifeffit array of numeric values. The syntax is:
"@array = get_array("my.array");"
which will fill the perl array @array with the ifeffit array my.array. slay. π
π AUTHOR π
Matthew Newville -- newville@cars.uchicago.edu
π SEE ALSO π
ifeffit, Ifeffit Reference Manual, perl(1)
PGPERL, PDL, GNU ReadLine Library
and that's the whole page bestie π«Ά this one shipped as perl v5.40.0 on 2025-02-16, and it lives in the manual as Ifeffit(3pm). go forth and analyze some XAFS, you've got this πβ¨πΈ
π¦ where this page comes from
- debian trixie: libifeffit-perl 2:1.2.11d-12.7 Β· ifeffit
- ubuntu questing: libifeffit-perl 2:1.2.11d-12.7
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms