Astro-XSPEC-TableModel
view release on metacpan or search on metacpan
lib/Astro/XSPEC/TableModel.pm view on Meta::CPAN
The name of the model. It will be truncated to 12 characters.
=item C<units>
The model units. It will be truncated to 12 characters.
=item C<ipars>
A reference to an array of interpolation parameter specification
hashes, as described in L</Parameter Specification>.
=item C<energy>
A reference to a hash containing the energy bins.
energy => { type => ARRAYREF },
=back
The following I<named> arguments are optional:
=over
=item C<additive>
If true, the model is additive. It defaults to false, or
multiplicative.
=item C<redshift>
If true, the B<XSPEC> should include a redshift parameter. It defaults
to false.
=item C<apars>
A reference to an array of "additional" parameter specification hashes,
as described in L</Parameter Specification>.
=item C<keywords>
A reference to an array of B<Astro::FITS::Header::Item> objects, which
will be written to the primary HDU.
=back
=back
=head1 EXAMPLES
A simple example with one integration parameter.
use Astro::XSPEC::TableModel;
use Astro::FITS::CFITSIO::CheckStatus;
# energy grid
my @energy = ( 0..1024 );
# interpolation parameters
my @ipars = ( {
name => 'overlayer',
method => 0,
initial => 0,
delta => 1,
minimum => 0,
bottom => 0,
top => 10,
maximum => 10,
value => [ 0..10 ],
}
);
# create the table
my $fptr =
write_table( output => 'table.fits',
model => 'test',
units => 'pints_of_ale/hr',
ipars => \@ipars,
energy => \@energy,
);
# Fake some spectra.
tie my $status, 'Astro::FITS::CFITSIO::CheckStatus';
my $row = 0;
my $npars = 1;
my $nbins = @energy - 1;
for my $ol ( 0..10 )
{
$row++;
my @spectrum = map { 1 + $ol**2 * $_ } @energy;
$fptr->write_col_dbl( 1, $row, 1, $npars, [ $ol ], $status );
$fptr->write_col_dbl( 2, $row, 1, $nbins, \@spectrum, $status );
}
$fptr->close_file( $status )
=head1 DIAGNOSTICS
Astro::XSPEC::TableModel will B<croak> upon error.
=over
=item C<< %s parameter %s: missing attributes: %s >>
The parameter specification is incomplete and is missing the listed attributes.
=item C<< %s parameter %s: illegal extra attributes: %s >>
The parameter specification has extra, unrecognized attributes.
=item C<< Error creating %s: %s >>
CFITSIO was unable to create the file for the given reason.
=item C<< Error creating %s HDU: %s >>
CFITSIO was unable to create the specified HDU for the given reason.
( run in 0.377 second using v1.01-cache-2.11-cpan-39bf76dae61 )