6.1.0 Spectral components

Most of the definitions in here implicitly assume that wavelength is expressed in Angstrom and flux density in photon/s/cm*2/Angstrom.

Notation:
 

  • w     - wavelength in Angstrom
  • ref_w - reference wavelength in Angstrom
  • amp   - amplitude
  • f     -  flux density (emission components)
  • t     - transparency (absorption components)
  • flux  - total flux under line profile
  • c     - speed of light in km/s
  • fwhm  - Full Width at Half Maximum in km/s
  • T     - temperature in Kelvin

 

6.1.1 Broad band components

6.1.1.1 Polynomial

Functional form: The polynomial function implements a Legendre series. The polynomial order is set automaticaly to be one less than the number of wavelength ranges present in the data set to be fitted. The data values input to the polynomial fitting calculation are computed as the average wavelength and average flux density in each wavelength range.

 

In that way the polynomial fit is guaranteed to match de data values associated with the user-selected ranges (interpolating polynomial). See how to define wavelength ranges in Sec. 6.4.

 

Also, the polynomial thus defined is automatically fitted to the data by a linear least-squares algorithm. Thus there is no need to explictly invoke the Specview fit manager mechanism (Sec. 6.7) if the only component in the model is an interpolating polynomial.

 

Polynomials of any order can be defined. The order is displayed by the GUI, but cannot be modified directly by the user, as explained above. However, the maximum order of the polynomial can be defined by the user by typing the desired value in the appropriate field in the polynomial GUI window (type the Enter or Return key after typing the desired maximum order value). As one adds more wavelength ranges, the polynomial order will be kept constant once the number of ranges exceeds the maximum order plus 1.

 

Note that, when decreasing the maximum order, the polynomial will not recalculate itself to the new order. One must either add or remove (undo) a wavelength range in order to force the polynomial to recompute itself.

Adjusting mechanism:  when first added to the model, a polynomial adjusts itself by, first, binning the piece of data visible through the plot view port into N bins, where N = order + 1. It then sets its coefficients to the interpolating polynomial that interpolates in between the N data values.  If no data is visible through the view port,  it adjusts its first two coefficients to the diagonal across the view port.

Once added, the polynomial keeps itself adjusted to the wavelength ranges associated with the data.  

Bug: once a polynomial is saved to a component database file (Sec. 6.8), it can be read back, but will not fit itself anymore.

 

6.1.1.2 Power law

Functional form:  f = amp * (w / ref_w) ** index

Adjusting mechanism:  a power law adjusts itself by first setting the index to -1. It then locates the mid point on the wavelength scale (or the WCS view port if no data is visible through the view port) and sets the reference wavelength to that value. The amplitude is set to the average of all values of the function when computed over each data point visible through the view port. If no data is visible, the amplitude is set to the mid point of the view port.
 

6.1.1.3 Broken power law

Functional form:

f = amp * (w / ref_w) ** index1   if      w < ref_w
f = amp * (w / ref_w) ** index2   if      w >= ref_w

Adjusting mechanism:  both sides of the broken power law are independently adjusted by the same mechanism described for the standard power law.
 

6.1.1.4 Black body

Functional form:

amp * ref_w**5 * [exp(1.438786E8 / T / ref_w) - 1]
-------------------------------------------------- = f
w**5 * [exp(1.438786E8 / T / w) - 1]

Adjusting mechanism:  Temperature is set to 5,000 K. Reference wavelength is set to the mid point of the  WCS view port. Amplitude is set to half the top value on the WCS view port.
 

6.1.1.5 Bremstrahlung

Functional form:   f = amp * (ref_w / w)**2 * exp (-1.438779E8 / w / T)

Adjusting mechanism:  the same used by the black body component.
 

6.1.1.6 Recombination continuum

Functional form:

f = amp * exp(-(w - ref_w)**2 / (ref_w * fwhm / c / 2.354820044)**2 / 2)

if    w >= ref_w

or

f = amp * (ref_w / w)**2 * exp -(1.440E8 * (1/w - 1/ref_w) / T)

if   w < ref_w

Adjusting mechanism:  Amplitude and reference wavelength are set in the same way used by the black body component. Temperature and FWHM are not adjusted to the data or view port but are initialized to 10,000 K and 200 km/s respectively when the component is first created.
 

6.1.1.7 Accretion disk

Functional form:    f = amp * (w / 20000)**(-beta) * exp (-ref_w / w)

Adjusting mechanism:  Amplitude and reference wavelength are set to the mid point of the WCS view port. The beta parameter is solved for the WCS view port corners.

6.1.1.8 Kurucz model

Functional form:    5-parameter functional form includes amplitude and radial velocity, besides the three parameters used to describe a Kurucz stellar model (Teff, log gravity, log metalicity).

 

For every set of parameters, the function is found by linear interpolation in the Kurucz 3-parameter grid (as implemented in STScI's Synphot program) and then resampled in radial velocity and renormalized in flux.

 

This function is only available if the model grid is locally installed (see the Specview web site at http://www.stsci.edu/resources/software_hardware/specview/download for instructions).

Adjusting mechanism:  A solar Kurucz model (Teff=5777K,logg=+4.44,logz=0.0) at zero radial velocity is renormalized in flux to match the spectrogram being displayed.

6.1.1.9 Absorption edge

Functional form:

t = exp[-tau * (w / ref_w)**3]   if   w <=  ref_w

Adjusting mechanism:  The reference wavelength is set at the mid point of the data array or WCS view port.
 
 

6.1.2 Line profile components

6.1.2.1 Gaussian emission

Functional form:

sigma = ref_w * fwhm / c / 2.354820044
delta = (w - ref_w) / sigma

if  skew == 1

f = flux * exp (- delta**2 / 2) / sigma / 2.50662828

if   skew != 1

f = 2 * flux * exp(- delta**2 /2)/ sigma /2.50662828/(1+skew)
if w <= ref_w
 

f = 2 * flux * exp(- delta**2 /2/ skew**2)/ sigma /2.50662828/(1+skew)
if w > ref_w

Adjusting mechanism:  Reference wavelength is set to the mid point of the WCS view port. FWHM is set to 40% of the WCS view port size (in km/s).  Flux is set to 40% of the area in the WCS view port. Skewness is not adjusted but is initialized to 1.0 when the component is created.
 

6.1.2.2 Lorentz emission

Functional form:

f = flux * ref_w * fwhm / c /
([abs(w - ref_w)]**kurt + (ref_w * fwhm / c / 2)**2) / 6.283185308

where kurt is the kurtosis.

Adjusting mechanism:  The same used by the Emission Gaussian component. Kurtosis is not adjusted.
 
 

6.1.2.3 Voigt emission

Functional form:

The approximation presented in Astrophysical Formulae (K. R. Lang, 1980, 2nd ed., p. 220) is used. Namely, the Voigt function is approximated by the sum of a Gaussian and a Lorentzian profiles. This approximation works best when the ratio between the FWHM of the Gaussian and Lorentzian sub-components is near unity.

Adjusting mechanism: similar to the emission Gaussian; each sub-component is initialized to the same FWHM value.
 

6.1.2.4 Log emission

Functional form:

arg = log (2) / log(1 + fwhm / 2 / c)
fmax = (arg - 1) * flux / 2 / c

If  skew = 1:

    f = fmax * (w / ref_w)**arg   if   w < ref_w

    f = fmax * (w / ref_w)**-arg   if   w >= ref_w

If  skew != 1:

   arg1 = log (2) / log (1 + skew * fwhm / 2 / c)
   fmax = (arg - 1) * flux / c / [1 + (arg - 1) / (arg1 - 1)]

   f = fmax * (w / ref_w)**arg     if   w <= ref_w

   f = fmax * (w / ref_w)**-arg1    if   w > ref_w

Adjusting mechanism:  Same as emission Gaussian.  Skew is not adjusted but is first initialized to 1.0 at the time the component is first created.
 

6.1.2.5 Gaussian absorption (equivalent width)

Functional form:

sigma = ref_w * fwhm / c / 2.354820044
ampl = equiv_width / sigma / 2.50662828

t = 1 - ampl * exp [-((w - ref_w) / sigma)**2 / 2]

Adjusting mechanism:  Same as emission Gaussian.
 

6.1.2.6 Gaussian absorption (optical depth)

Functional form:

sigma = ref_w * fwhm / c / 2.354820044
ampl = equiv_width / sigma / 2.50662828

t = exp(-tau * exp(-((w - ref_w) / sigma)**2 / 2))

Adjusting mechanism:  Same as emission Gaussian.
 

6.1.2.7 Lorentz absorption

Functional form: t = 1.0 - equiv_width  / ((1.0 + 4.0 * ((1.0 / w - 1.0 / ref_w;) * ref_w * 2.9979e5 / w)**2) * 1.571 * w * ref_w / 2.9979e5); Adjusting mechanism:  Same as emission Gaussian.
 

6.1.2.8 Voigt absorption

Functional form:

The approximation presented in Astrophysical Formulae (K. R. Lang, 1980, 2nd ed., p. 220) is used. Namely, the Voigt function is approximated by the sum of a Gaussian and a Lorentzian profiles. This approximation works best when the ratio between the FWHM of the Gaussian and Lorentzian sub-components is near unity.

Adjusting mechanism: similar to the absorption Gaussian; each sub-component is initialized to the same FWHM value.
 

6.1.2.9 Log absorption (optical depth)

Functional form:

alpha = log(2) / log(1 + fwhm / 2 / c)

t = exp [-(tau * (w / ref_w)**alpha)]    if   w >= ref_w
t = exp [-(tau * (w / ref_w)**-alpha)]   if   w < ref_w

Adjusting mechanism:  Same as absorption Gaussian (e.w.).
 
 

6.1.3 Interestellar extinction

6.1.3.1 Seaton galactic

Functional form:

Seaton's (Seaton, M. J. 1979, MNRAS 187, 73P) function as implemented in STScI's Synphot program. The computations are based on an adopted value of R = 3.20.

For &lambda; > 3704 Angstrom, it interpolates  linearly in 1 / &lambda; in Seaton's table 3. For &lambda;  < 3704 Angstrom, the class uses the formulae from Seaton's table 2. The formulae match at the endpoints of their respective intervals. There is a mismatch of 0.009 mag/ebmv at &nu;=2.7 (&lambda;=3704 Angstrom). Seaton's tabulated value of 1.44 mag at 1 / &lambda; = 1.1 may be in error; 1.64 seems more consistent with  his other values.

Wavelength range allowed is 0.1 to 1.0 &mu;; outside this range, the result is the extrapolated function.

 References:
 

lambda < 1000

same as lambda = 1000.

1000 < lambda < 3704 

Seaton (1979) MNRAS 187,73p

3704 < lambda < 10,000

Nandy (1975) A+A 44, 195. (corrected to R=3.2)

10000 < lambda 

extrapolate linearly in 1/lambda

Adjusting mechanism:  No adjustment is performed.
 
 

6.1.3.2 CCM galactic

Functional form:

Cardelli, Clayton, and Mathis extinction curve (ApJ, 1989, 345, 245).

Adjusting mechanism:  No adjustment is performed.
 
 
 

6.1.3.3 SM galactic

Functional form:

Savage & Mathis extinction curve (1979, ARA&A, 17, 73-111).

Adjusting mechanism:  No adjustment is performed.
 
 
 

6.1.3.4 FM for the UV

Functional form:

Fitzpatrick and Massa extinction curve with Drude UV bump (ApJ, 1988, 328, 734).

Adjusting mechanism:  No adjustment is performed.
 
 
 

6.1.3.5 LMC

Functional form:

Howart extinction curve for the LMC  (1983 MNRAS, 203, 301).

Adjusting mechanism:  No adjustment is performed.
 
 
 

6.1.3.6 SMC

Functional form:

Prevot et al. extinction curve for the SMC  (1984, A&A, 132, 389-392).

Adjusting mechanism:  No adjustment is performed.
 
 
 

6.1.3.7 Extra-galactic

Functional form:

Calzetti, Kinney and Storchi-Bergmann extragalactic extinction curve  (1994, ApJ, 429, 582).

Adjusting mechanism:  No adjustment is performed.
 

 

6.1.3.8 FUV

This component type is still undergoing tests.

 

Default data files (“atom1.dat”, “ions1.dat”, “lines2.dat” and “fsim_h2.dat”) are included in the Specview  distribution. Alternatively, user-defined files that replace these can be input to the function via the ISMData user preference (Sec. 9). Note that all four files must be present.

 

Functional form:

 

Adjusting mechanism:  No adjustment is performed.
 

 
 

6.1.4 Custom-written spectral components


There is a mechanism for including user-written spectral components into Specview. The user must write Java source code, compile it, and make sure the CLASSPATH variable definition includes the resulting .class file.

In Sec. 6.1.4.1 below we provide an example.

The Java source file will define a class that extends one of three abstract classes: spv.spectrum.function.BroadBandFunction, spv.spectrum.function.NarrowBandFunction, or spv.spectrum.function.AbstractExtinction, depending on the intended use of the component.  That class must:

  • Provide a no-arg constructor to create and initialize the internal parameters to default values;
  • Override the getID() method to provide a unique identification string. This string is used when displaying components on the model manager window;
  • Override the isEmission() method to enable the on-screen component tree to place the new component under the appropriate branch (this is not required in the AbstractExtinction case);
  • Override the addRawValues (double[] xvar, double[] yvar), a method that updates the yvar array with the component values computed with the xvar array values as independent variable. Note that emission components are added to the yvar array, while absorption components must be expressed as a transparency value between 0.0 and 1.0, and multiplied into yvar.

The class can also override methods coarseAdjust (...) and recenter()  if customized handling of the adjustment / recentering operations is required. Examples of component source files can be seen at the Specview source directory specview/src/spv/spectrum/function/. To access the API documentation, point your web browser to http://specview.stsci.edu/doc/index.html.

The values in xvar are assumed to be expressed in Angstrom, and the values in yvar  are assumed to be expressed in photon/s/cm2/Angstrom.

To get the proper environment for compiling your source file, add

import spv.spectrum.function.*;

to your source file and include the specview.jar file in your compilation classpath.

Once the .class file is generated and placed in the appropriate directory, just typing the complete name of the class into the text window at the very bottom of the component selector window (Sec. 6.2.1) will input the new component type and make it available throughout  the application's life.
 

6.1.4.1 Example on writing a custom component

Suppose you want to install in Specview a new type of emission broadband component named "My component". This component type has two parameters, and for the sake of example the functional form is just

y = a + b * x

where a and b are the two parameters, x is the wavelength and y the flux density.

You start by writing a Java source file named MyComponent.java whose contents look like this:

import spv.spectrum.function.*;

public class MyComponent extends BroadBandFunction {

    // The constructor initializes the two parameters to
    // reasonable values, and sets the component name.

    public MyComponent () {
        name = new String ("My component");
        addParameter (new FParameter ("a", 0.0));
        addParameter (new FParameter ("b", 0.0));
    }

    // This method provides an identification string populated
    // with the parameters' current values. You can use
    // anything you like as an id string.

    public String getID() {
        return new String (user_id + ": My component (a = " +
            form1.format (getParameter("a").getValue()) +
            ", b = "  +
            form1.format (getParameter("b").getValue()));
    }

    // This method is used by the code that builds the tree
    // in the factory widget. If not present, the new component
    // will not be added to the tree.

    public boolean isEmission() {
        return true;
    }

    // This method computes the component values and updates
    // the entire model array with them.
    // Note that emision components are added to yvar.

    public void addRawValues (double[] xvar, double[] yvar) {
        double a = getParameter("a").getValue();
        double b = getParameter("b").getValue();

        // Here is the actual computation !
        for (int i = 0; i < xvar.length; i++)
            yvar[i] += b * xvar[i] + a;
    }
}
 

Now this source file must be compiled to generate a .class file. To set your environment for compiling Specview source code, use the -classpath option at the javac command to point to the distributed specview.jar file. Assume that the Specview distributed files were installed in:

Unix:    /home/specview
Windows: C:\specview

and that your MyComponent.java file is in:

Unix:    /home/myclasses
Windows: C:\myclasses

Then, after changing directory to myclasses,  the compilation command line would look like:

Unix:                % javac -classpath /home/specview/specview.jar MyComponent.java
Windows: C:\myclasses> javac -classpath C:\specview\specview.jar MyComponent.java

Upon successful completion, this will generate a MyComponent.class file. Now you just have to make sure this file is included in the classpath for the java command:

Unix:      % java -classpath /home/specview/specview.jar:/home/myclasses spv.Specview
Windows: C:\>java -classpath c:\specview\specview.jar;c:\myclasses spv.Specview

Note that the classpath separator under Unix is a colon, while under Windows it is a semicolon.

To get a more permanent solution, the above java command line can be easily modified and used to replace the existing java command line in either the specview Unix startup script or the SPECVIEW.BAT Windows batch file.

The java command line above starts Specview. Once the model fitting session is started, the new component type can be ingested at any time into the component selector window (Sec. 6.2.1) by just typing its class name (MyComponent) in the editable text window at the bottom of the widget. The new component type will be added to the list of available components (in this case, under the Broad Band - Emission branch), becoming available for further use until the end of the application. An instance of the new component type will also be added to the current model. You can select it and click on the Edit button to check if the parameters were properly created and initialized.

The example source code listed above can be used as a template. Copy and paste it into a text editor, save it and go through all the motions to install the MyComponent example. Once it works, you can start modifying it to suit your needs. Note that there are several variants of both functional forms and parameters to serve specific needs. See the class documentation and source code for more elaborate examples.

Note also that by coupling a simple class like the example above with the Java Native Interface (JNI) library, in principle it would be possible to couple Specview ‘s fitting engine to an arbitrarily complex spectral model written in C or even other programming languages.