Re: how to preserve trailing Shallow dimensions! [message #61933] |
Thu, 14 August 2008 06:39  |
vino
Messages: 36 Registered: March 2008
|
Member |
|
|
Hi!
Thank you very much for the reply. As you said, my problem is with the
size function. I am doing stellar photometry. I store star position
in an array and most of the time, i am tracking more than 1 star but
the problem arose when i had only star in my image. But i think the
problem might be solved if i follow your example...
Thanks again,
Vino
On Aug 14, 2:28 pm, Vince Hradil <hrad...@yahoo.com> wrote:
> On Aug 14, 6:33 am, vino <astrocr...@gmail.com> wrote:
>
>> Hello Everyone,
>> I was wondering whether there is any way i can preserve a trailing
>> shallow dimension in array?
>
>> eg:
>> IDL> ab=make_array(2,1,1)
>> IDL> print,size(ab,/dimensions)
>> 2
>> How can i make it preserve it as 2 1 1?
>
>> Thanks and regards,
>> Vino
>
> Perhaps you should tell us why... The answer may be different than
> you expect...
>
> So, anyways, the trailing dims are "still there" as 1's:
>
> IDL> f = findgen(3,1,1)
> IDL> help, f
> F FLOAT = Array[3]
> IDL> help, f[*,0]
> <Expression> FLOAT = Array[3]
> IDL> help, f[*,0,0]
> <Expression> FLOAT = Array[3]
> IDL> print, f
> 0.000000 1.00000 2.00000
> IDL> print, f[*,*]
> 0.000000 1.00000 2.00000
> IDL> print, f[*,0]
> 0.000000 1.00000 2.00000
> IDL> print, f[*,0,0]
> 0.000000 1.00000 2.00000
> IDL> print, f[*,*,*]
> 0.000000 1.00000 2.00000
>
> If you are worried about the SIZE function:
> IDL> fsize = size(f,/dimensions)
> IDL> nx = fsize[0]
> IDL> if n_elements(fsize) gt 1 then ny = fsize[1] else ny = 1L
> IDL> if n_elements(fsize) gt 2 then nz = fsize[2] else nz = 1L
> etc...
|
|
|