Plot difference [message #66246] |
Mon, 27 April 2009 12:32  |
Giorgio
Messages: 31 Registered: March 2008
|
Member |
|
|
Hi,
From 10 measurements of a CCD camera with a size of (1293 x 840)
points I calculate the mean and the standard deviation. I get
different plots if I plot just the 2D data or if I rebin to make a 1D
vector.
Let's say that my 2D arrays for the mean is called average and the
standard deviation is standard. Then the results are different if I
do:
plot, average, standard, psym = 4
and
plot, rebin(average, N_Elements(average)), rebin(standard, n_elements
(standard)), psym = 4
Any hint why is that?
Thanks,
Giorgio
|
|
|
Re: Plot difference [message #66342 is a reply to message #66246] |
Thu, 30 April 2009 20:31  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
> (REBIN will work if you set the /SAMPLE keyword, but that really
> isn't the right tool for the job.)
Not quite:
IDL> a = findgen(2,3)
IDL> print, a
0.00000 1.00000
2.00000 3.00000
4.00000 5.00000
IDL> print, reform(a,6)
0.00000 1.00000 2.00000 3.00000 4.00000
5.00000
IDL> print, rebin(a,6)
2.00000 2.33333 2.66667 3.00000 3.00000
3.00000
IDL> print, rebin(a,6,/sample)
0.00000 0.00000 0.00000 1.00000 1.00000
1.00000
Rebin is treating "6" as "6,1"... so it's expanding the first
dimension from 2 to 6, while collapsing the second dimension from 3 to
1.
-Jeremy.
|
|
|
Re: Plot difference [message #66344 is a reply to message #66246] |
Thu, 30 April 2009 18:56  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<14231450-66e4-4a9b-837f-b3335d8be661@y33g2000prg.googlegroups.com>,
Jeremy Bailin <astroconst@gmail.com> wrote:
> On Apr 30, 5:24�pm, Paolo <pgri...@gmail.com> wrote:
>> On Apr 27, 3:32�pm, Giorgio <giorgiol...@gmail.com> wrote:
>>
>>
>>
>>> Hi,
>>> �From 10 measurements of a CCD camera with a size of (1293 x 840)
>>> points I calculate the mean and the standard deviation. I get
>>> different plots if I plot just the 2D data or if I rebin to make a 1D
>>> vector.
>>> Let's say that my 2D arrays for the mean is called average and the
>>> standard deviation is standard. Then the results are different if I
>>> do:
>>
>>> plot, average, standard, psym = 4
>>
>>> and
>>
>>> plot, rebin(average, N_Elements(average)), rebin(standard, n_elements
>>> (standard)), psym = 4
>>
>>> Any hint why is that?
>>
>> I don't understand what the problem is.
>>
>> a=randomn(seed,100000L) & print,total(abs(a-rebin(a,n_elements(a))))
>> shows that a and rebin(a,n_elements(a)) are identical (as they should
>> be).
>>
>> Ciao,
>> Paolo
>>
>>
>>
>>> Thanks,
>>
>>> Giorgio
>>
>>
>
> OP said it's a 2D array...
>
> IDL> seed=43l
> IDL> a = randomn(seed,100l,100l)
> IDL> b = rebin(a,n_elements(a))
> IDL> print, a[0:5]
> -0.908351 -0.440050 -0.200080 -0.260391 0.113894
> -0.456169
> IDL> print, b[0:5]
> -0.204416 -0.201433 -0.198449 -0.195465 -0.192481
> -0.189497
>
> -Jeremy.
It doesn't matter whether the arrays are 2-D or 1-D as far
as PLOT is concerned.
If you really need to make the array 1-D, use REFORM, not REBIN.
(REBIN will work if you set the /SAMPLE keyword, but that really
isn't the right tool for the job.)
Ken Bowman
|
|
|
Re: Plot difference [message #66345 is a reply to message #66246] |
Thu, 30 April 2009 14:54  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Apr 30, 5:24 pm, Paolo <pgri...@gmail.com> wrote:
> On Apr 27, 3:32 pm, Giorgio <giorgiol...@gmail.com> wrote:
>
>
>
>> Hi,
>> From 10 measurements of a CCD camera with a size of (1293 x 840)
>> points I calculate the mean and the standard deviation. I get
>> different plots if I plot just the 2D data or if I rebin to make a 1D
>> vector.
>> Let's say that my 2D arrays for the mean is called average and the
>> standard deviation is standard. Then the results are different if I
>> do:
>
>> plot, average, standard, psym = 4
>
>> and
>
>> plot, rebin(average, N_Elements(average)), rebin(standard, n_elements
>> (standard)), psym = 4
>
>> Any hint why is that?
>
> I don't understand what the problem is.
>
> a=randomn(seed,100000L) & print,total(abs(a-rebin(a,n_elements(a))))
> shows that a and rebin(a,n_elements(a)) are identical (as they should
> be).
>
> Ciao,
> Paolo
>
>
>
>> Thanks,
>
>> Giorgio
>
>
OP said it's a 2D array...
IDL> seed=43l
IDL> a = randomn(seed,100l,100l)
IDL> b = rebin(a,n_elements(a))
IDL> print, a[0:5]
-0.908351 -0.440050 -0.200080 -0.260391 0.113894
-0.456169
IDL> print, b[0:5]
-0.204416 -0.201433 -0.198449 -0.195465 -0.192481
-0.189497
-Jeremy.
|
|
|
Re: Plot difference [message #66347 is a reply to message #66246] |
Thu, 30 April 2009 14:24  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Apr 27, 3:32 pm, Giorgio <giorgiol...@gmail.com> wrote:
> Hi,
> From 10 measurements of a CCD camera with a size of (1293 x 840)
> points I calculate the mean and the standard deviation. I get
> different plots if I plot just the 2D data or if I rebin to make a 1D
> vector.
> Let's say that my 2D arrays for the mean is called average and the
> standard deviation is standard. Then the results are different if I
> do:
>
> plot, average, standard, psym = 4
>
> and
>
> plot, rebin(average, N_Elements(average)), rebin(standard, n_elements
> (standard)), psym = 4
>
> Any hint why is that?
I don't understand what the problem is.
a=randomn(seed,100000L) & print,total(abs(a-rebin(a,n_elements(a))))
shows that a and rebin(a,n_elements(a)) are identical (as they should
be).
Ciao,
Paolo
>
> Thanks,
>
> Giorgio
|
|
|