Re: continuum normalized spectra [message #83000 is a reply to message #82998] |
Sun, 03 February 2013 00:09   |
abc
Messages: 46 Registered: March 2011
|
Member |
|
|
On Saturday, February 2, 2013 7:42:39 PM UTC+1, David Fanning wrote:
> idlhelp writes:
>
>
>
>> I want to write a program to fit a linear local continuum of absorption line, and plot the spectrum with continuum drawn and the spectrum normalized by the continuum. And than I want to Fit a local continuum using data in the wavelength ranges 1800-1820 and 2020-2040 angstroms.
>
>>
>
>> Does anyone know that how can I do that
>
>
>
> Yes, probably. But, not without a hell of a lot more information. :-)
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Hi David,
ok so here is the information. This is how I am doing :-)
; filename - the filename of the input spectrum
; column - the number of columns in the file
; row - the number of rows in the file
; boxsize - the size of the boxcar for the smoothing function
; dofit - the user keyword
; dofityes - the variable containing the input parameter
data = fltarr(column, row)
; open the file as read only
openr,lun,filename,/get_lun
; read the data from the file into the array
readf,lun,data
; close the file
close,/all
wave=reform(data(0,*))
flux=reform(data(1,*))
; This creates a new array containing the results generate
; by the smooth function.
smoothed_flux = smooth(flux,boxsize)
; check to see if the user would like to fit the continuum
if keyword_set(dofityes) then begin ; this check the dofit keyword
; fit velocity and smoothed_flux, using a 1st order polynomial.
result = poly_fit(wave,smoothed_flux,1)
; generate the continuum with the results from the fit
continuum = result(0) + result(1)*wave
end
But I am not sure that I am doing the continuum normalization to unity in a right way. Because when I make plots the contunum level is higher than the unity.
|
|
|