def __init__(self): radiustable.__init__(self) #we need to stitch together three tables. Note that prem_withQ has a wider range, so we cut #away rows at the top and bottom. Interpolation is not necessary, because all tables #where generated with at the same depths table = tools.read_table("data/prem_withQ.txt")#data is: radius pressure density V_p V_s Q_K Q_mu table = np.array(table) table[:,0] = table[:,0] / 1e3 #convert to km table2 = tools.read_table("data/swave_fast.txt") table2 = np.array(table2) table3 = tools.read_table("data/pwave_fast.txt") table3 = np.array(table3) min_radius = self.earth_radius-max(table2[:,0])/1e3 max_radius = self.earth_radius-min(table2[:,0])/1e3 table=np.array(filter(lambda x: (x[0]>=min_radius and x[0]<=max_radius), table)) assert(len(table) == len(table2)) assert(len(table) == len(table3)) self.table_radius = table[:,0] self.table_pressure = table[:,1] * 1e9 self.table_density = table[:,2] self.table_vp = table3[:,1] / 1e3 self.table_vs = table2[:,1] / 1e3
def __init__(self): radiustable.__init__(self) table = tools.read_table( "input_seismic/prem_lowermantle.txt" ) #data is: radius pressure density V_p V_s Q_K Q_G table = np.array(table) table[:, 0] = table[:, 0] table2 = tools.read_table("input_seismic/swave_fast.txt") table2 = np.array(table2) table3 = tools.read_table("input_seismic/pwave_fast.txt") table3 = np.array(table3) min_radius = self.earth_radius - max(table2[:, 0]) max_radius = self.earth_radius - min(table2[:, 0]) table = np.array( filter(lambda x: (x[0] >= min_radius and x[0] <= max_radius), table)) assert (len(table) == len(table2)) assert (len(table) == len(table3)) self.table_radius = table[:, 0] self.table_pressure = table[:, 1] self.table_density = table[:, 2] self.table_vp = table3[:, 1] self.table_vs = table2[:, 1]
def __init__(self): SeismicRadiusTable.__init__(self) table = tools.read_table("input_seismic/prem_table.txt") # radius, pressure, density, v_p, v_s table = np.array(table) self.table_radius = table[:,0] self.table_pressure = table[:,1] self.table_density = table[:,2] self.table_vp = table[:,3] self.table_vs = table[:,4] # read in gravity data table = tools.read_table("input_seismic/grav_for_PREM.txt") # radius, g table = np.array(table) self.table_radiusgravity = table[:,0] self.table_gravity = table[:,1]
def grav(self, depths): table = tools.read_table( "input_seismic/grav_for_PREM.txt") # radius, g table = np.array(table) table_rad = table[:, 0] table_g = table[:, 1] return np.interp(self.earth_radius - depths, table_rad, table_g)
def __init__(self): SeismicTable.__init__(self) table = tools.read_table("input_seismic/iasp91.txt") # radius, pressure, density, v_p, v_s table = np.array(table) self.table_depth = table[:, 0] self.table_radius = table[:, 1] self.table_vp = table[:, 2] self.table_vs = table[:, 3]
def __init__(self): radiustable.__init__(self) table = tools.read_table("data/prem_table.txt") # radius, pressure, density, v_p, v_s table = np.array(table) self.table_radius = table[:,0] self.table_pressure = table[:,1] * 0.1 * 1e9 # convert kbar to GPa to Pa self.table_density = table[:,2] self.table_vp = table[:,3] self.table_vs = table[:,4]
def __init__(self): radiustable.__init__(self) table = tools.read_table("input_seismic/prem_table.txt") # radius, pressure, density, v_p, v_s table = np.array(table) self.table_radius = table[:,0] self.table_pressure = table[:,1] self.table_density = table[:,2] self.table_vp = table[:,3] self.table_vs = table[:,4]
def __init__(self): radiustable.__init__(self) table = tools.read_table("input_seismic/prem_table.txt" ) # radius, pressure, density, v_p, v_s table = np.array(table) self.table_radius = table[:, 0] self.table_pressure = table[:, 1] self.table_density = table[:, 2] self.table_vp = table[:, 3] self.table_vs = table[:, 4]
def __init__(self): radiustable.__init__(self) table = tools.read_table("data/prem_withQ.txt")#data is: radius pressure density V_p V_s Q_K Q_mu table = np.array(table) self.table_radius = table[:,0] / 1e3 #convert to km self.table_pressure = table[:,1] * 1e9 self.table_density = table[:,2] self.table_vp = table[:,3] / 1e3 self.table_vs = table[:,4] / 1e3
def __init__(self): radiustable.__init__(self) table = tools.read_table("input_seismic/prem_lowermantle.txt")#data is: radius pressure density V_p V_s Q_K Q_G table = np.array(table) self.table_radius = table[:,0] self.table_pressure = table[:,1] self.table_density = table[:,2] self.table_vp = table[:,3] self.table_vs = table[:,4]
def __init__(self): radiustable.__init__(self) table = tools.read_table( "input_seismic/prem_lowermantle.txt" ) #data is: radius pressure density V_p V_s Q_K Q_G table = np.array(table) self.table_radius = table[:, 0] self.table_pressure = table[:, 1] self.table_density = table[:, 2] self.table_vp = table[:, 3] self.table_vs = table[:, 4]
def __init__(self): SeismicTable.__init__(self) table = tools.read_table("input_seismic/prem.txt") # data is: radius pressure density V_p V_s Q_K Q_G table = np.array(table) table2 = tools.read_table("input_seismic/swave_fast.txt") table2 = np.array(table2) table3 = tools.read_table("input_seismic/pwave_fast.txt") table3 = np.array(table3) min_radius = self.earth_radius - max(table2[:, 0]) max_radius = self.earth_radius - min(table2[:, 0]) table = np.array(filter(lambda x: (x[1] >= min_radius and x[1] <= max_radius), table)) self.table_depth = table[:, 0] self.table_radius = table[:, 1] self.table_pressure = table[:, 2] self.table_density = table[:, 4] self.table_vp = np.interp(self.table_depth, table3[:, 0][::-1], table3[:, 1][::-1]) self.table_vs = np.interp(self.table_depth, table2[:, 0][::-1], table2[:, 1][::-1])
def __init__(self): radiustable.__init__(self) table = tools.read_table("input_seismic/prem_lowermantle.txt")#data is: radius pressure density V_p V_s Q_K Q_G table = np.array(table) table[:,0] = table[:,0] table2 = tools.read_table("input_seismic/swave_fast.txt") table2 = np.array(table2) table3 = tools.read_table("input_seismic/pwave_fast.txt") table3 = np.array(table3) min_radius = self.earth_radius-max(table2[:,0]) max_radius = self.earth_radius-min(table2[:,0]) table=np.array(filter(lambda x: (x[0]>=min_radius and x[0]<=max_radius), table)) assert(len(table) == len(table2)) assert(len(table) == len(table3)) self.table_radius = table[:,0] self.table_pressure = table[:,1] self.table_density = table[:,2] self.table_vp = table3[:,1] self.table_vs = table2[:,1]
def __init__(self): SeismicTable.__init__(self) table = tools.read_table("input_seismic/STW105.txt") # radius, pressure, density, v_p, v_s table = np.array(table) self.table_radius = table[:, 0][::-1] self.table_density = table[:, 1][::-1] self.table_vpv = table[:, 2][::-1] self.table_vsv = table[:, 3][::-1] self.table_QK = table[:, 4][::-1] self.table_QG = table[:, 5][::-1] self.table_vph = table[:, 6][::-1] self.table_vsh = table[:, 7][::-1] self.table_depth = self.earth_radius - self.table_radius # Voigt averages for Vs and Vp self.table_vs = np.sqrt((2.0 * self.table_vsv * self.table_vsv + self.table_vsh * self.table_vsh) / 3.0) self.table_vp = np.sqrt((self.table_vpv * self.table_vpv + 4.0 * self.table_vph * self.table_vph) / 5.0)
from scipy.interpolate import interp1d import matplotlib.pyplot as plt import tools LBOL_SUN = 3.844e33 # in erg/s (from Bahcall et al 1995, Girardi used this value) MBOL_SUN = 4.77 # (from Bahcall et al 1995, Girardi used this value) LOG_G = 4.5 # for M37 DISTANCE = 1490. # In parsec for M37 DISTANCE_SD = 120. # In parsec for M37 EXTINCTIONr = 0.518695 # A_r from Schlafly11 tables (Rv=3.1, E(B-V)=0.227; Av / E(B-V)=2.285) EXTINCTIONg = 0.749781 # from Schlafly11 tables (Rv=3.1, E(B-V)=0.227) EXTINCTIONi = 0.385446 # from Schlafly11 tables (Rv=3.1, E(B-V)=0.227) pc_to_cm = 3.08567758e18 # Read SEDs table (Adam's table) ---------------------------------------------- kh = tools.read_table(FOLDER_DATA + KHTABLE5, raw=True) coltemp = np.array(kh[10]) gmag = np.array(kh[2]) rmag = np.array(kh[3]) imag = np.array(kh[4]) numrows = len(rmag) gfunc = interp1d(gmag, coltemp, kind='linear') rfunc = interp1d(rmag, coltemp, kind='linear') ifunc = interp1d(imag, coltemp, kind='linear') slopes = np.zeros((numrows - 1, 3)) for ir in range(numrows): if ir == numrows - 1: continue slopes[ir, 0] = np.abs((coltemp[ir+1] - coltemp[ir]) / (gmag[ir+1] - gmag[ir])) slopes[ir, 1] = np.abs((coltemp[ir+1] - coltemp[ir]) / (rmag[ir+1] - rmag[ir])) slopes[ir, 2] = np.abs((coltemp[ir+1] - coltemp[ir]) / (imag[ir+1] - imag[ir])) magranges = [[-0.39,20.98], [-0.04,18.48], [0.34,15.85]] # gri; outside of these, func not valid!
Material for which we compute dT/dP. Returns ------- dT/dP : float Adiabatic temperature gradient for the composite at a given temperature and pressure. :math:`[K/Pa]` """ top = 0 bottom = 0 rock.set_state(pressure, temperature) (fractions,minerals) = rock.unroll() for (fr,mineral) in zip(fractions,minerals): gr = mineral.grueneisen_parameter() K_s = mineral.adiabatic_bulk_modulus() C_p = mineral.heat_capacity_p() top += fr*gr*C_p/K_s bottom += fr*C_p return temperature*top/bottom table_brown = tools.read_table("input_geotherm/brown_81.txt") table_brown_depth = np.array(table_brown)[:,0] table_brown_temperature = np.array(table_brown)[:,1] table_anderson = tools.read_table("input_geotherm/anderson_82.txt") table_anderson_depth = np.array(table_anderson)[:,0] table_anderson_temperature = np.array(table_anderson)[:,1]
def grav(self,depths): table = tools.read_table("input_seismic/grav_for_PREM.txt") # radius, g table = np.array(table) table_rad = table[:,0] table_g = table[:,1] return np.interp(self.earth_radius-depths, table_rad,table_g)