Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106273640
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
Mon, Mar 24, 07:42
Size
830 B
Mime Type
text/x-perl
Expires
Wed, Mar 26, 07:42 (2 d)
Engine
blob
Format
Raw Data
Handle
25113864
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