Structure altenatives [message #74579] |
Tue, 25 January 2011 07:34  |
sirvival
Messages: 18 Registered: August 2010
|
Junior Member |
|
|
Hi,
I just started to work with structures and so far they are good for
what I want to do.
What I do is I readin fitsimages (119 2146 to 4096 pixel) one at a
time.
I do this in a loop.
Each loop I do something with each row/y value of the images.
I also extract some strings from the header.
Then at the end of the loop I write the results in the created
structure.
When I do plotting later I can do neat things like plot only images
with the same string from the header.
etc.
My code looks something like this:
data = file_search('*.fits',count=numfiles)
starty = 1000
endy = 3700
startx = 50
endx = 2095
yp = endy-starty+1
hwstr = {hwline:dblarr(endx-starx+1,yp)} ; here halfwidth value get
written to
valstr = {name:'name',expo:0.D, angle:0,seeingst:0.D,seeingend:0.D}
imstr = {im:dblarr(endx-startx+1,yp)} ; here all the x values for one
y position get written to later on
hwstr = replicate(hwstr,numfiles)
valstr = replicate(valstr,numfiles)
imstr = replicate(imstr,numfiles)
etc.
The result lets me do something like:
plot, imstr[0].im[*,0]
oplot,hwstr[0].hwline[*,0]
which are from the same image and from the same row/ y value.
If numfiles is like 30 it works but larger values throw an error:
"array has too many elements"
Is the another way to do this without structures?
Thanks
PS: link to example image (not nice looking but I hope shows what I
mean)
http://img406.imageshack.us/img406/6387/testidl.png
|
|
|
Re: Structure altenatives [message #74649 is a reply to message #74579] |
Tue, 25 January 2011 23:36  |
Andrew Cool
Messages: 219 Registered: January 1996
|
Senior Member |
|
|
On Jan 26, 1:34 am, sirvival <fpfei...@hs.uni-hamburg.de> wrote:
> Hi,
> I just started to work with structures and so far they are good for
> what I want to do.
>
> What I do is I readin fitsimages (119 2146 to 4096 pixel) one at a
> time.
> I do this in a loop.
> Each loop I do something with each row/y value of the images.
> I also extract some strings from the header.
>
> Then at the end of the loop I write the results in the created
> structure.
> When I do plotting later I can do neat things like plot only images
> with the same string from the header.
> etc.
>
> My code looks something like this:
>
> data = file_search('*.fits',count=numfiles)
>
> starty = 1000
> endy = 3700
> startx = 50
> endx = 2095
> yp = endy-starty+1
>
> hwstr = {hwline:dblarr(endx-starx+1,yp)} ; here halfwidth value get
> written to
> valstr = {name:'name',expo:0.D, angle:0,seeingst:0.D,seeingend:0.D}
> imstr = {im:dblarr(endx-startx+1,yp)} ; here all the x values for one
> y position get written to later on
> hwstr = replicate(hwstr,numfiles)
> valstr = replicate(valstr,numfiles)
> imstr = replicate(imstr,numfiles)
>
> etc.
>
> The result lets me do something like:
>
> plot, imstr[0].im[*,0]
> oplot,hwstr[0].hwline[*,0]
>
> which are from the same image and from the same row/ y value.
>
> If numfiles is like 30 it works but larger values throw an error:
> "array has too many elements"
>
> Is the another way to do this without structures?
>
> Thanks
>
> PS: link to example image (not nice looking but I hope shows what I
> mean)http://img406.imageshack.us/img406/6387/testidl.png
Sounds vaguely familiar.
I think that the magic number 30 relates to the maximum number of
labels/ticks on the axis
or something like that?
Andrew
|
|
|