print 'sigma_(eta_nu)='+str(best_sigma1)+', sigma_(V_nu)='+str(best_sigma2) # Find the thresholds for a given sigma (in log space) sigcutx,paramx,range_x = generic_tools.get_sigcut([a[0] for a in data if a[3]==0.],best_sigma1) sigcuty,paramy,range_y = generic_tools.get_sigcut([a[1] for a in data if a[3]==0.],best_sigma2) print(r'Gaussian Fit $\eta$: '+str(round(10.**paramx[0],2))+'(+'+str(round((10.**(paramx[0]+paramx[1])-10.**paramx[0]),2))+' '+str(round((10.**(paramx[0]-paramx[1])-10.**paramx[0]),2))+')') print(r'Gaussian Fit $V$: '+str(round(10.**paramy[0],2))+'(+'+str(round((10.**(paramy[0]+paramy[1])-10.**paramy[0]),2))+' '+str(round((10.**(paramy[0]-paramy[1])-10.**paramy[0]),2))+')') print 'Eta_nu threshold='+str(10.**sigcutx)+', V_nu threshold='+str(10.**sigcuty) data=[[variables[n][0],np.log10(float(variables[n][1])),np.log10(float(variables[n][2])),variables[n][5],float(variables[n][-1])] for n in range(len(variables)) if float(variables[n][1]) > 0 if float(variables[n][2]) > 0] # Get the different frequencies in the dataset frequencies = generic_tools.get_frequencies(data) # Create the scatter_hist plot plotting_tools.create_scatter_hist(data,0,0,paramx,paramy,range_x,range_y,'',frequencies) # make second array for the diagnostic plot: [eta_nu, V_nu, maxflx_nu, flxrat_nu, nu] data2=[[variables[n][0],float(variables[n][1]),float(variables[n][2]),float(variables[n][3]),float(variables[n][4]),variables[n][5]] for n in range(len(variables)) if float(variables[n][1]) > 0 if float(variables[n][2]) > 0] # Create the diagnostic plot plotting_tools.create_diagnostic(data2,0,0,frequencies,'') # Setup data to make TP/FP/TN/FN plots # Create arrays containing the data to plot fp=[[z[0],np.log10(float(z[1])),np.log10(float(z[2])),'FP'] for z in stable if (float(z[1])>=10.**sigcutx and float(z[2])>=10.**sigcuty)] # False Positive tn=[[z[0],np.log10(float(z[1])),np.log10(float(z[2])),'TN'] for z in stable if (float(z[1])<10.**sigcutx or float(z[2])<10.**sigcuty)] # True Negative tp=[[z[0],np.log10(float(z[1])),np.log10(float(z[2])),'TP'] for z in variable if (float(z[1])>=10.**sigcutx and float(z[2])>=10.**sigcuty)] # True Positive fn=[[z[0],np.log10(float(z[1])),np.log10(float(z[2])),'FN'] for z in variable if (float(z[1])<10.**sigcutx or float(z[2])<10.**sigcuty)] # False Negative data3=fp+tn+tp+fn
print 'Identified Transient Candidates (no margin)' print np.sort(list(set([int(x[0]) for x in trans_data if x[-4]!='2' if float(x[-2])>=float(x[-1]) if float(x[-3])<float(x[-1])]))) print 'Identified Transients (no margin)' print np.sort(list(set([int(x[0]) for x in trans_data if x[-4]!='2' if float(x[-3])>=float(x[-1])]))) # Find the thresholds for a given sigma (in log space) sigcutx,paramx,range_x = generic_tools.get_sigcut([a[1] for a in data],sigma1) sigcuty,paramy,range_y = generic_tools.get_sigcut([a[2] for a in data],sigma2) if sigma1 == 0: sigcutx=0 if sigma2 == 0: sigcuty=0 print(r'Gaussian Fit $\eta$: '+str(round(10.**paramx[0],2))+'(+'+str(round((10.**(paramx[0]+paramx[1])-10.**paramx[0]),2))+' '+str(round((10.**(paramx[0]-paramx[1])-10.**paramx[0]),2))+')') print(r'Gaussian Fit $V$: '+str(round(10.**paramy[0],2))+'(+'+str(round((10.**(paramy[0]+paramy[1])-10.**paramy[0]),2))+' '+str(round((10.**(paramy[0]-paramy[1])-10.**paramy[0]),2))+')') print 'Eta_nu threshold='+str(10.**sigcutx)+', V_nu threshold='+str(10.**sigcuty) # Get the different frequencies in the dataset frequencies = generic_tools.get_frequencies(data) # Create the scatter_hist plot IdTrans = plotting_tools.create_scatter_hist(data,sigcutx,sigcuty,paramx,paramy,range_x,range_y,dataset_id,frequencies) print 'Identified variables:' print np.sort(list(set(IdTrans))) # make second array for the diagnostic plot: [eta_nu, V_nu, maxflx_nu, flxrat_nu, nu, trans_type] data2=[[trans_data[n][0],float(trans_data[n][1]),float(trans_data[n][2]),float(trans_data[n][3]),float(trans_data[n][4]),trans_data[n][5], trans_data[n][-1]] for n in range(len(trans_data)) if float(trans_data[n][1]) > 0 if float(trans_data[n][2]) > 0 if trans_data[n][-4]=='2'] # Create the diagnostic plot plotting_tools.create_diagnostic(data2,sigcutx,sigcuty,frequencies,dataset_id)