Re: continuum normalized spectra [message #83096 is a reply to message #83002] |
Sun, 03 February 2013 06:33  |
abc
Messages: 46 Registered: March 2011
|
Member |
|
|
On Sunday, February 3, 2013 3:22:54 PM UTC+1, Mats Löfdahl wrote:
> Den söndagen den 3:e februari 2013 kl. 09:09:20 UTC+1 skrev idlhelp:
>
>> 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.
>
>
>
> As far as I can see, you don't do any normalization at all. You calculate the fit, but you never operate on the original (or smoothed) spectrum with that fit. I guess you need to divide the spectrum with the fit.
Ahh I forgot, I am dividing the spectrum by the continuum like that
but still the continuum is far from unity
; for continuum normalization
smoothed_flux = smoothed_flux/continuum
|
|
|