The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Astro::Flux - Class for handling astronomical flux quantities.

SYNOPSIS

  use Astro::Flux;

  $flux = new Astro::Flux( $quantity, $units, $waveband );

  $quantity = $flux->quantity('mag');

DESCRIPTION

Class for handling astronomical flux quantities. This class does not currently support conversions from one flux type to another (say, from magnitudes to Janskies) but may in the future.

METHODS

Constructor

new

Create a new instance of an Astro::Flux object.

  $flux = new Astro::Flux( $quantity, $type, $waveband );

The first three parameters must be defined. They are:

  quantity - numerical value for the flux, my be a primitive, or a
             C<Number::Uncertainty> object.
  type - type of flux. Can be any string.
  waveband - waveband for the given flux. Must be an C<Astro::WaveBand> object.

If any of the parameters are undefined, the constructor will throw an error. If the waveband parameter is not an Astro::WaveBand object, the constructor will throw an error.

The type is case-insensitive for lookups using the quantity method.

A fourth optional argument may be passed; this is a hash containing the following optional keys:

  quality - an C<Misc::Quality> object denoting quality flags for the
    C<Astro::Flux> object.
  reference_waveband - an C<Astro::WaveBand> object denoting a reference
    waveband for the C<Astro::Flux> object. This is used for determining
    magnitudes when deriving them from C<Astro::FluxColor> objects. See
    C<Astro::Fluxes>.
  datetime - an C<DateTime> object which is the datetime of observation for the
    measurement in the C<Astro::Flux> object.
  obsid - An array reference to a list of observation identifiers. Can be
    used to identify the observation(s) from which this measurement was
    taken (e.g. from a filename).

Accessor Methods

quantity

Returns the quantity for a requested flux type.

  my $mag = $flux->quantity('mag');

No conversions are done between types. What you put in via the constructor is all you can get out, so if you specify the type to be 'magnitude' and you ask for a 'mag', this method will throw an error.

The type is case-insensitive.

error

Returns the error in the quantity for a requested flux type.

  my $mag = $flux->error('mag');

No conversions are done between types. What you put in via the constructor is all you can get out, so if you specify the type to be 'magnitude' and you ask for a 'mag', this method will throw an error.

The type is case-insensitive.

Errors are only returned if one was created with the object.

waveband

Returns the waveband for the given flux object.

  my $waveband = $flux->waveband;

Returns an Astro::WaveBand object.

quality

Returns the quality for the given flux object.

  my $quality = $flux->quality;

Returns an Misc::Quality object if defined. If not, returns undef.

reference_waveband

Returns the reference waveband for the given flux object.

  my $ref_waveband = $flux->reference_waveband;

Returns an Astro::WaveBand object if defined. If not, returns undef.

datetime

Sets or returns the datetime stamp for the given flux object.

  my $datetime = $flux->datetime;
  $flux->datetime( new DateTime );

Returns an Date::datetime object if defined. If not, returns undef.

obsid

Sets or returns the observation ID for the given flux object.

  my $obsid = $flux->obsid;
  $flux->obsid( $obsid );

Returns an array reference if defined. If not, returns undef.

type

Returns the type of flux measurement stored.

  my $type = $flux->type;

Cannot be used to set the type.

REVISION

 $Id: Flux.pm,v 1.14 2005/06/24 21:02:11 bradc Exp $

AUTHORS

Brad Cavanagh <b.cavanagh@jach.hawaii.edu>, Alasdair Allan <aa@astro.ex.ac.uk>

COPYRIGHT

Copyright (C) 2004 - 2005 Particle Physics and Astronomy Research Council. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.