fixed typo, saved plots
This commit is contained in:
parent
54c128b45f
commit
b09a1a9fbb
|
@ -99,7 +99,9 @@ detections = detections.reset_index(drop=True)
|
|||
summary(3)
|
||||
|
||||
postFilterCount = len(detections['dm'])
|
||||
logger.info(f"Removed {preFilterCount-postFilterCount} detections by filtering.")
|
||||
logger.info(f"Removed {preFilterCount-postFilterCount} detections by filtering the following:")
|
||||
for file in remFiles:
|
||||
logger.info(file+"_injected.fil")
|
||||
|
||||
#Let's do detection matching! Yaaaay!
|
||||
#What detections line up to which injections? This will determine which ones got missed entirely.
|
||||
|
@ -149,6 +151,7 @@ logger.info(f"Successful detection ratio: {Counter(matchMaskInj)[True]/(len(inje
|
|||
|
||||
#Let's try to figure out if certain files are responsible for the weird amount of false
|
||||
#positives at around 10^2.7 pc/cc
|
||||
#IT WAS 5 FILES. Filtered out above.
|
||||
|
||||
fpFileCounts = Counter(detections[falsePositiveMask]['file'])
|
||||
sortedFPCounts = [(k, v) for k,v in sorted(fpFileCounts.items(), key=lambda value: -value[1])]
|
||||
|
@ -198,7 +201,7 @@ ax.hist([np.log10(injections['dm'][matchMaskInj]), np.log10(injections['dm'][mis
|
|||
stacked=True, label=['Detected', 'Missed'], bins=15)
|
||||
ax.yaxis.get_major_locator().set_params(integer=True)
|
||||
ax.legend(loc='upper center')
|
||||
ax.set_xlabel(r"DM (log pc cm$^3$)")
|
||||
ax.set_xlabel(r"DM (log pc cm$^{-3}$)")
|
||||
ax.tick_params(labelbottom=True)
|
||||
ax2 = plt.subplot(17,1,(9,16))
|
||||
ax2.hist([np.log10(injections['pulseWidth'][matchMaskInj]), np.log10(injections['pulseWidth'][missedMask])],
|
||||
|
@ -210,7 +213,7 @@ plt.title("Injected pulses")
|
|||
wordAx = plt.subplot(17,1,17)
|
||||
wordAx.text(.3,.5,f"Overall detection rate: {round(Counter(matchMaskInj)[True]/(len(injections['dm']))*100,1)}%", size=14)
|
||||
wordAx.set_axis_off()
|
||||
plt.draw()
|
||||
plt.savefig(os.path.join("out","injections.png"))
|
||||
|
||||
#Stacked histogram of detections
|
||||
plt.figure(figsize=(7,10))
|
||||
|
@ -218,7 +221,7 @@ ax = plt.subplot(17,1,(1,8))
|
|||
ax.hist([np.log10(detections['dm'][matchMaskDet]), np.log10(detections['dm'][falsePositiveMask])],
|
||||
stacked=True, label=['True detection', 'False positive'], bins=15)
|
||||
ax.yaxis.get_major_locator().set_params(integer=True)
|
||||
ax.set_xlabel(r"DM (log pc cm$^3$)")
|
||||
ax.set_xlabel(r"DM (log pc cm$^{-3}$)")
|
||||
ax.legend(loc='upper center')
|
||||
ax2 = plt.subplot(17,1,(9,16))
|
||||
ax2.hist([np.log10(detections['pulseWidth'][matchMaskDet]), np.log10(detections['pulseWidth'][falsePositiveMask])],
|
||||
|
@ -230,7 +233,4 @@ plt.title("Detections")
|
|||
wordAx = plt.subplot(17,1,17)
|
||||
wordAx.text(.3,.5,f"False positive rate: {round(Counter(falsePositiveMask)[True]/(len(detections['dm']))*100,1)}%", size=14)
|
||||
wordAx.set_axis_off()
|
||||
plt.draw()
|
||||
|
||||
#block end of script
|
||||
plt.show()
|
||||
plt.savefig(os.path.join("out","detections.png"))
|
Loading…
Reference in a new issue