Пример #1
0
                                        %(mask_label, E_MIN, E_MAX))
        logger.info('Created %s' % out_name)
        logger.info('Created %s' % out_name_err)
        hp.write_map(out_name, macro_flux_masked, coord='G')
        hp.write_map(out_name_err, macro_fluxerr_masked, coord='G')
        F_MEAN = np.sum(macro_flux[_unmask]) / len(macro_flux[_unmask])
        crbkg = get_crbkg(crbkg_file)
        logger.info('Subtracting CR residual bkg...')
        #F_MEAN = F_MEAN - (E_MAX-E_MIN)*crbkg(E_MEAN)/E_MEAN**2
        FERR_MEAN = np.sqrt(np.sum(macro_fluxerr[_unmask]**2))/\
                                   len(macro_flux[_unmask])
        FSKY = float(len(macro_flux[_unmask])) / float(len(macro_flux))
        logger.info('Fsky = %.3f' % FSKY)
        print 'F_MEAN, FERR_MEAN = ', F_MEAN, FERR_MEAN
        new_txt.write('%.2f \t %.2f \t %.2f \t %e \t %e \t %e \t %f \n' \
                          %(E_MIN, E_MAX, E_MEAN, F_MEAN, FERR_MEAN, CN, FSKY))
    if kwargs['foresub'] == True:
        new_txt.write('\n\n*** FOREGROUND PARAMETERS***\n\n')
        new_txt.write('MEAN FLUX \t %s\n' % str(fore_mean_list))
    new_txt.close()
    logger.info('Created %s' %os.path.join(GRATOOLS_OUT,
                                     '%s_%s_%s_parameters.txt'\
                                      %(out_label, mask_label, binning_label)))
    logger.info('done!')


if __name__ == '__main__':
    args = PARSER.parse_args()
    startmsg()
    mkRestyle(**args.__dict__)
Пример #2
0
        new_txt.write('MEAN_FORE_FLUX \t %s\n' %str(fore_mean_list))
        new_txt.write('NORM_FIT_PARAM \t %s\n' %str(norm_list))
        new_txt.write('NORM_FIT_PARAM_errsx \t %s\n' %str(norm_sx_list))
        new_txt.write('NORM_FIT_PARAM_errdx \t %s\n' %str(norm_dx_list))
        new_txt.write('IGRB_FIT_PARAM \t %s\n' %str(const_list))
        new_txt.write('IGRB_FIT_PARAM_errsx \t %s\n' %str(const_sx_list))
        new_txt.write('IGRB_FIT_PARAM_errdx \t %s\n' %str(const_dx_list))
    if kwargs['foresub'] == 'galsrc':
        new_txt.write('\n\n*** FOREGROUND PARAMETERS***\n\n')
        new_txt.write('MEAN_FORE_FLUX \t %s\n' %str(fore_mean_list))
        new_txt.write('NORM_FORE_FIT PARAM \t %s\n' %str(norm1_list))
        new_txt.write('NORM_FORE_FIT PARAM_errsx \t %s\n' %str(norm1_sx_list))
        new_txt.write('NORM_FORE_FIT PARAM_errdx \t %s\n' %str(norm1_dx_list))
        new_txt.write('NORM_SRC_FIT_PARAM \t %s\n' %str(norm2_list))
        new_txt.write('NORM_SRC_FIT_PARAM_errsx \t %s\n' %str(norm2_sx_list))
        new_txt.write('NORM_SRC_FIT_PARAM_errdx \t %s\n' %str(norm2_dx_list))
        new_txt.write('IGRB_FIT_PARAM \t %s\n' %str(const_list))
        new_txt.write('IGRB_FIT_PARAM_errsx \t %s\n' %str(const_sx_list))
        new_txt.write('IGRB_FIT_PARAM_errdx \t %s\n' %str(const_dx_list))
    new_txt.close()
    logger.info('Created %s' %os.path.join(GRATOOLS_OUT, 
                                     '%s_%s_%s_parameters.txt'\
                                      %(out_label, mask_label, binning_label)))
    logger.info('done!')


if __name__ == '__main__':
    args = PARSER.parse_args()
    startmsg()
    mkRestyle(**args.__dict__)