''' import numpy as np import math import pdb from astropy import constants as const import conversions ''' Wavelength (Angstroms) ''' wave1 = 3000.0 wave2 = 5500.0 wave3 = 8000.0 '''Part 1: determine the frequency and energy at 5500 Angstroms.''' frequency = conversions.WaveToFreq(wave2*1e-8) print "The frequency corresponding to 5500 Angstroms is:", frequency, "Hz." energy = conversions.WaveToEnergy(wave2*1e-8) print "The energy corresponding to 5500 Angstroms is:", energy, "erg." ''' Part 2: Determine the conversion factor between F_lambda and F_freq # at 3000, 5500, and 8000 Angstroms.''' test_flux = 1.e7 # test flux in erg/s/cm^2 print "1.", test_flux/(conversions.convert_flux(test_flux,wave1*1e-8)) print "2.", test_flux/(conversions.convert_flux(test_flux,wave2*1e-8)) print "3.", test_flux/(conversions.convert_flux(test_flux,wave3*1e-8))
import math import pdb # Import 'conversions.py' from question 5 import conversions # 1. J = 10*1e-23 # Jansky [erg/s/cm^2/Hz] wave = 5500.0e-8 # Wavelength [cm] flux_lambda = 3.6e-9 # flux of Vega [erg/s/cm^2/Angstrom] flux_nu = conversions.convert_flux(flux_lambda,wave) # flux of Vega [erg/s/cm^2/Hz] print flux_nu print '1. The flux of Vega is', flux_nu/J, '[J].' # 2. flux_lambda = 3.60e-9 # flux of star [erg/s/cm^2/Angstrom] wave = 8500.0e-8 # wavelength of star [cm] flux_nu = conversions.convert_flux(flux_lambda,wave) # flux of star [erg/s/cm^2/Hz] print '2. The flux of the star is', flux_nu/J, '[J].' # 3. flux_star = 7.2e-14 # flux of star [erg/s/cm^2/Angstrom] flux_Vega = 3.6e-9 # flux of Vega [erg/s/cm^2/Angstrom] print '3. The difference in magnitudes is' print -2.5*math.log10(flux_star/flux_Vega) print 'and the star is', flux_Vega/flux_star