11. Using perl to structure a fit¶
It is very helpful to make use of perl's data structures and control structures when precessing large quatities of data. In this example, a list of attribute names and values common to all Data objects is defined starting at line 4 and then pushed onto each Data object at line before plotting at line 13. Because attributes were updated, the plot will trigger all appropriate data processing steps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/usr/bin/perl
use Demeter;
my @params = (bkg_pre1 => -30, bkg_pre2 => -150,
bkg_nor1 => 150, bkg_nor2 => 1757.5,
bkg_spl1 => 0.5, bkg_spl2 => 22,
fft_kmax => 3, fft_kmin => 14,);
my $prj = Demeter::Data::Prj -> new(file=>'iron_data.prj');
my ($data1, $data2) = $prj -> records(1,2);
foreach my $obj ($data1, $data2) {
$obj -> set(@params);
$obj -> plot('R');
};
|
11.1. Using perl's control structures¶
Using perl
11.2. Cloning Demeter objects¶
Cloning
DEMETER is copyright © 2009-2016 Bruce Ravel – This document is copyright © 2016 Bruce Ravel
This document is licensed under The Creative Commons Attribution-ShareAlike License.
If DEMETER and this document are useful to you, please consider supporting The Creative Commons.