# How Quasars were processed in the Sloan Galaxy Flythrough exhibit

This is quite similar to, though far simpler than, the way galaxies were processed. So we won't repeat stuff already said there.

### Getting quasar positions from the SDSS

These were got from the SDSS servers using the SQL command :

```select all s.ra,s.dec,round(s.z,7),p.petroRad_r,p.petroMag_r
from specObj s join photoObj p on s.bestObjID=p.objID
where (specClass=3 or specClass=4)
```

We obtained this in HTML format, saved it as a plain text file "sloanquasars.dat" and stripped initial headers so Matlab could read it. There is no corresponding value like eClass to distinguish between types of quasars, so the samme picture was used for all of them.

### Using Matlab to get a Partiview SPECK matrix

Open Matlab, and make sure the .m files above are in your path (with an addpath command or using the GUI). Then type

```  Q = load ('sloanquasars.dat');
petmag = Q(:,5);
ok = find(petmag > -9999);
Q = Q(ok,:);
petmag = M(:,5);
dist = M(:,6);
z = M(:,7);
al = -0.5;
kcorr = -2.5 * (1+al) * log (1+z) / log(10);
lumdist = (1+z) .* dist;
absmag = petmag - 5*log(lumdist)/log(10) - kcorr - 25;
lumin = 100.^(-0.2 * absmag);
M(:,8) = ones( size(M,1), 1);
M(:,4) = -absmag;
M(:,5) = lumin;
save sloanquasars.speck M -ascii
```

See the instructions for galaxies for details of the luminosity calculation.

This command results in a G x 8 matrix representing G quasars with for each quasar

1. x position (comoving coordinates)
2. y position
3. z position (z doesnt refer to redshift here, but it will soon...)
4. Absolute magnitude
5. luminosity
6. distance from origin (megaparsecs)
7. redshift
8. pictype (always equal to 1)

### Creating usable Partiview files

So now you have a text file sloanquasars.speck that has all the galaxy positions, picture types (labels), and orientations. This is almost Partiview speck file format, but you need some headers. Open sloangalaxies.speck in a text editor and place the following lines at the start of it.

```      datavar 0 mag
datavar 1 lumin
datavar 2 dist
datavar 3 redshift
datavar 4 pictype
texturevar pictype
texture -a 1 halo.sgi
```

You should also create a CF file, say sloan.cf, with the following parameters. You can change the parameters - read the Teuben-Levy Partiview manual for some documentation on what parameters mean. Or guess and tinker and guess and tinker...

The following was then added to the CF file used for the Sloan galaxies:

```   filepath +:.

object g11=quasars
include sloanquasars.speck
eval psize 1000
eval ptsize  2 10
eval lum mag 0.4 10
eval polylum mag 0.4 10
eval slum 1
eval polysize 10
eval polysides 4
eval polymin 0.1 20
eval alpha 0.99
eval color exact 1 0.5 0.5
eval points off
eval poly on
eval label off
```