MIKE Template Spectra Library

Part of the Cluster AgeS Experiment

Error: Cannot get list of stars from database!
 "); print ("
\n"); print ("

Select stars from list

\n"); print ("
\n"); $all_stars = !isset($_POST["all_stars"])? NULL: $_POST["all_stars"]; print("Select all stars\n"); print ("

MIKE
channels

>any 
>red 
>blue

Wavelength
 range [Å] 

Min:  
Max: 
By default the spectrum will fit within this range.
If you want the spectrum to include this range, select here: >

Teff [K]
 

Min:  
Max: 

(B–V)
  

Min:  
Max: 

Metallicity
[Fe/H] 

Min:  
Max: 
>include stars without Teff / (B–V) / metallicity data
'; // print_r($_POST); // print_r($all_star_array); // echo ''; if (isset($_POST['submit'])) { $stars = $_POST["stars"]; $channel = $_POST["channel"]; $wav_min = $_POST["wav_min"]; $wav_max = $_POST["wav_max"]; $t_min = $_POST["t_min"]; $t_max = $_POST["t_max"]; $bv_min = $_POST["bv_min"]; $bv_max = $_POST["bv_max"]; $feh_min = $_POST["feh_min"]; $feh_max = $_POST["feh_max"]; $show_all = $_POST["show_all"]; $all_stars = $_POST["all_stars"]; $wav_incl = $_POST["wav_incl"]; if (!$wav_min || !ctype_digit($wav_min)) { print ("
Error in input wavelength, using ".$wmn[0]."Å.
 
\n"); $wav_min = $wmn[0]; } if (!$wav_max || !ctype_digit($wav_max)) { print ("
Error in input wavelength, using ".$wmx[0]."Å.
 
\n"); $wav_max = $wmx[0]; } if (!$t_min || !ctype_digit($t_min)) { print ("
Error in input temperature, using ".$tmn[0]."K.
 
\n"); $t_min = $tmn[0]; } if (!$t_max || !ctype_digit($t_max)) { print ("
Error in input temperature, using ".$tmx[0]."K.
 
\n"); $t_max = $tmx[0]; } if (!$bv_min) { $bv_min = $bmn[0]; } if (!$bv_max) { $bv_max = $bmx[0]; } if (!$feh_min) { $feh_min = $fmn[0]; } if (!$feh_max) { $feh_max = $fmx[0]; } if ($show_all == "on") { $cs = "coalesce("; $cdt = ",".$t_min.")"; $cdb = ",".$bv_min.")"; $cdf = ",".$feh_min.")"; } else { $cs = ""; $cdt = ""; $cdb = ""; $cdf = ""; } if ($wav_incl == "on") { $wav_query = "( lambda_min <= ".$wav_min." && lambda_max >= ".$wav_max." )"; } else { $wav_query = "( lambda_min >= ".$wav_min." && lambda_max <= ".$wav_max." )"; } if ($all_stars == "on") { $stars=array_diff($all_star_array,array()); } if (is_array($stars)) { $nstars = sizeof($stars); if ($nstars > 0) { print ("
\n"); print ("\n"); print ("\n"); $output_counter = 0; for ($i=0; $i<$nstars; $i++) { $query1 = "select lambda_min,lambda_max,hrv,date_obs,time_obs,filename,filename_multi,channel from template_spectra left join template_stars on template_spectra.star = template_stars.star where template_spectra.star='".$stars[$i]."' && channel like '".$channel."' && ".$wav_query." && ".$cs."T_eff".$cdt." between ".$t_min." and ".$t_max." && ".$cs."bv_index".$cdb." between ".$bv_min."-0.001 and ".$bv_max."+0.001 && ".$cs."metallicity".$cdf." between ".$feh_min."-0.001 and ".$feh_max."+0.001"; // print($query1."\n"); $query2 = "select star,v_mag,bv_index,vi_index,T_eff,spec_type_code,spec_class_code,additional_notes,e_bv,metallicity,rv,rv_error,rv_ads_ref from template_stars where star='".$stars[$i]."'"; include('connect.php'); $result1 = mysql_query ($query1) or die ("
Error: Cannot get spectrum information from spectra database!
 
\n"); $result2 = mysql_query ($query2) or die ("
Error: Cannot get star information from stars database!
 
\n"); $line2 = mysql_fetch_array($result2); $spec_type=spectype($line2[spec_type_code]); $spec_class=specclass($line2[spec_class_code]); mysql_close($link); if ($line1 = mysql_fetch_array($result1)) { do { if ($line2[rv_error]) { $errstr=" ± ".$line2[rv_error]; } else { $errstr=""; } print ("\n"); print ("\n"); print ("\n"); $normfile = file_exists("data/".$line1[filename]) ? "".$line1[channel]."":" "; $multifile = file_exists("data/".$line1[filename_multi]) ? "".$line1[channel]."
(multispec)
":" "; print ("\n"); $output_counter++; } while($line1 = mysql_fetch_array($result1)); } } if ($output_counter == 0) { print ("\n"); } print ("
 Star 
(SIMBAD link)
DataDate
 Time 
Range
 [Å] 
IRAF
Heliocentric
Rv [km/s]
Available spectra
 (link to FITS file) 
Rv [km/s]
(link to literature)
 V 
 
 B–V 
 
 V–I 
 
Teff
 
 Type 
 
 E(B–V) 
 
 [Fe/H] 
 
".$stars[$i]."".$line2[rv].$errstr."".$line2[v_mag]."".$line2[bv_index]."".$line2[vi_index]."".$line2[T_eff]."".$spec_type.$spec_class." ".$line2[additional_notes]."".$line2[e_bv]."".$line2[metallicity]."".$line1[date_obs]."
".$line1[time_obs]."
".$line1[lambda_min]."
".$line1[lambda_max]."
".$line1[hrv]."".$normfile."".$multifile."

No spectra found matching these criteria.
 
\n"); } } else { print ("
No stars selected.
 
\n"); } } ?>