Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  ASTRO::WAVEBAND (3)

.ds Aq ’


Astro::WaveBand - Transparently work in waveband, wavelength or filter



  use Astro::WaveBand;

  $w = new Astro::WaveBand( Filter => $filter );
  $w = new Astro::WaveBand( Wavelength => $wavelength );

  $w = new Astro::WaveBand( Wavelength => $wavelength,
                            Instrument => CGS4 );

  $filter = $w->filter;
  $wave   = $w->wavelength;
  $band   = $w->waveband;    # radio, xray, submm
  $freq   = $w->frequency;
  $wnum   = $w->wavenumber;

  $natural= $w->natural;
  $natural = "$w";


  if( $w1 > $w2 ) { ... }
  if( $w1 == $w2 ) { ... }


Class to transparently deal with the conversion between filters, wavelength, frequency and other methods of specifying a location in the electro-magentic spectrum.

The class tries to determine the natural form of the numbers such that a request for a summary of the object when it contains 2.2 microns would return the filter name but would return the wavelength if it was not a standard filter. In ambiguous cases an instrument name is required to decide what to return. In really ambiguous cases the user can specify the unit in which to display the numbers on stringification.

Used mainly as a way of storing a single number in a database table but using logic to determine the number that an observer is most likely to understand.

Numerical comparison operators can be used to compare two Astro::WaveBand objects. When checking equality, the natural and instrument methods are used, so if two Astro::WaveBand objects return the same value from those methods, they are considered to be equal. When checking other comparisons such as greater than, the wavelength is used.



<B>newB> Create a new instance of an Astro::WaveBand object.

  $w = new Astro::WaveBand( Filter => $filter );

Allowed keys for constructor are one of:

  Filter     - filter name
  Wavelength - wavelength in microns
  Frequency  - frequency in Hertz
  Wavenumber - wavenumber in cm^-1

plus optionally:

  Instrument - name of associated instrument

In the future there may be a Units key to allow the units to be supplied in alternative forms.

If a mandatory key is missing or there is more than one mandatory key the constructor will fail and return undef. Additionally a warning (of class Astro::WaveBand) will be issued.

    Accessor methods

All the accessor methods associated with conversions will automatically convert to the correct format on demand and will cache it for later. If a new value is provided all caches will be cleared.

All input values are converted to microns internally (since a single base unit should be chosen to simplify internal conversions).
<B>wavelengthB> Wavelength in microns.

  $wav =  $w->wavelength;

<B>frequencyB> Frequency in Hertz.

  $frequency = $w->frequency;

<B>wavenumberB> Wavenumber (reciprocal of wavelength) in inverse centimetres.

  $value = $w->wavenumber;

<B>filterB> Set or retrieve filter name.

Returns undef if the filter can not be determined. If the filter name can not be translated to a wavelength it will not be possible to do any conversions to other forms.

<B>instrumentB> Name of associated instrument.

  $inst = $w->instrument;
  $w->instrument( SCUBA );

Used to aid in the choice of natural unit.

<B>natural_unitB> Override the natural unit to be used for stringification. If this value is not set the class will determine the unit of choice by looking at the instrument name and then by taking an informed guess.


    General Methods

<B>wavebandB> Return the name of the waveband associated with the object.

Returns undef if none can be determined.

 $band = $w->waveband;

<B>naturalB> Return the contents of the object in its most natural form. For example, with UFTI the filter name will be returned whereas with ACSIS the frequency will be returned. The choice of unit is chosen using the supplied default unit (see natural_unit) or the instrument name. If none of these is specified filter will be used and if no match is present wavelength in microns.

  $value = $w->natural;

Returns undef if the value can not be determined.

This method is called automatically when the object is stringified. Note that you will not know the unit that was chosen a priori.

<B>compareB> Compares two Astro::WaveBand objects.

  if( $wb1->compare( $wb2 ) ) { ... }

This method will return -1 if, in the above example, $wb1 is of a shorter wavelength than $wb2, 0 if the wavelengths are equal, and +1 if $wb1 is of a longer wavelength than $wb2. Please note that for strict waveband equality the equals method should be used, as that method uses the natural method to check if two wavebands are identical.

This method is overloaded with the standard numerical comparison operators, so to check if one waveband is shorter than another you would do

  if( $wb1 < $wb2 ) { ... }

and it will work as you expect. This method does not overload the == operator; see the compare method for that.

<B>equalsB> Compares two Astro::WaveBand objects for equality.

  if( $wb1->equals( $wb2 ) ) { ... }

This method will return 1 if, in the above example, both Astro::WaveBand objects return the same value from the natural method AND for the instrument method (if it is defined for both objects) , and 0 of they return different values.

This method is overloaded using the == operator, so

  if( $wb1 == $wb2 ) { ... }

is functionally the same as the first example.

<B>not_equalsB> Compares two Astro::WaveBand objects for inequality.

  if( $wb1->not_equals( $wb2 ) ) { ... }

This method will return 1 if, in the above example, either the natural method or the instrument method return different values. If the instrument is undefined for either object, then the natural method will be used.

This method is overloaded using the != operator, so

  if( $wb1 != $wb2 ) { ... }

is functionally the same as the first example.

    Static functions

These functions enable the user to obtain an overview of the supported filter, instrument and telescope combinations.
<B>has_filterB> Returns true if the a particular instrument has a particular filter, otherwise returns undef, e.g.

  if( Astro::WaveBand::has_filter( UIST => "Kprime" )  {

if you pass a hash containing multiple instrument combinations, all must be valid or the method will return undef.

<B>has_instrumentB> Returns true if the a particular instrument exists for a particular telescope, otherwise returns undef, e.g.

  if( Astro::WaveBand::has_instrument( UKIRT => "UIST" )  {

if you pass a hash containing multiple instrument combinations, all must be valid or the method will return undef.

<B>is_observableB> Returns true if the a particular telescope and filter combination is avaialable, otherwise returns undef, e.g.

  if( Astro::WaveBand::is_observable( UKIRT => Kprime )  {


Does not automatically convert metres to microns and GHz to Hz etc.

Can not handle filters that correspond to multiple wavelengths. Currently SCUBA is the main issue. With a 450:850 filter this class always returns the shortest wavelength (since that is the wavelength that affects scheduling the most).

Should handle velocities and redshifts in order to disambiguate rest frequencies and observed frequencies. Would also be nice if the class could accept a molecule and transition, allowing the natural unit to appear as something like: CO 3-2 @ 30km/s LSR radio.


Tim Jenness <> Alasdair Allan <> Tim Lister <>


Copyright (C) 2001-2003 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.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 ASTRO::WAVEBAND (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.