mhuss utils 1.1.5ws

com.mhuss.AstroLib
Class VisLimit

java.lang.Object
  extended by com.mhuss.AstroLib.VisLimit

public class VisLimit
extends java.lang.Object

Calculates sky brightness and limiting magnitude.
Based on C code by Bill Gray (www.projectpluto.com), which was in turn based on Brad Schaefer's article and code on pages 57-60, May 1998 _Sky & Telescope_, "To the Visual Limits".

[Bill Gray's Comments:]
The computations for sky brightness and limiting magnitude can be logically broken up into several pieces. Some computations depend on things that are constant for a given observing site and time: the lunar and solar zenith distances, the air masses to those objects, the temperature and relative humidity, and so forth. For use in Guide, I expect to compute brightness at many points in the sky, while all these other values hold constant. So my first step (after putting lat/lon and these other data into an instance of VisLimitAngularBrightnessData) is to call the setBrightnessParams() function. This function does a lot of "setup work", figuring out the absorption per unit air mass at various wavelengths from various causes (gas, aerosol, ozone), the number of air masses to the sun and moon, and so forth.

Once you've done all this, you can call computeSkyBrightness() for any point in the sky. You do need to provide the zenith angle, and the angular distance of that point from the moon and sun. The brightnesses are available via the brightness() functions. The 'mask' value can be used to specify which of the five bands is to be computed. (For example, if I use this to make a realistic sky background, I may just concern myself with the V band... maybe with B and R if I want to attempt a colored sky. In either case, computing all five bands would be excessive.)

Next, you can call computeExtinction() to set any or all of the five extinction values. Normally, I wouldn't see much use for this data. But you do need to have that data if you intend to call the computeLimitingMag() function.

If you use the explicit (all values) constructor, all of the above functions are called for you automatically.

Notice that we modified his test conditions. He had the moon and sun well below the horizon; I found that this didn't make testing contributions from those objects any easier, so we put them where they could contribute more brightness.


Field Summary
static int BAND_0
          Band mask
static int BAND_1
          Band mask
static int BAND_2
          Band mask
static int BAND_3
          Band mask
static int BAND_4
          Band mask
 
Constructor Summary
VisLimit()
          Default constructor.
VisLimit(int bandMask, VisLimitFixedBrightnessData fbd, VisLimitAngularBrightnessData abd)
          Explicit (all values) constructor.
 
Method Summary
 void computeSkyBrightness(VisLimitAngularBrightnessData abd)
          Compute the sky brightness.
 double getBrightness(int i)
          Get the brightess value.
 double getExtinction(int i)
          Get the extinction value.
 double getK(int i)
          Get the K band value.
 double limitingMagnitude()
          Calculate the limiting magnitude.
static void main(java.lang.String[] args)
          (for unit testing only)
 void setBrightnessParams(VisLimitFixedBrightnessData fbd)
          Set the fixed brightness parameters.
 void setMask(int m)
          Set the mask value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAND_0

public static final int BAND_0
Band mask

See Also:
Constant Field Values

BAND_1

public static final int BAND_1
Band mask

See Also:
Constant Field Values

BAND_2

public static final int BAND_2
Band mask

See Also:
Constant Field Values

BAND_3

public static final int BAND_3
Band mask

See Also:
Constant Field Values

BAND_4

public static final int BAND_4
Band mask

See Also:
Constant Field Values
Constructor Detail

VisLimit

public VisLimit()
Default constructor.


VisLimit

public VisLimit(int bandMask,
                VisLimitFixedBrightnessData fbd,
                VisLimitAngularBrightnessData abd)
Explicit (all values) constructor.

Note that the BrightnessData parameters are expected to contain valid data.

Parameters:
bandMask - A logical mask which represents one or more of the five possible bands to calculate.
fbd - The fixed brightness data
abd - The angular brightness data
Method Detail

setBrightnessParams

public void setBrightnessParams(VisLimitFixedBrightnessData fbd)
Set the fixed brightness parameters.

Parameters:
fbd - The fixed brightness data

computeSkyBrightness

public void computeSkyBrightness(VisLimitAngularBrightnessData abd)
Compute the sky brightness.

Parameters:
abd - The angular brightness data

limitingMagnitude

public double limitingMagnitude()
Calculate the limiting magnitude.

Returns:
The limiting magnitude

setMask

public void setMask(int m)
Set the mask value.


getK

public double getK(int i)
            throws ValueException
Get the K band value.

Parameters:
i - Index into the band data
Throws:
ValueException

getBrightness

public double getBrightness(int i)
                     throws ValueException
Get the brightess value.

Parameters:
i - Index into the band data
Throws:
ValueException

getExtinction

public double getExtinction(int i)
                     throws ValueException
Get the extinction value.

Parameters:
i - Index into the band data
Throws:
ValueException

main

public static void main(java.lang.String[] args)
(for unit testing only)


mhuss utils 1.1.5ws

bottom text