Re: 3-dimensional integration? [IDL 5.4] [message #35521] |
Wed, 25 June 2003 01:08 |
Timm Weitkamp
Messages: 66 Registered: August 2002
|
Member |
|
|
On 24.06.03 at 16:18, Ingo Salzmann wrote:
> [...] TRIGRID the data and then follow your hint. But ... what is the
> relationship between the old irregularely spaced points described by their
> (x,y,int) tuples and the new points within the (n,n,int) array? Are these
> coordinates normalized?
I'm not quite sure what you mean by normalized coordinates here, but you
can obtain the coordinates of the (n,n,int) output array of TRIGRID with
the XGRID and YGRID keywords. Mind you, it's been a long time since I last
used TRIGRID myself. I'm just taking this from the online help.
Cheers,
Timm
--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
|
|
|
Re: 3-dimensional integration? [IDL 5.4] [message #35533 is a reply to message #35521] |
Tue, 24 June 2003 07:18  |
Ingo Salzmann
Messages: 10 Registered: December 2002
|
Junior Member |
|
|
Thanx! Unfortunately I forgot to mention, that my data points are
irregularely spaced. I would choose the approach to Triangulate [...]
TRIGRID [...] the data and then follow your hint. But ... what is the
relationship between the old irregularely spaced points described by their
(x,y,int) tuples and the new points within the (n,n,int) array? Are these
coordinates normalized?
Thank you!
"Timm Weitkamp" <timm.weitkamp@nowhere.edu> schrieb im Newsbeitrag
news:Pine.LNX.4.44.0306231600060.1635-100000@localhost.local domain...
> Oops! When I just wrote,
>
>> Circular regions take more than one line, but are easily doable too.
>> Assume that r is the radius of the circle over which you want to
>> integrate (in pixels). Then you should do something like this:
>>
>> dim = SIZE(data, /DIMENSIONS)
>> xarr = findgen(dim[0]) # (1+fltarr(dim[1]))
>> yarr = findgen(dim[1]) ## (1+fltarr(dim[0]))
>> rarr = SQRT((xarr-x)^2 + (yarr-y)^2)
>> idxList = WHERE(rarr LE r, npix)
>> IF npix NE 0 THEN tot = TOTAL(data[idxList])
>
> ... I hit the "send" key too early. The code above works, but its last two
> lines can (and should) be merged into the more elegant
>
> tot = TOTAL( (rarr LE r) * data )
>
> I think this way of directly using a logical expression for indexing,
> which in many cases I find very handy, is sometimes ignored by the
> worshipers of WHERE.
>
> Timm
>
> --
> Timm Weitkamp <http://people.web.psi.ch/weitkamp>
>
|
|
|
Re: 3-dimensional integration? [IDL 5.4] [message #35545 is a reply to message #35533] |
Mon, 23 June 2003 07:04  |
Timm Weitkamp
Messages: 66 Registered: August 2002
|
Member |
|
|
Oops! When I just wrote,
> Circular regions take more than one line, but are easily doable too.
> Assume that r is the radius of the circle over which you want to
> integrate (in pixels). Then you should do something like this:
>
> dim = SIZE(data, /DIMENSIONS)
> xarr = findgen(dim[0]) # (1+fltarr(dim[1]))
> yarr = findgen(dim[1]) ## (1+fltarr(dim[0]))
> rarr = SQRT((xarr-x)^2 + (yarr-y)^2)
> idxList = WHERE(rarr LE r, npix)
> IF npix NE 0 THEN tot = TOTAL(data[idxList])
... I hit the "send" key too early. The code above works, but its last two
lines can (and should) be merged into the more elegant
tot = TOTAL( (rarr LE r) * data )
I think this way of directly using a logical expression for indexing,
which in many cases I find very handy, is sometimes ignored by the
worshipers of WHERE.
Timm
--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
|
|
|
Re: 3-dimensional integration? [IDL 5.4] [message #35546 is a reply to message #35545] |
Mon, 23 June 2003 06:36  |
Timm Weitkamp
Messages: 66 Registered: August 2002
|
Member |
|
|
Hi Ingo,
Today at 12:37, you wrote:
> I am dealing with 3-dimensional experimental data of x-ray diffraction pole
> figures. I read-in the data, graphical representation (x,y,int) and analysis
> works fine with SURFACE... Now I would very much like to get the volume of
> certain regions of my figure, i.e. circles or squares around a certain point
> (x,y) in order to be able to compare the total intensities of peaks
> belonging together. Could anybody give me a hint with which approach I could
> solve that? Is MESH_VOLUME a senseful idea?
I don't know if this is what you're looking for, but to integrate your
data over a square of (2n+1)^2 pixels around the pixel with the indices
[x,y], just do
tot = TOTAL(data[x-n:x+n, y-n:y+n])
Circular regions take more than one line, but are easily doable too.
Assume that r is the radius of the circle over which you want to
integrate (in pixels). Then you should do something like this:
dim = SIZE(data, /DIMENSIONS) ; Find out size of data array
; Get x and y coordinate for each pixel
xarr = findgen(dim[0]) # (1+fltarr(dim[1]))
yarr = findgen(dim[1]) ## (1+fltarr(dim[0]))
; Get radial coordinate around (x,y) for each pixel
rarr = SQRT((xarr-x)^2 + (yarr-y)^2)
; Find out which pixels are inside a circle r around (x,y)
idxList = WHERE(rarr LE r, npix)
; Integrate over those pixels
IF npix NE 0 THEN tot = TOTAL(data[idxList])
Hope this helps,
Timm
--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
|
|
|