Re: bad column in image [message #66703] |
Wed, 03 June 2009 09:48  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
Amanda wrote:
> I was just using the where function, like this: arr(where(arr[1440,*]
> GT 1000))=mean(arr) but I don't know if that's how I should be doing
> it.
>
> Amanda
Amanda, pay close attention to the meaning of the index returned by the
where function. In this call, you will have the index where the value is
gt 1000 in your column of interest. arr[1440,*] is a 1D array. Then,
with these index, you are applying them to arr, which is a 2D array.
Therefore, you end up writing the mean value to the first LINE of your
array...
Jean
|
|
|
Re: bad column in image [message #66706 is a reply to message #66703] |
Wed, 03 June 2009 09:11   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Amanda writes:
> I was just using the where function, like this: arr(where(arr[1440,*]
> GT 1000))=3Dmean(arr) but I don't know if that's how I should be doing
> it.
No, that's not the way you should be doing it. :-)
I would do it like this:
badcol = arr[1440,*]
indices = Where(badcol GT 1000, count)
IF count GT 0 THEN badcol[indices] = Mean(arr)
arr[1440,*] = badcol
Using the mean of the array is sketchy. Perhaps some
kind of interpolation method would be better:
http://www.dfanning.com/math_tips/easyinterp.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: bad column in image [message #66707 is a reply to message #66706] |
Wed, 03 June 2009 09:03   |
Amanda
Messages: 12 Registered: August 2006
|
Junior Member |
|
|
I was just using the where function, like this: arr(where(arr[1440,*]
GT 1000))=mean(arr) but I don't know if that's how I should be doing
it.
Amanda
On Jun 3, 3:08 am, David Fanning <n...@dfanning.com> wrote:
> Amanda writes:
>> I'm trying to get a bad column out of an image by selecting the column
>> and then setting all values equal to the mean of the image (probably
>> not the best way to go about it, but I'm not very good at this). But
>> I'm having trouble selecting the column. No matter what row or column
>> number I put in, i.e. array=[1440,*], and then set those values to the
>> mean, it will only change the row on the top of the image. I'm
>> probably missing something very simple or doing something very stupid.
>
> You're probably right. But it's very difficult to tell
> unless we see a few clues. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: bad column in image [message #66816 is a reply to message #66706] |
Fri, 05 June 2009 12:22  |
Amanda
Messages: 12 Registered: August 2006
|
Junior Member |
|
|
Ok, the interpolation sounds like a much better idea, but is
"interpol" only for vectors? I tried using it with mine and only got a
synthax error. I know there's also an "interpolation" function, but I
have no idea how to use it.
Amanda
On Jun 3, 5:11 pm, David Fanning <n...@dfanning.com> wrote:
> Amanda writes:
>> I was just using the where function, like this: arr(where(arr[1440,*]
>> GT 1000))=3Dmean(arr) but I don't know if that's how I should be doing
>> it.
>
> No, that's not the way you should be doing it. :-)
>
> I would do it like this:
>
> badcol = arr[1440,*]
> indices = Where(badcol GT 1000, count)
> IF count GT 0 THEN badcol[indices] = Mean(arr)
> arr[1440,*] = badcol
>
> Using the mean of the array is sketchy. Perhaps some
> kind of interpolation method would be better:
>
> http://www.dfanning.com/math_tips/easyinterp.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|