#!/usr/bin/perl # # usage: perl dat2pv.pl infile outfile [onceeverythismanyframes] # # Written by Dinoj Surendran (dinoj@cs.uchicago.edu) Sep/Oct 2004. # (Modified by DS Jan 2005) # to process data by Jessica Lu and Andrea Ghez for Randy Landsberg # and Mark SubbaRao # See http://astro.uchicago.edu/cosmus/projects/starsaroundblackhole/ $infile = $ARGV[0]; $outfile = $ARGV[1]; $TIMEBIN = 1; # use one every 'this many' frames if ($#ARGV >= 2) { $TIMEBIN = $ARGV[2]; } $SIZEFACTOR = 100; # though it looks changeable, dont change this open (IN,"$infile"); open (STARSDAT,">".$outfile."_stars.dat"); open (STARS,">".$outfile."_stars.speck"); open (ORBITS,">".$outfile."_orbits.speck"); open (ORBITSCMAP,">".$outfile."_orbits.cmap"); open (TICKER,">".$outfile."_ticker.speck"); open (CF,">".$outfile.".cf"); print ORBITSCMAP "1\n.5 .5 .1\n"; # color of orbits close(ORBITSCMAP); printf CF " filepath +:.:./data object g1=cosmus texturevar 0 texture -O 1 cosmuslogosquareup.sgi tfm camera -4 -3 -20 0 0 0 6.5 -0.2 0 text -size .9 astro.uchicago.edu/cosmus 0.1 -0.4 0 1 # places logo in the bottom left eval lsize 0.17 eval laxes 0 eval lum const 1 eval slum 1 eval lum const 1 eval poly on eval polysides 4 eval polysize 0.04 eval textures on eval color rgb 1 1 1 eval alpha 1 object g2=WHO tfm camera -4.3 -3.3 -20 0 0 0 0 .6 0 text -size 1 Data: Andrea Ghez, Jessica Lu (UCLA) 0 .4 0 text -size 1 Visualization: Dinoj Surendran, Randy Landsberg, 1.05 .2 0 text -size 1 Mark SubbaRao (UChicago / Adler / KICP) eval lsize 0.17 eval laxes 0 eval slum 1 eval lum const 1 eval color rgb 1 1 1 eval off object g3=WHAT tfm camera 1.6 2.5 -20 0 0 0 0.05 .6 0 text -size 1 The Acceleration of Stars Orbiting 0.05 .4 0 text -size 1 the Milky Way's Central Black Hole 0 .2 0 text -size 1 (Ghez et al, Nature 407:349, 2000) eval lsize 0.17 eval laxes 0 eval lum const 1 eval slum 1 object g4=stars include %s_stars.speck eval psize 200 eval ptsize 1 100 eval slum 2e5 eval lum siz eval color rgb 1 1 1 eval speed %0.3f eval textures on eval polysides 4 eval polymin 1e-4 1e3 eval polysize 0.0002 eval poly on eval points off eval alpha 0.99 eval lsize 100 eval laxes 0 eval labels off object g5=orbits include %s_orbits.speck eval slum 0 eval cmap %s_orbits.cmap object g6=box box -%0.3f,%0.3f -%0.3f,%0.3f -%0.3f,%0.3f eval boxcment 0 .4 .4 .4 object g7=ticker include %s_ticker.speck tfm camera -4.2 3 -20 0 0 0 eval lsize .3 eval laxes 0 eval lum const 1 eval slum 1 eval color rgb 1 1 1 eval alpha 1 eval censize %0.3f eval clip 0.1 1e6 eval jump -1689.93 -487.754 -45.6781 16.0939 -91.5483 -16.1271 1 eval focalpoint on eval detach full eval stereo off # change to -0.002 crosseyed for geowalls eval detach full ", $outfile, 1000/$TIMEBIN, $outfile,$outfile, $SIZEFACTOR, $SIZEFACTOR, $SIZEFACTOR, $SIZEFACTOR, $SIZEFACTOR, $SIZEFACTOR, $outfile, $SIZEFACTOR/10 ; my @flux; my @magnitudes = (14.7, 13.9, 14.2, 14.5, 15.2, 14.1, 15.9, 15.3, 15.8, 15.6, 15.5, 16.6, 15.1); for ($m=0; $m<=$#magnitudes; $m++) { $flux[$m] = 10**($magnitudes[$m]/-7); # print $m, " ", $magnitudes[$m], " ", $flux[$m], "\n"; } print STARS "datavar 0 size\n"; print STARS "datavar 1 pic\n"; print STARS "datavar 2 color\n"; print STARS "texturevar pic\n"; print STARS "texture -M 1 halo.sgi\n"; $count = 0; $DOPRINT = 1; $ISFIRST = 1; my %firstpositions; my %lastpositions; $OUTOFRANGE = 0; while ($line = ) { next if (length($line)<2); @tmp = split /[\t\n\r ]+/, $line; if ($#tmp == 1) { if (0 == $time) { $ISFIRST = 1; } else { $ISFIRST = 0; } $date = $tmp[0]; $time = $tmp[1]; if (0 == $time % $TIMEBIN) { printf STARS "\ndatatime %d # %0.4f\n", $time/$TIMEBIN, $date; printf STARS "\n0 0 0 text %0.4f\n", $date; printf TICKER "\ndatatime %d # %0.4f\n", $time/$TIMEBIN, $date; printf TICKER "\n0 0 0 text Year: %0.1f\n", $date; $DOPRINT = 1; } else { $DOPRINT = 0; } $count = 0; } else { if (1 == $DOPRINT) { $size = $flux[$count]*1000; $count = $count + 1; if ($#tmp == 2) { ($x,$y,$z) = @tmp; } elsif ($#tmp == 3) { ($space,$x,$y,$z) = @tmp; } if ($x =~ m/\*/) { $OUTOFRANGE = 1; # print "[$x] [$y] [$z]\n"; } else { $OUTOFRANGE=0; } $x = $x*$SIZEFACTOR; $y = $y*$SIZEFACTOR; $z = $z*$SIZEFACTOR; if (1 == $ISFIRST) { $firstpositions{$count} = [$x,$y,$z]; } elsif (0 >= $OUTOFRANGE) { $dist = sqrt(($lastpositions{$count}[0]-$x)**2 + ($lastpositions{$count}[1]-$y)**2 + ($lastpositions{$count}[2]-$z)**2); if ($dist < 1000) { printf ORBITS "mesh -c 1 -s wire {\n 1 2\n"; printf ORBITS "%0.3f %0.3f %0.3f \n",$lastpositions{$count}[0], $lastpositions{$count}[1], $lastpositions{$count}[2] ; printf ORBITS "%0.3f %0.3f %0.3f \n",$x, $y, $z; printf ORBITS "}\n"; } } if (0 >= $OUTOFRANGE) { printf STARS "%0.3f %0.3f %0.3f %0.2f 1 1\n", $x, $y, $z, $size; printf STARSDAT "%0.3f %0.3f %0.3f %0.2f 1 1\n", $x, $y, $z, $size; } $lastpositions{$count}[0] = $x; $lastpositions{$count}[1] = $y; $lastpositions{$count}[2] = $z; } } } if (0) { for ($count = 0; $count <= $#flux; $count++) { printf ORBITS "mesh -c 1 -s wire {\n 1 2\n"; printf ORBITS "%0.3f %0.3f %0.3f \n",$lastpositions{$count}[0], $lastpositions{$count}[1], $lastpositions{$count}[2] ; printf ORBITS "%0.3f %0.3f %0.3f \n",$firstpositions{$count}[0], $firstpositions{$count}[1], $firstpositions{$count}[2] ; printf ORBITS "}\n"; } } close (CF); close (STARS); close (ORBITS);