comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: continuum normalized spectra
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: continuum normalized spectra [message #82998] Sun, 03 February 2013 06:20 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
idlhelp writes:

> But I am not sure that I am doing the continuum normalization to unity in a right way.

Well, unless this has a specific meaning in your field (astronomy?), I
would take "normalization to unity" to mean divide the result by its
maximum value.

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.")
Re: continuum normalized spectra [message #83000 is a reply to message #82998] Sun, 03 February 2013 00:09 Go to previous messageGo to next message
abc is currently offline  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.
Re: continuum normalized spectra [message #83001 is a reply to message #83000] Sat, 02 February 2013 10:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
Re: continuum normalized spectra [message #83097 is a reply to message #83000] Sun, 03 February 2013 06:22 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: reading/writing large files
Next Topic: reading/writing large files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:10:17 PDT 2025

Total time taken to generate the page: 0.00472 seconds