Astro

 view release on metacpan or  search on metacpan

Astro/Misc.pm  view on Meta::CPAN

	$tsys = "$c$tsys";
      } else {
	$form .= $c;
      }
    }

    $form =~ s/^\s+//;
    $form =~ s/\s+$//;
    $tsys =~ s/^\s+//;
    $tsys =~ s/\s+$//;

    # Clean up unidentified molecules
    if ($molecule eq 'unidentifie') {
      $molecule .= $form;
      $form = '';
    }

    if ($freq =~ /(.*)\*$/) {
      my $oldfreq = $freq;
      $freq = $1;
      $calc = 1;
      $freq =~ s/\s+$//;
      print "Using $oldfreq -> \"$freq\"\n";
    } else {
      $calc = 0;
    }

    if ($freq =~ /([^\s\*\(]*[\d\.])\s*(\*)?\s*(\(\s*\d+\))?/) {
      my $oldfreq = $freq;
      $freq = $1;
      if (defined $2) {
	$calc = $2;
      } else {
	$calc = ' ';
      }
      if (defined $3) {
	$uncert = $3;
      } else {
	$uncert = '';
      }

      #warn "Used $oldfreq-> $freq:$calc:$uncert\n";
    } else {
      warn "***Failed to parse $freq\n";
    }

    next if (defined $min && $freq<$min);
    next if (defined $max && $freq>$max);

    push @lovas, [$freq, $calc, $uncert, $molecule, $form, $tsys, $source, 
		  $telescope, $ref];

  }
  close(LOVAS);

  return @lovas;
}

# Used internally for calc_U
# Ref: Mezger & Henderson 1967, ApJ 147 p 471 Eq A.2
sub a ($) {
  my $freq = shift;

  my $a = 0.336 * $freq**0.1 * $Temp**-0.15
    * (log(4.995e-2/$freq) + 1.5*log($Temp));

  return($a);
}

=item B<calc_U>

  $U = calc_U($flux, $dist, $freq);

 Calculate U (Excitation Parameter) for an UCHII region
 Based on Eqn 8 in Schraml and Mezger, 1969
   $flux        Integrated Source Flux Density (Jy)
   $dist        Distance to source (kpc)
   $freq        Frequency of observation (GHz)
 Note:
  Uses the global variable $Astro::Misc::Temp for electron temperature
  Default is 10000K

=cut

sub calc_U ($$$) {

  my ($flux, $dist, $freq) = @_;

  my $U = 4.5526 * ($freq**0.1 / a($freq) * $Temp**0.35
		    * $flux * $dist**2)**(1/3);
  return ($U);
}

=item B<calc_Nl>

  $Nl = calc_Nl($U);

 Calculate the Lyman continuum photon flux given U, the Excitation
 Parameter for an UCHII region
   $U is the Excitation Parameter (from calc_U)
  Ref: Kurtz 1994 ApJS 91 p659 Eq (1) (Original Origin unknown)

=cut

sub calc_Nl ($) {

  my ($U) = @_;

  # This came from Panagia 1973 AJ 78 p929 Eq 5.
  #my $Nl = ($U / 1.0976 / 2.01e-19)**3 * (3.43e-13);

  # This is the same from Kurtz but includes the Electron Temperature
  my $Nl = 8.04e46 * $Temp**-0.85 * $U**3;

  return $Nl;

}

## Replaced by values from Thompson 1984
#  my @speclist = ('O4', 'O5', 'O5.5', 'O6', 'O6.5', 'O7', 'O7.5', 'O8', 
#  		'O8.5', 'O9', 'O9.5', 'B0', 'B0.5', 'B1', 'B2', 'B3');



( run in 1.934 second using v1.01-cache-2.11-cpan-2398b32b56e )