[Last Change: 13 Feb 2012 (rev 1)]

# How to raytrace multiple sources

To raytrace multiple sources simply invoke a source extent function for each source.

To raytrace two point sources:
```point{ spectrum = { { 1.49, 0.1 } }}

point{ position = { theta = { 10, 'arcseconds'}}, spectrum = 1.49}
```

You can just as easily mix different types of sources:
```point{ spectrum = { { 1.49, 0.1 } }}

image{
file = 'ds9.fits',
spectrum = 1.49,
position = { theta = { 40, 'arcseconds' } ,
phi = { 45, 'degrees' } },
rotate = 45,
pixsz = { 0.1, 'arcsecond' },
point_idx = { x = 0, y = 0 },
}

point{
position = { theta = { 10, 'arcseconds' },
phi = { 45, 'degree' }
},
spectrum = { { 1.49, .1 } }
}
```

As source descriptions are written in `Lua`, you can use its facilities to simplify things. If you have a list of point sources, you could do something like this:
```sources = {
-- theta, phi, spectrum
{ 0, 0, 1.49},
{ {10, "arcseconds"} , 0, 6.4 },
}

for _, src in pairs(sources) do
point{ position = { theta = src[1], phi = src[2] }, spectrum = src[3] }
end

```

Or, even:
```math = require('math')
for phi = 0, 360, 10 do

local theta = math.sqrt(phi)
disk{
radius = { 0.5, 'arcsecond' },
position = { theta = { theta, 'arcseconds' } ,
phi   = { phi, 'degrees' } },
spectrum = { { 1.49, .1 } }
}

end

```

# CXC Optics

This page is maintained by the CXC Optics Group

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2013. All rights reserved.