Пример #1
0
import bal
from constants import *
from math import fabs

spec = rd.read_spec_file("run110e")

spec_array = bal.flambda_to_fnu (spec.spec[4], spec.freq, spec.wavelength)

BI = bal.BALnicity( C/(1549.0*ANGSTROM), spec.freq, spec_array)

print BI



ls_file = sys.argv[1]
rd.setpars()
filenames = np.loadtxt(ls_file, dtype='string')

bheight = []
bhseven =[]
bhnine =[]

for i in range(len(filenames)):
	spec = rd.read_spec_file (filenames[i])
	spec_array = bal.flambda_to_fnu (spec.spec[4], spec.freq, spec.wavelength)

	BI = bal.BALnicity( C/(1549.0*ANGSTROM), spec.freq, spec_array)
	
	if fabs(BI) > 3000.0:
		if 'bh7' in filenames[i]: bhseven.append(spec)
		if 'bh8' in filenames[i]: bheight.append(spec)
Пример #2
0
your time in the workshop catching up). The tasks themselves are pretty straightforward
- the theory section is here for completeness, but actually all that is needed from this
section is to be able to program a couple of the formulae (specifically equations 2-1).
'''

import sys, os
import numpy as np
import logging
import warnings
from numpy import exp
import pylab as p
from pylab import *
from astropy import units
from constants import *
from read_output import setpars
setpars()

H0_70 = 70.0 # km /s / MPC


def mu(d_l):

	'''
	distance modulus for D_L in MPC, equation (2)
	'''

	return 25.0 + (5.0 * np.log10(d_l))


def eta(a, omega_m):
Пример #3
0
# now we want a list of pywind cmds
# we want to make files 
# we want electron density
# we want neutral hydrogen density and non neutral
#pywindcmds = [ 1, 'n', 't',  'i', 1, 1, 1, 1, 2, 0, 'q']  
pywindcmds = [ 1, 'n', 't', 'i', 0, 1, 1, 0, 'q']  

# first write these commands to a file
inp =open('input_comms','w')

for command in pywindcmds:
	inp.write ( "%s\n" % str(command) )
inp.close()	

 
rd.setpars()	# set standard plotting parameters, e.g. tex






# set the band you want to plot emissivities over
# 3000-7000 will get the balmer continuum
wavemin = 3000.0
wavemax = 7000.0




# we read from a template file template.pf
Пример #4
0
		 
		oster_case_b = [[2.87, 1.00, 0.466, 0.256, 0.158, 0.105, 0.073, 0.0529] , \
		                [2.76, 1.00, 0.474, 0.262, 0.162, 0.107, 0.074, 0.0538]]
	else:
		seaton = [[1.91, 1.00, 0.589, 0.378, 0.258, 0.184, 0.137, 0.104], \
	          [1.99, 1.00, 0.569, 0.356, 0.238, 0.167, 0.122, 0.092]]
		

	rootfolder = 'diag_%s/' % root

	matom_emiss, kpkt_emiss = rd.read_emissivity ( rootfolder + root )

	nlevels_macro = len(matom_emiss)
	n_array = np.arange (nlevels_macro)
	n_array = n_array+1.0
	rd.setpars()    # set standard plotting parameters

	hbeta = matom_emiss[3]
	#hbeta.append(hbeta)
	print hbeta

	label = "Case A" 
	# scatter plot of level emissivities
	if 'cab' in root: label = "Case B" 

	ax = fig.add_subplot(2,1,i_plot+1)
	plt.text(9,1,label)
	ax.scatter(n_array, matom_emiss / hbeta,  label = '\\textsc{Python}', s=80, edgecolors='k', facecolors='none')
	ax.scatter(n_array[2:10], seaton[i_plot], label = 'Seaton (1959)',s=20, color='k')
	#if 'cab' in root:
	#	ax.scatter(np.arange(3,11), oster_case_b[i_plot], label="Osterbrock", c='r', s=10)
Пример #5
0
# first import modules of use
import csv, sys, os, array, warnings
import matplotlib.pyplot as plt
import numpy as np
import read_output as rd
import cobra_sub as sub

sub.print_cobra()

# filename is provided by command line
print 'Reading your commands from command line'
mode, store = rd.read_args (sys.argv)

print 'Welcome to cobra, the plotting utility for the radiative transfer code, Python.'
rd.setpars() #this just sets some standard parameters, e.g. tex

# if user asked for help we print help message and exit
if mode.help:
    sub.help_me_spec()

filename = store.filename

# read the spec file
spectrum = rd.read_spec_file (filename)



# we now want to smooth our spectrum
smooth = store.ibin
sub.smooth_spectrum(spectrum, smooth)
Пример #6
0
import disk_models as d
import numpy as np
import disk
import read_output as rd
import py_plot_util as util
rd.setpars()

from pylab import *
from pretty import *
from constants import *

set_pretty()


def Ledd(m):
    '''
	calculates eddington luminosity for a solar mass m
	
	Args:
		m	mass in solar masses
	
	returns:
		Eddington luminosity in ergs s^-1, float
	'''

    m *= MSOL

    consts = (4.0 * PI * G * C * MPROT) / THOMPSON

    L = consts * m