---
name: "Ifeffit"
section: "3pm"
platform: "linux"
package: "libifeffit-perl"
version: "2:1.2.11d-12.7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Ifeffit"
---

# Ifeffit(3pm)

Perl interface to the IFEFFIT XAFS Analysis library.

## NAME

Ifeffit - Perl interface to the IFEFFIT XAFS Analysis library.

## 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 gives access to the ifeffit library for XAFS analysis.  The module provides seven perl functions - **ifeffit**, **put\_scalar**, **get\_scalar**, **put\_string**, **get\_string**, **put\_array**, and **get\_array**.  The **ifeffit** is always provided (ie, exported by the "use Ifeffit;" pragma), but the other commands must be explicitly imported, as shown above.

### ifeffit

The ifeffit function provides the main interface to the ifeffit engine. The character string argument is interpreted as an ifeffit command. Ifeffit returns 0 if a valid command is sent and fully processed, -1 if a partial command has been sent (so that it will be expecting the rest of the command next), 1 if the "quit" command has been sent, and other non-zero valuses on error.  The syntax for and meaning of command lines to ifeffit is described in *The Ifeffit Reference Manual* of the Ifeffit distribution.  The syntax for the perl function is

`"$i = ifeffit("plot(my.x,  my.y)");"`

### put\_scalar

This sets the value of a named scalar in the list of ifeffit data. The set value is returned on successful execution.  The syntax is

`"$i = put_scalar("kweight", 2.0);"`.

which is equivalent to

`"$i = ifeffit("kweight = 2.0");"`

But having a choice seems like the perl way.

### 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 the icky leading dollar sign, and returns the string instead of a simple exit status.

### 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 to an ifeffit array. The syntax is

`"put_array("my.array",\@array);"`

which creates (or overwrites) the ifeffit array *my.array*, and fill 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!

### 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*.

## AUTHOR

Matthew Newville  --  newville@cars.uchicago.edu

## SEE ALSO

ifeffit, Ifeffit Reference Manual, [**perl**(1)](/perl/1.md)

PGPERL, PDL,  GNU ReadLine Library
