00001
00002 /*---------------------------------------------------------------------------
00003 E.S.O.
00004 ----------------------------------------------------------------------------
00005 File name : spectrum_lines.h
00006 Author : N. Devillard
00007 Created on : November 1999
00008 Language : ANSI C
00009 Description : spectrum line handling routines
00010 *--------------------------------------------------------------------------*/
00011
00012 /*
00013
00014 $Id: spectral_lines.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00015 $Author: amodigli $
00016 $Date: 2003/09/03 12:50:47 $
00017 $Revision: 1.1 $
00018
00019 */
00020
00021 #ifndef _SPECTRUM_LINES_H_
00022 #define _SPECTRUM_LINES_H_
00023
00024
00025 /*---------------------------------------------------------------------------
00026 Includes
00027 ---------------------------------------------------------------------------*/
00028
00029 #include <stdio.h>
00030 #include <stdlib.h>
00031 #include <malloc.h>
00032
00033 #include "memory.h"
00034
00035
00036 /*---------------------------------------------------------------------------
00037 New types
00038 ---------------------------------------------------------------------------*/
00039
00040 /*
00041 * The following struct stores in the simplest way a list of spectral
00042 * lines. nlines is the number of lines in the table wave contains
00043 * their wavelength in Angstroems irel contains their relative
00044 * intensity (no units)
00045 */
00046
00047 typedef struct _SPEC_TABLE_ {
00048 int nlines ;
00049 double * wave ; /* In Angstroems */
00050 double * irel ; /* Relative intensity */
00051 } spectral_table ;
00052
00053
00054
00055
00056
00057
00058 /*---------------------------------------------------------------------------
00059 Function ANSI prototypes
00060 ---------------------------------------------------------------------------*/
00061
00062
00063 /*---------------------------------------------------------------------------
00064 Function : spectral_lines_init()
00065 In : character string
00066 Out : new spectral_table object
00067 Job : the returned object must be deallocated by
00068 spectral_lines_destroy()
00069 Notice : The received path string indicates where the spectal table
00070 should be loaded from.
00071 "oh" internal OH table
00072 "xenon" internal xenon table
00073 "argon" internal argon table
00074 "xenon+argon" internal Xenon+Argon table
00075
00076 Any other name is understood as a file name (with
00077 complete path, or in the current directory) to be
00078 loaded. See spectral_lines_parse_list() for the
00079 acceptable file format for spectral tables in external
00080 ASCII files.
00081 ---------------------------------------------------------------------------*/
00082
00083
00084 spectral_table * spectral_lines_init(char * path);
00085
00086
00087 /*---------------------------------------------------------------------------
00088 Function : spectral_lines_destroy()
00089 In : pointer to valid spectral_table allocated by
00090 spectral_lines_init()
00091 Out : void
00092 Job : deallocate (if necessary) a spectral line table
00093 Notice :
00094 ---------------------------------------------------------------------------*/
00095
00096 void spectral_lines_destroy(spectral_table * spt);
00097
00098
00099 /*---------------------------------------------------------------------------
00100 Function : spectral_lines_parse_list()
00101 In : valid path name (character string)
00102 Out : new spectral_table object
00103 Job : read spectral lines from an external file
00104 Notice : the file format is the following
00105
00106 Lines starting with a '#' are comments, ignored.
00107 Blank lines are ignored.
00108 Spectral lines are given as two values per line, separated by any
00109 number of blanks or tabs. The first value gives the wavelength in
00110 Angstroems, the second is the relative intensity to the other lines
00111 in the SAME table.
00112 ---------------------------------------------------------------------------*/
00113
00114
00115 spectral_table * spectral_lines_parse_list(char * path);
00116
00117
00118
00119 /*---------------------------------------------------------------------------
00120 Function : spectral_lines_build_signal()
00121 In : allocated spectral_table, wavelength range as
00122 [wavemin,wavemax], size of the signal to produce
00123 Out : newly allocated array of pixelvalues, containing the
00124 spectral lines in the requested range as a 1d signal.
00125 Job : produce a 1d signal from the list of spectral lines
00126 Notice : returns NULL in case of error
00127 ---------------------------------------------------------------------------*/
00128
00129 double *
00130 spectral_lines_build_signal(
00131 spectral_table * spt,
00132 double wave_min,
00133 double wave_max,
00134 int size
00135 );
00136
00137
00138 /*---------------------------------------------------------------------------
00139 Function : spectral_line_build_spectrum()
00140 In : wavelength range in nanometers, size of the array in
00141 number of samples, name of a file to be created.
00142 Out : list of spectral lines as a signal, in ASCII
00143 Job : print out a list of spectral lines as a signal to a
00144 file between the requested wave_min and wave_max
00145 Notice : provide NULL as outfilename to print out the results
00146 on stdout instead of a file.
00147 ---------------------------------------------------------------------------*/
00148
00149 void spectral_line_build_spectrum(
00150 char * table_name,
00151 char * outfilename,
00152 double wave_min,
00153 double wave_max,
00154 int nsamples
00155 );
00156
00157 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001