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

Home » Public Forums » archive » Avoiding Loops in IDL 8.2.2
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: Avoiding Loops in IDL 8.2.2 [message #85017 is a reply to message #85013] Sun, 23 June 2013 15:24 Go to previous messageGo to previous message
Nate Tellis is currently offline  Nate Tellis
Messages: 2
Registered: June 2013
Junior Member
On Friday, 21 June 2013 17:04:31 UTC-7, Nate Tellis wrote:
> Hi all,
>
>
>
> I have a series of 711x4096x3 arrays. I am searching for good fits to a model, which is an 11x19 array, using a reduced chi-square fit. As it is now, I step across, pixel by pixel, column by column, pane by pane, and perform the fit to a subimage centred at the loop indices (normalized to the value of the central pixel). The fit is simple element-wise subtraction and squaring of the sub images, followed by one call to 'total' on the sub-image:
>
>
>
> Chi^2_red = 1/Npixels * Sum over each pixel((image - fit)^2/error^2)
>
>
>
> (This is of course fast, as the -, ^2, /, and 'total' operations utilize the IDL thread pool)
>
>
>
> I know I can speed this up by using operations that leverage multithreading. How can I go about avoiding these hated nested for loops? Performing the fits on all ~8,500,000 subimages without multithreading takes way too long - about 90 seconds on average.
>
>
>
> Thank you for the help,
>
> Nate

Here's a simpler question. I think I can solve my problem if I can do this efficiently:

Say I have an array like:

A =

1 2 3 4
5 6 7 8

where A is 4 by 2

How can I use reform and rebin to get an array of dimension 2 by 2 by 2 that looks like

1 2
5 6

3 4
7 8

Any help is much appreciated.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: scattering data with MPFITFUN
Next Topic: how to manipulate data that are stored in memory directly?

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

Current Time: Wed Oct 08 17:28:18 PDT 2025

Total time taken to generate the page: 0.00470 seconds