def get_catalogue_data(planet_name): results = exodb.queryForColumns([ 'planet.name', 'system.period', 'system.epoch', 'system.a', 'system.i', 'star.radius', 'planet.radius', 'star.mass', 'star.teff'], where='replace(planet.name, " ", "") = "%s"' % planet_name.replace(" ", "")) if len(results): results = results[0] m = PyModel() m.period = float(results[1]) m.epoch = float(results[2]) m.a = float(results[3]) m.i = float(results[4]) m.rs = float(results[5]) m.rp = float(results[6]) m.mstar = float(results[7]) m.teff = float(results[8]) ldc = PyLDC( os.path.join( os.path.expanduser("~"), "work", "ReferenceDatabase", "Reference.db"), 6 ) coeffs = ldc.coefficients(m.teff) m.c1 = coeffs[0] m.c2 = coeffs[1] m.c3 = coeffs[2] m.c4 = coeffs[3] return m else: raise RuntimeError("Cannot create planet model")
def generate_model(): m = PyModel() m.id = 0 m.submodel_id = 0 m.period = 1.09 m.epoch = 2454508.9 m.a = 0.022 m.rs = 1.54 m.i = 89.2 m.rp = 1.769 m.mstar = 1.09 m.c1 = 0.2 m.c2 = 0.5 m.c3 = -0.1 m.c4 = -0.01 m.teff = 6400. return m
def copy_model(other): m = PyModel() m.period = other.period m.epoch = other.epoch m.a = other.a m.rs = other.rs m.i = other.i m.rp = other.rp m.mstar = other.mstar m.teff = other.teff m.c1 = other.c1 m.c2 = other.c2 m.c3 = other.c3 m.c4 = other.c4 return m