Sloan Digital Sky Survey
Client code for Spectra Service
import edu.jhu.pha.skyservice.wave.*;
import edu.jhu.pha.skyservice.*;

public class SpecList {


   public static void main( String[] args)  throws Exception{

// Proxy class and the URL of the service
WaveLocator wl = new WaveLocator();
System.out.println(wl.getWaveSoapAddress());
WaveSoap p = wl.getWaveSoap();

// Retrieve a spectrum by its ID
Spectrum s = p.getSpectrum(200000,true);
System.out.println(s.getName());
for (int i=0; i<10; i++) 
   System.out.println
      ("\t"+s.getPoints().getPoint()[i].getWavelength()+" "+s.getPoints().getPoint()[i].getValue());

// Same in VOTable format
VOTABLE v = p.getSpectrumVoTable(200000,false);
System.out.print(v.getDESCRIPTION()+": ");
System.out.println(v.getRESOURCE()[0].getTABLE()[0].getDATA().getTABLEDATA().getTR()[0].getTD()[1].getValue());

// System.out returns spectra in a virtual observational field
ArrayOfSpectrum aos = p.findSpectraCone(180,0,5,false); 
Spectrum[] sa = aos.getSpectrum(); 
System.out.println("# of objects found: "+sa.length);
Spectrum c = null;
for( int si =0; si < sa.length; si++ ){
   c=sa[si];
   System.out.println("\t"+c.getRa()+"\t"+c.getDec());
}
			
// High redshift search yields QSOs
Spectrum[] qa = p.findSpectraRedshift(5,10,false).getSpectrum();
System.out.println("Z>5 (qso)");
Spectrum q = null;
for( int si =0; si < qa.length; si++ ) {
   q=sa[si];
   System.out.println("\t"+q.getName()+"\t"+q.getZ());
}
			
// Derive QSO composite by calling another web method
ArrayOfFloat limStart = new ArrayOfFloat();
limStart.set_float(new float[]{1430});
ArrayOfFloat limEnd = new ArrayOfFloat();
limStart.set_float(new float[]{1480});
s = p.composeAverageSpectrum(aos, SpectrumWavelengthScale.Linear,1000,
	     limStart,limEnd,1.4f,1e-4f);
System.out.println(s.getName());
for (int i=0; i1200 && s.getPoints().getPoint()[i].getWavelength()<1230)
      System.out.println
         ("\t"+s.getPoints().getPoint()[i].getWavelength()+" "+s.getPoints().getPoint()[i].getValue());

   }

}


Tamas Budavari
Last Modified :Wednesday, October 1, 2003 at 10:41:33 AM , $Revision 1.1 $