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

Home » Public Forums » archive » difficulty using "linterp" command - need help making loop to exclude a value yet average others
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: difficulty using "linterp" command - need help making loop to exclude a value yet average others [message #77244 is a reply to message #77160] Sun, 14 August 2011 13:26 Go to previous messageGo to previous message
Emily Anne Moravec is currently offline  Emily Anne Moravec
Messages: 7
Registered: June 2011
Junior Member
On Aug 14, 2:47 pm, Emily Anne Moravec <mora...@stolaf.edu> wrote:
> On Aug 14, 3:49 am, Nikola <nikola.vi...@gmail.com> wrote:
>
>
>
>
>
>> It seems like you haven't defined wgrid in the procedure
>> interpolatedsixteen.pro.
>
>> linterp is not a standard idl function. Why not use interpol instead
>> (for the difference see the header of linterp.pro)?
>
>>> Also, in each of our 8 data sets, there is an increment of wavelength
>>> values where the value of the flux is 0, which will make the average
>>> of all 8 messed up.  Do you have any ideas how to write a loop that
>>> goes through all of the wgrid values and averages the values of the
>>> interpolated flux values, but skips the flux values that are 0 and
>>> continues to the next? Is there a skip command? Would a where command
>>> work the best?
>
>> If you need to find mean of an array excluding elements equal to some
>> variable x (in your case x = 0) you don't need a loop. Just do
>
>> mask = array NE x
>> y = TOTAL(array*mask)/TOTAL(mask)
>
> So the mask = array NE x will exclude the x value?
> What do I put in place of array? One value or all of the values 16
> values I am averaging? Is NE the command for excluding something?
> Thank you for you time!!!

Also, I just looked at linterp and interpol and it seems linterp is
exactly what we want to do. I really also don't see the difference
between them.
To linearly interpolate from a spectrum wavelength-flux pair
; WAVE, FLUX to another wavelength grid defined as:
; WGRID = [1540., 1541., 1542., 1543., 1544, 1545.]
;
; IDL> LINTERP, WAVE, FLUX, WGRID, FGRID
;
; FGRID will be a 6 element vector containing the values of
FLUX
; linearly interpolated onto the WGRID wavelength scale
This is exactly what we want to do…...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: creating a 2D mask for image filtering
Next Topic: Book Business Realities

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

Current Time: Wed Oct 08 15:48:33 PDT 2025

Total time taken to generate the page: 0.00418 seconds