2.7. Handling arbitrary data

At times you might find a need to import data from an arbtrary file that DEMETER knows nothing about or for which a filetype plugin does not exist. In that case, DEMETER offers its most bare-bones approach to creating a Data object.

The put method is used to create a new Data object from two perl arrays containg the energy and μ(E) data.

$data = Demeter::Data -> put(\@energy, \@xmu);

The put method returns a normal Data object. The two arguments are array references containing the data.

This method is useful when DEMETER provides no other way of importing data, in which case you will have to write a program to disentangle the data and insert it into two arrays. Another use might be when generating data, possibly artifical or theoretical data, algorithmically.

You can supply attribute values in the same manner as the new or set methods.

$data = Demeter::Data -> put(\@energy, \@xmu, @args);

If you are creating a Data object to hold χ(k) data rather than μ(E) data, you must use the additional arguments, as this method sets the datatype attribute to “xmu”.

$data = Demeter::Data -> put(\@energy, \@xmu, datatype=>'chi');

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.