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 #77240 is a reply to message #77160] Mon, 15 August 2011 01:17 Go to previous messageGo to previous message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
On Aug 14, 3: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!!!

NE means Not Equal

So,
mask = array NE x
makes a new array of the same size as array, but with 1 where array is
not equal x and with zero in the opposite case. In place of array you
put the array you wish to average.

If you're going to use IDL extensively, I strongly recommend you to
read the part of the manual on arrays.
[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: Fri Oct 10 15:13:11 PDT 2025

Total time taken to generate the page: 0.08189 seconds