def getAltHierarchyBestFit(asimov_data, template_maker, params, minimizer_settings, hypo_normal, check_octant): """ Finds the best fit value of alternative hierarchy to that which was used to produce the asimov data set. \Params: * asimov_data - array of values of asimov data set (float) * template_maker - instance of class TemplateMaker service. * params - parameters with values, fixed, range, etc. of systematics * minimizer_settings - used with bfgs_b minimizer * hypo_normal - bool for Mass hierarchy being Normal (True) or inverted (False) * check_octant - bool to check the opposite octant for a solution to the minimization of the LLH. """ llh_data = find_alt_hierarchy_fit( asimov_data, template_maker, params, hypo_normal, minimizer_settings, only_atm_params=True, check_octant=check_octant) alt_params = get_values(select_hierarchy(params, normal_hierarchy=hypo_normal)) for key in llh_data.keys(): if key == 'llh': continue alt_params[key] = llh_data[key][-1] return alt_params, llh_data
def getAltHierarchyBestFit(asimov_data, template_maker, params, minimizer_settings, hypo_normal, check_octant): """ Finds the best fit value of alternative hierarchy to that which was used to produce the asimov data set. \Params: * asimov_data - array of values of asimov data set (float) * template_maker - instance of class TemplateMaker service. * params - parameters with values, fixed, range, etc. of systematics * minimizer_settings - used with bfgs_b minimizer * hypo_normal - bool for Mass hierarchy being Normal (True) or inverted (False) * check_octant - bool to check the opposite octant for a solution to the minimization of the LLH. """ llh_data = find_alt_hierarchy_fit(asimov_data, template_maker, params, hypo_normal, minimizer_settings, only_atm_params=True, check_octant=check_octant) alt_params = get_values( select_hierarchy(params, normal_hierarchy=hypo_normal)) for key in llh_data.keys(): if key == 'llh': continue alt_params[key] = llh_data[key][-1] return alt_params, llh_data
asimov_data_set = get_asimov_fmap(template_maker, asimov_params, channel=asimov_params['channel']) # Store injected true values in result: for key in free_params.keys(): if 'theta23' in key: continue result['true_' + key].append(asimov_params[key]) result['true_theta23'].append(step) result['asimov_data'].append(asimov_data_set) # now get fitted values of opposite hierarchy: hypo_normal = False if true_normal else True hypo_tag = 'hypo_IMH' if true_normal else 'hypo_NMH' llh_data = find_alt_hierarchy_fit(asimov_data_set, template_maker, params, hypo_normal, minimizer_settings, only_atm_params=False, check_octant=args.check_octant) for key in free_params.keys(): result['fit_' + key].append(llh_data[key][-1]) results[true_tag] = result logging.warn("FINISHED. Saving to file: %s" % args.outfile) to_json(results, args.outfile)
# the asimov data set: for step in steplist: print "Running at asimov parameters: %s"%step asimov_params = get_values(getAsimovParams(params,true_normal,step)) asimov_data_set = get_asimov_fmap( template_maker, asimov_params, chan=asimov_params['channel']) # Store injected true values in result: for key in free_params.keys(): if 'theta23' in key: continue result['true_'+key].append(asimov_params[key]) result['true_theta23'].append(step) result['asimov_data'].append(asimov_data_set) # now get fitted values of opposite hierarchy: hypo_normal = False if true_normal else True hypo_tag = 'hypo_IMH' if true_normal else 'hypo_NMH' llh_data = find_alt_hierarchy_fit( asimov_data_set,template_maker, params, hypo_normal, minimizer_settings, only_atm_params=False, check_octant=args.check_octant) for key in free_params.keys(): result['fit_'+key].append(llh_data[key][-1]) results[true_tag] = result logging.warn("FINISHED. Saving to file: %s"%args.outfile) to_json(results,args.outfile)