Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102428793
rescaleBayes.pl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Feb 20, 15:28
Size
830 B
Mime Type
text/x-perl
Expires
Sat, Feb 22, 15:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24354985
Attached To
R1448 Lenstool-HPC
rescaleBayes.pl
View Options
#!/usr/bin/perl
# Rescale the bayes.dat file
sub rescaleBayes
{
my ($file,$scale) = @_;
my @fld, @col, $line;
open(IN, $file);
open(OUT, '>', "bayes_rescaled.dat");
# Analyse which column as to be rescaled and rescale it
$line = 0;
while(<IN>)
{
chop;
@fld = split;
if( $_ =~ /#/ )
{
if( $_ =~ / rc/ || $_ =~ / Re/ ||
$_ =~ / rvir/ || $_ =~ / rs/ )
{
push @col, $line;
$fld[3] = "(kpc)" if( $fld[3] eq "(arcsec)" );
$fld[2] = "(kpc)" if( $fld[2] eq "(arcsec)" );
} elsif( $_ =~ /theta/ )
{
push @th, $line;
$fld[2] = "PA";
}
}
else
{
for( $i = 0; $i < @col; $i++ )
{
$fld[$col[$i]] *= $scale;
}
for( $i = 0; $i < @th; $i++ )
{
$fld[$th[$i]] += 90;
}
}
printf OUT "%s\n", join( " ", @fld);
$line++;
}
close(IN);
close(OUT);
}
Event Timeline
Log In to Comment