with open(datafile, newline='') as f: reader = csv.reader(f) data = list(reader) f.close() # Read in the correct config file from the database config_file = config.config_file(db_init_filename='database_archi.ini', section='radex_fit_results') bestfit_config_file = config.config_file(db_init_filename='database_archi.ini', section='radex_bestfit_conditions') db_pool = db.dbpool(config_file) db_bestfit_pool = db.dbpool(bestfit_config_file) # Parse the data to a dict list observed_data = workerfunctions.parse_data(data, db_pool, db_bestfit_pool) # Filter the observed data to contain only those species that we can use # (normally limited by those with Radex data) filtered_data = workerfunctions.filter_data(observed_data, ["SIO", "SO", "OCS", "H2CS"]) # Read the image data from Farhad fits_table_filename = 'data/images/plw.fits' observation = fits.open(fits_table_filename)[1] image_data = observation.data w = wcs.WCS(observation.header) # Determine size of image from pixel coords and use to determine pixel sizes origin_x_pos, origin_y_pos = w.wcs_pix2world(0, 0, 1) max_x_pos, max_y_pos = w.wcs_pix2world(len(image_data), len(image_data[0]), 1)
# Declare the database connections config_file = config.config_file(db_init_filename='database_archi.ini', section='shock_fit_results') bestfit_config_file = config.config_file(db_init_filename='database_archi.ini', section='shock_bestfit_conditions') # Set up the connection pools db_pool = db.dbpool(config_file) db_bestfit_pool = db.dbpool(bestfit_config_file) # Read in the whole data file containing sources and source flux with open(datafile, newline='') as f: reader = csv.reader(f) data = list(reader) f.close() # Parse the data to a dict list observed_data = workerfunctions.parse_data(data) # Filter the observed data to contain only those species that we can use # (normally limited by those with Radex data) filtered_data = workerfunctions.filter_data(observed_data, relevant_species) nWalkers = 500 # Number of random walkers to sample parameter space nDim = 5 # Number of dimensions within the parameters nSteps = int(1e3) # Number of steps per walker for obs in filtered_data: if (len(obs["species"]) >= 2 and "SIO" in obs["species"]) or \ (len(obs["species"]) >= 2 and "SO" in obs["species"]) or \ (len(obs["species"]) >= 2 and "CH3OH" in obs["species"]) or \ (len(obs["species"]) >= 2 and "OCS" in obs["species"]) or \ (len(obs["species"]) >= 2 and "H2CS" in obs["species"]):