Skip to content

Commit

Permalink
feat: Store the Cloudy model number into the table
Browse files Browse the repository at this point in the history
Useful for identifying problematic or failed models.
  • Loading branch information
abensonca committed Dec 17, 2024
1 parent 0c09c35 commit 8fa23c2
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions scripts/ssps/createEmissionLinesTable.pl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@
$grid->{'lineData'} ->{'status' } = pdl long zeros(@dimensions);

# Iterate over all iterables to build an array of jobs.
$grid->{'counter'} = pdl long zeros(scalar(@{$grid->{'iterables'}}));
$grid->{'counter' } = pdl long zeros(scalar(@{$grid->{'iterables'}}));
$grid->{'modelNumber'} = pdl long zeros(@dimensions);
my $jobNumber = -1;
my $jobCount = 1;
for(my $i=0;$i<nelem($grid->{'counter'});++$i) {
Expand All @@ -365,6 +366,11 @@
} else {
do {
++$jobNumber;
my @indices;
for(my $i=0;$i<scalar(@{$grid->{'iterables'}});++$i) {
push(@indices,$grid->{'counter'}->(($i)));
}
$grid->{'modelNumber'}->(@indices) .= $jobNumber;
if ( ! exists($options{'model'}) || $options{'model'} == $jobNumber ) {
print "Generating model ".$jobNumber." of ".$jobCount."\n"
if ( $jobNumber % 100 == 0 || exists($options{'model'}) );
Expand Down Expand Up @@ -1099,8 +1105,10 @@ sub outputSSP {

# Write line data.
my $lineGroup = $tableFile->group('lines');
$lineGroup->dataset('status')->set($grid->{'lineData'}->{'status'});
$lineGroup->dataset('status')->attrSet(description => "Cloudy model status: 0 = success; 1 = disaster; 2 = non-zero exit status; 3 = missing output file; 4 = missing emission lines");
$lineGroup->dataset('status' )->set($grid->{'lineData'}->{'status' });
$lineGroup->dataset('status' )->attrSet(description => "Cloudy model status: 0 = success; 1 = disaster; 2 = non-zero exit status; 3 = missing output file; 4 = missing emission lines");
$lineGroup->dataset('modelNumber')->set($grid->{'modelNumber'});
$lineGroup->dataset('modelNumber')->attrSet(description => "Cloudy model number" );
foreach ( keys(%lineList) ) {
my $lineName = $lineList{$_};
$lineGroup->dataset($lineName)-> set( $grid->{'lineData'}->{$lineName}->{'luminosity'});
Expand Down Expand Up @@ -1131,8 +1139,10 @@ sub outputAGN {

# Write line data.
my $lineGroup = $tableFile->group('lines');
$lineGroup->dataset('status')->set($grid->{'lineData'}->{'status'});
$lineGroup->dataset('status')->attrSet(description => "Cloudy model status: 0 = success; 1 = disaster; 2 = non-zero exit status; 3 = missing output file; 4 = missing emission lines");
$lineGroup->dataset('status' )->set($grid->{'lineData'}->{'status'});
$lineGroup->dataset('status' )->attrSet(description => "Cloudy model status: 0 = success; 1 = disaster; 2 = non-zero exit status; 3 = missing output file; 4 = missing emission lines");
$lineGroup->dataset('modelNumber')->set($grid->{'lineData'}->{'modelNumber'});
$lineGroup->dataset('modelNumber')->attrSet(description => "Cloudy model number" );
foreach ( keys(%lineList) ) {
my $lineName = $lineList{$_};
$lineGroup->dataset($lineName)-> set( $grid->{'lineData'}->{$lineName}->{'luminosity'});
Expand Down

0 comments on commit 8fa23c2

Please sign in to comment.