Skip to content

Commit

Permalink
fix: Allow for "band redshift" suffixes when searching for luminosiy …
Browse files Browse the repository at this point in the history
…data sets

When looking for ionizing continuum datasets, accept data sets with the ":zOut?.????" suffix which is added if a specific output redshift band is specified, providing this band matches the actual output redshift.
  • Loading branch information
abensonca committed Aug 18, 2021
1 parent 311a340 commit 8d39b92
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions perl/Galacticus/IonizingContinuua.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use lib $ENV{'GALACTICUS_ANALYSIS_PERL_PATH'}."/perl";
use PDL;
use XML::Simple;
use Galacticus::HDF5;
use Data::Dumper;

%Galacticus::HDF5::galacticusFunctions = ( %Galacticus::HDF5::galacticusFunctions,
"^(disk|spheroid|total)(Lyman|Helium|Oxygen)ContinuumLuminosity:z[\\d\\.]+\$" => \&Galacticus::IonizingContinuua::Get_Ionizing_Luminosity
Expand Down Expand Up @@ -58,17 +59,33 @@ sub Get_Ionizing_Luminosity {
}
}
# Construct the name of the corresponding luminosity properties.
&Galacticus::HDF5::Get_Datasets_Available($model);
my @luminosityDatasets;
my $luminosityDatasetName;
if ( grep {$_ eq "diskLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain} keys(%{$model->{'dataSetsAvailable'}}) ) {
$luminosityDatasetName->{'disk'} = "diskLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain;
} elsif ( grep {$_ eq "diskLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.":zOut".$redshift.$postprocessingChain} keys(%{$model->{'dataSetsAvailable'}}) ) {
$luminosityDatasetName->{'disk'} = "diskLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.":zOut".$redshift.$postprocessingChain;
}
if ( grep {$_ eq "spheroidLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain} keys(%{$model->{'dataSetsAvailable'}}) ) {
$luminosityDatasetName->{'spheroid'} = "spheroidLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain;
} elsif ( grep {$_ eq "spheroidLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.":zOut".$redshift.$postprocessingChain} keys(%{$model->{'dataSetsAvailable'}}) ) {
$luminosityDatasetName->{'spheroid'} = "spheroidLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.":zOut".$redshift.$postprocessingChain;
}
if ( $component eq "total" ) {
die("luminosity datasets do not exist")
unless ( exists($luminosityDatasetName->{'disk'}) && exists($luminosityDatasetName->{'spheroid'}) );
push(
@luminosityDatasets,
"diskLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain,
"spheroidLuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain
@luminosityDatasets ,
$luminosityDatasetName->{'disk' },
$luminosityDatasetName->{'spheroid'}
);
} else {
die("luminosity datasets do not exist")
unless ( exists($luminosityDatasetName->{$component}) );
push(
@luminosityDatasets,
$component."LuminositiesStellar:".$filterName{$continuumName}.":rest:z".$redshift.$postprocessingChain
@luminosityDatasets ,
$luminosityDatasetName->{$component}
);
}
&Galacticus::HDF5::Get_Dataset($model,\@luminosityDatasets);
Expand Down

0 comments on commit 8d39b92

Please sign in to comment.