~abenson/galacticus/v0.9.1_WDM

« back to all changes in this revision

Viewing changes to scripts/plotting/Plot_Disk_Scalelengths.pl

  • Committer: Andrew Benson
  • Date: 2012-01-10 22:41:37 UTC
  • mfrom: (659.1.36 v0.9.1)
  • Revision ID: abenson@its.caltech.edu-20120110224137-038d84wc3lk304fu
* Fixes issue with some pdfmerge implementations which can only accept
  input files in the current working directory (or a subdirectory
  thereof).

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
}
33
33
 
34
34
# Check if output location is file or directory.
 
35
my $outputDir;
35
36
if ( $outputTo =~ m/\.pdf$/ ) {
36
37
    $outputFile = $outputTo;
 
38
    $outputDir = "";
37
39
} else {
38
40
    system("mkdir -p $outputTo");
39
41
    $outputFile = $outputTo."/Disk_Scalelengths.pdf";
 
42
    $outputDir = $outputTo;
40
43
}
41
44
($fileName = $outputFile) =~ s/^.*?([^\/]+.pdf)$/\1/;
42
45
 
64
67
$xml = new XML::Simple;
65
68
$data = $xml->XMLin($galacticusPath."data/Disk_Sizes_Dejong_2000.xml");
66
69
my $i = -1;
 
70
my @leafFiles;
67
71
my @plotFiles;
68
72
foreach $dataSet ( @{$data->{'sizeDistribution'}} ) {
69
73
    $columns = $dataSet->{'columns'};
163
167
    &PrettyPlots::Plot_Datasets($gnuPlot,\$plot);
164
168
    close($gnuPlot);
165
169
    &LaTeX::GnuPlot2PDF($plotFileEPS);
 
170
    (my $leafName = $plotFile) =~ s/^.*\/([^\/]+)$/$1/;
 
171
    push(@leafFiles,$leafName);
166
172
    push(@plotFiles,$plotFile);
167
173
}
168
 
#&SystemRedirect::tofile("rm -f ".$outputFile."; pdfmerge ".join(" ",@plotFiles)." ".$outputFile,"/dev/null");
169
 
system("rm -f ".$outputFile."; pdfmerge ".join(" ",@plotFiles)." ".$outputFile);
 
174
&SystemRedirect::tofile("rm -f ".$outputFile."; cd ".$outputDir."; pdfmerge ".join(" ",@leafFiles)." tmp.pdf; cd -; mv ".$outputDir."/tmp.pdf ".$outputFile,"/dev/null");
170
175
unlink(@plotFiles);
171
176
 
172
177
# Display chi^2 information