And we’re back!


There were a couple of outages, but it looks like I’ve got things back to normal. Or what passes for normal.

I’ve changed the theme to fusion.

I’ve gone with the Akismet Plugin for handling spam comments, so I apologize in advance if any of your comments get flagged as spam. I’ll do my best to go through the spam folder over the next few weeks to check for mis-classified comments.

I’ve also installed the WP-CodeBox plugin, which lets me do things like this:

=item B<new>
 
Create a new instance of an C<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 C<Astro::WaveBand> object,
the constructor will throw an error.
 
The type is case-insensitive for lookups using the C<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).
 
=cut
 
sub new {
  my $proto = shift;
  my $class = ref( $proto ) || $proto;
 
  my $quantity = shift;
  my $type = shift;
  my $waveband = shift;
 
  my %args = @_;
 
  croak "Quantity must be defined"
    unless defined $quantity;
 
  unless ( UNIVERSAL::isa($quantity, "Number::Uncertainty" ) ) {
     $quantity = new Number::Uncertainty( Value => $quantity );
  }
 
  croak "Type must be defined"
    unless defined $type;
 
  croak "Waveband must be defined"
    unless defined $waveband;
 
  unless ( UNIVERSAL::isa($waveband, "Astro::WaveBand") ) {
     $waveband = new Astro::WaveBand( Filter => $waveband );
  }
 
  my $flux = {};
 
  $flux->{QUANTITY} = { uc($type) => $quantity };
  $flux->{WAVEBAND} = $waveband;
  $flux->{TYPE} = uc( $type );
 
  if( defined( $args{'quality'} ) &&
      UNIVERSAL::isa( $args{'quality'}, "Misc::Quality" ) ) {
    $flux->{QUALITY} = $args{'quality'};
  }
  if( defined( $args{'reference_waveband'} ) &&
      UNIVERSAL::isa( $args{'reference_waveband'}, "Astro::WaveBand" ) ) {
    $flux->{REFERENCE_WAVEBAND} = $args{'reference_waveband'};
  }
 
  if( defined( $args{'datetime'} ) &&
      UNIVERSAL::isa( $args{'datetime'}, "DateTime" ) ) {
    $flux->{TIME} = $args{'datetime'};
  }
 
  if( defined( $args{'obsid'} ) ) {
    $flux->{OBSID} = $args{'obsid'};
  }
 
  bless( $flux, $class );
  return $flux;
 
}

As always, let me know if you notice any problems.

  1. #1 by Chris on 17 August 2010 - 11:01 am

    Seriously? You call UNIVERSAL::isa()? Shame, shame on you.

    Also, welcome back. Nice look.

  2. #2 by Brad on 17 August 2010 - 11:04 am

    It’s from four years ago. :-)

(will not be published)