示例#1
0
def test_sinusoid(weights,order=1):
    """ Calculate limits on (by default) sinusoidal modulation.  Higher
        harmonics are supported by the [order] kwarg."""
    p0 = lcprimitives.LCHarmonic(order=order)
    lct = lctemplate.LCTemplate([p0],[1])
    grid,vals = fill_grid(lct,weights)
    return grid,vals
示例#2
0
def test_eclipse(weights,frac=0.95,threshold=8):
    """ Find the narrowest eclipse (total modulation) width that can be
        detected (frac of the Monte Carlo trials exceeding
        threshold)."""
    width_grid = np.arange(0.05,1,0.05)
    stat_grid = np.empty_like(width_grid)
    n = 100
    idx = int(round((1-frac)*n))
    for i in xrange(len(width_grid)):
        p0 = lcprimitives.LCTopHat(p=[1-width_grid[i],0.5]) 
        lct = lctemplate.LCTemplate([p0],[1]) # 1 == full eclipse
        stats = get_stat_dist(lct,weights,hmw,n=n)
        stat_grid[i] = stats[idx]
    stat_grid = np.array([stat_grid]) # match shape expectation
    width = find_threshold(width_grid,stat_grid,threshold)
    return stat_grid[0],width
示例#3
0
def test_notch(weights,width=0.05):
    """ Test for a dropout of gamma-ray emission with a notch shape."""
    p0 = lcprimitives.LCTopHat(p=[1-width,0])
    lct = lctemplate.LCTemplate([p0],[1])
    grid,vals = fill_grid(lct,weights)
    return grid,vals