def save_rescaled_draws(data, index_columns): """ Saves rescaled draws in an h5 file """ logger = logging.getLogger('correct.save_rescaled_draws') # Save rescaled draws draw_filepath = parent_dir + r'/unaggregated/rescaled/rescaled_{location_id}_{sex_name}.h5'.format(location_id=location_id, sex_name=sex_name) save_hdf(data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)
def save_models(data, index_columns): """ Saves model version id for each data point in an h5 file """ logger = logging.getLogger('correct.save_models') # Save model data draw_filepath = parent_dir + r'/models/models_{location_id}_{sex_name}.h5'.format(location_id=location_id, sex_name=sex_name) save_hdf(data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)
def save_rescaled_draws(data, index_columns): """Saves rescaled draws in an h5 file.""" logger = logging.getLogger('correct.save_rescaled_draws') # Save rescaled draws draw_filepath = ( parent_dir + r'FILEPATH.h5' .format(location_id=location_id, sex_id=sex_id)) save_hdf(data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)
def save_unscaled_draws(data, index_columns): """ Saves unscaled draws in an h5 file """ logger = logging.getLogger('correct.save_unscaled_draws') # Save unscaled draws draw_filepath = (parent_dir + r'FILEPATH.h5') save_hdf(data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)
def save_all_outputs(parent_dir, new_rescaled, new_rescaled_yll): logger = logging.getLogger('append_shocks.save_all_outputs') try: logging.info( "Saving new rescaled+shocks deaths for loc {}".format(location)) filepath = parent_dir + r'FILEPATH.h5'.format(l_id=location) save_hdf(new_rescaled, filepath, data_columns=index_cols) logging.info( "Saving new rescaled+shocks ylls for loc {}".format(location)) filepath = parent_dir + r'FILEPATH.h5'.format(l_id=location) save_hdf(new_rescaled_yll, filepath, data_columns=index_cols) except Exception as e: logger.exception('Failed to save all outputs: {}'.format(e))
def save_all_outputs(parent_dir, new_rescaled, new_rescaled_yll, location): """Saves deaths and ylls with appended shocks to the final output location for CoDCorrect.""" logger = logging.getLogger('append_shocks.save_all_outputs') try: logging.info( "Saving new rescaled+shocks deaths for loc {}".format(location)) filepath = parent_dir + r'/draws/1_{l_id}.h5'.format(l_id=location) save_hdf(new_rescaled, filepath, data_columns=index_cols) logging.info( "Saving new rescaled+shocks ylls for loc {}".format(location)) filepath = parent_dir + r'/draws/4_{l_id}.h5'.format(l_id=location) save_hdf(new_rescaled_yll, filepath, data_columns=index_cols) except Exception as e: logger.exception('Failed to save all outputs: {}'.format(e))
def save_all_draws(parent_dir, index_columns, rescaled_data, shock_data, unscaled_data, location): # Save rescaled data draw_filepath = (parent_dir + r'FILEPATH.h5'.format(loc=location)) save_hdf(rescaled_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns) # Save unscaled data draw_filepath = (parent_dir + r'FILEPATH.h5'.format(loc=location)) save_hdf(unscaled_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns) # Save shocks draw_filepath = (parent_dir + r'FILEPATH.h5'.format(loc=location)) save_hdf(shock_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)
def save_all_draws(parent_dir, index_columns, rescaled_data, shock_data, unscaled_data, dalynator_data, dalynator_export_years_ids=None): # Save rescaled data draw_filepath = parent_dir + r'/aggregated/rescaled/rescaled_{location_id}.h5'.format( location_id=location_id) save_hdf(rescaled_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns) # Save unscaled data draw_filepath = parent_dir + r'/aggregated/unscaled/unscaled_{location_id}.h5'.format( location_id=location_id) save_hdf(unscaled_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns) # Save shocks draw_filepath = parent_dir + r'/aggregated/shocks/shocks_{location_id}.h5'.format( location_id=location_id) save_hdf(shock_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns) # Save DALYNator draws draw_filepath = parent_dir + r'/draws/death_{location_id}.h5'.format( location_id=location_id) save_hdf(dalynator_data, draw_filepath, key='draws', mode='w', format='table', data_columns=index_columns)