Lv3_detection_level.py
def signal_significance(N,M,W,Pthreshold):
    """
    Calculating the significance of a particular signal in the power spectrum,
    given M (number of segments), W (number of consecutive bins summed), and
    Pthreshold (the power [Leahy-normalized] of the signal).

    M - number of segments
    W - number of consecutive bins summed
    Pthreshold - the power of the signal (Leahy-normalized)
    """
    chi2 = M*W*Pthreshold
    dof = 2*M*W

    Q_chi2_dof = 1-stats.chi2.cdf(chi2,dof) #stats.chi2 is from 0 to chi2, so do the complement if we want chi2 to infinity
    ## Q(M*W*Pthreshold|2*M*W) ; where Q(chi^2|nu) = 1/[2^(nu/2)*Gamma(nu/2)] * \int_{chi^2}^\infty t^{nu/2 - 1} e^{-t/2} dt
    significance = special.erfinv(1-Q_chi2_dof*N)*np.sqrt(2)
    #print('The signal has a significance of ' + str(significance) + ' sigma.')
    #confidence_level = special.erf(significance/np.sqrt(2))*100
    return significance

    Calculating the significance of a particular signal in the power spectrum,
    given M (number of segments), W (number of consecutive bins summed), and
    Pthreshold (the power [Leahy-normalized] of the signal).

    M - number of segments
    W - number of consecutive bins summed
    Pthreshold - the power of the signal (Leahy-normalized)
    
Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal).

number of segments
W - number of consecutive bins summed
Pthreshold - the power of the signal (Leahy-normalized)
Calculating the significance of a particular signal in the power spectrum given M ( number of segments ) W ( number of consecutive bins summed ) and Pthreshold ( the power [ Leahy - normalized ] of the signal ) . number of segments W - number of consecutive bins summed Pthreshold - the power of the signal ( Leahy - normalized )
def signal_significance(N,M,W,Pthreshold):
    chi2 = M*W*Pthreshold
    dof = 2*M*W
    Q_chi2_dof = 1-stats.chi2.cdf(chi2,dof) 
    significance = special.erfinv(1-Q_chi2_dof*N)*np.sqrt(2)
    return significance
def signal_significance ( N , M , W , Pthreshold ) : chi2 = M * W * Pthreshold dof = 2 * M * W Q_chi2_dof = 1 - stats . chi2 . cdf ( chi2 , dof ) significance = special . erfinv ( 1 - Q_chi2_dof * N ) * np . sqrt ( 2 ) return significance
Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal).
Calculating the significance of a particular signal in the power spectrum given M ( number of segments ) W ( number of consecutive bins summed ) and Pthreshold ( the power [ Leahy - normalized ] of the signal ) .
"""
    Calculating the significance of a particular signal in the power spectrum,
    given M (number of segments), W (number of consecutive bins summed), and
    Pthreshold (the power [Leahy-normalized] of the signal).

    M - number of segments
    W - number of consecutive bins summed
    Pthreshold - the power of the signal (Leahy-normalized)
    """ #stats.chi2 is from 0 to chi2, so do the complement if we want chi2 to infinity ## Q(M*W*Pthreshold|2*M*W) ; where Q(chi^2|nu) = 1/[2^(nu/2)*Gamma(nu/2)] * \int_{chi^2}^\infty t^{nu/2 - 1} e^{-t/2} dt #print('The signal has a significance of ' + str(significance) + ' sigma.') #confidence_level = special.erf(significance/np.sqrt(2))*100
N
M
W
Pthreshold