Chi2 = np.nansum(Scp2)
			if DEBUG:
				print("Chi2")
				print(Chi2)
			dof=no_bins[0]
			for dim in range(1,no_dim):
				dof *= no_bins[1]
			dof-=1
		
			pvalue= 1 - stats.chi2.cdf(Chi2,dof)

			if DEBUG:
				print(bins_sample0)
				print(bins_sample1)
				print("Chi2/dof : {0}".format(str(Chi2/dof)))

				print("pvalue : {0}".format(str(pvalue)))
			score_list.append(pvalue)

		with open(name+"_bins_p_values", "wb") as test_statistics_file:
			for score in score_list:
				test_statistics_file.write(str(score)+"\n")

		classifier_eval_simplified.histo_plot_pvalue(score_list,50,"p value","Frequency","p value distribution "+ str(single_no_bins) + " bins",name+"_bins")






			#nansum ignores all the contributions that are Not A Number (NAN)
			Chi2 = np.nansum(Scp2)
			if __debug__:
				print("Chi2")
				print(Chi2)
			dof=no_bins[0]
			for dim in range(1,no_dim):
				dof *= no_bins[1]
			dof-=1

			print(bins_sample0)
			print(bins_sample1)
			print("Chi2/dof : {0}".format(str(Chi2/dof)))

			pvalue= 1 - stats.chi2.cdf(Chi2,dof)

			print("pvalue : {0}".format(str(pvalue)))
			score_list.append(pvalue)

		with open(str(dim_data)+"Dgauss_double_dist02_miranda_"+str(single_no_bins)+"bins_p_values", "wb") as test_statistics_file:
			for score in score_list:
				test_statistics_file.write(str(score)+"\n")

		classifier_eval_simplified.histo_plot_pvalue(score_list,50,"p value","Frequency","p value distribution",str(dim_data)+"Dgauss_double_dist02_miranda_"+str(single_no_bins)+"bins")






		#nansum ignores all the contributions that are Not A Number (NAN)
		Chi2 = np.nansum(Scp2)
		if __debug__:
			print("Chi2")
			print(Chi2)
		dof=no_bins[0]
		for dim in range(1,no_dim):
			dof *= no_bins[1]
		dof-=1

		print(bins_sample0)
		print(bins_sample1)
		print("Chi2/dof : {0}".format(str(Chi2/dof)))

		pvalue= 1 - stats.chi2.cdf(Chi2,dof)

		print("pvalue : {0}".format(str(pvalue)))
		score_list.append(pvalue)

	with open("dalitz_miranda_"+str(single_no_bins)+"bins_p_values", "wb") as test_statistics_file:
		for score in score_list:
			test_statistics_file.write(str(score)+"\n")

	classifier_eval_simplified.histo_plot_pvalue(score_list,50,"p value","Frequency","p value distribution","dalitz_miranda_"+str(single_no_bins)+"bins")