Пример #1
0
def compute_shutter(band,trange,verbose=0,retries=20,shutgap=0.05,
    timestamplist=False):
    try:
        t = (timestamplist if np.array(timestamplist).any() else
                np.array(gQuery.getArray(
                    gQuery.uniquetimes(band,trange[0],trange[1],flag=True),
                        verbose=verbose),dtype='float64')[:,0]/gQuery.tscale)
    except IndexError: # Shutter this whole time range.
        return trange[1]-trange[0]
    t = np.sort(np.unique(np.append(t,trange)))
    ix = np.where(t[1:]-t[:-1]>=shutgap)
    return np.array(t[1:]-t[:-1])[ix].sum()
Пример #2
0
def exposure(band,trange,verbose=0,retries=20):
    rawexpt = trange[1]-trange[0]
    if rawexpt==0.:
        return 0.
    try:
        t = np.array(gQuery.getArray(
                gQuery.uniquetimes(band,trange[0],trange[1],flag=True),
                verbose=verbose),dtype='float64')[:,0]/gQuery.tscale
    except IndexError: # Shutter this whole time range.
        if verbose:
            print 'No data in {t0},{t1}'.format(t0=trange[0],t1=trange[1])
        return 0
    shutter = compute_shutter(band,trange,verbose=verbose,retries=retries,
                              timestamplist=t)
    deadtime = empirical_deadtime(band,trange,verbose=verbose,retries=retries,
                                  timestamplist=t)
    return (rawexpt-shutter)*(1.-deadtime)
Пример #3
0
def globalcount_shuttered(band,trange,verbose=0,timestamplist=False):
    try:
        t = (timestamplist if np.array(timestamplist).any() else
                np.array(gQuery.getArray(
                    gQuery.uniquetimes(band,trange[0],trange[1],flag=True),
                        verbose=verbose),dtype='float64')[:,0]/gQuery.tscale)
    except IndexError: # Shutter this whole time range.
        if verbose:
            print 'No data in {t0},{t1}'.format(t0=trange[0],t1=trange[1])
        return 0
    times = np.sort(np.unique(np.append(t,trange)))
    tranges = distinct_tranges(times,maxgap=0.05)
    nonnullevents,nullevents = 0,0
    for trange in tranges:
        nullevents += gQuery.getValue(
                    gQuery.deadtime2(band,trange[0],trange[1]),verbose=verbose)
        nonnullevents += gQuery.getValue(gQuery.deadtime1(band,trange[0],
                                        trange[1]),verbose=verbose)

    return nullevents+nonnullevents
Пример #4
0
def stimcount_shuttered(band,trange,verbose=0,retries=20.,timestamplist=False):
    try:
        t = (timestamplist if np.array(timestamplist).any() else
                np.array(gQuery.getArray(
                    gQuery.uniquetimes(band,trange[0],trange[1]),
                        verbose=verbose),dtype='float64')[:,0]/gQuery.tscale)
    except IndexError: # Shutter this whole time range.
        if verbose:
            print 'No data in {t0},{t1}'.format(t0=trange[0],t1=trange[1])
        return 0

    times = np.sort(np.unique(np.append(t,trange)))
    tranges = distinct_tranges(times,maxgap=0.05)
    stimcount = 0
    for trange in tranges:
        stimcount += gQuery.getValue(gQuery.stimcount(band,trange[0],trange[1]),
                                        verbose=verbose)+gQuery.getValue(
                                     gQuery.stimcount(band,trange[0],trange[1],
                                        null=False),verbose=verbose)
    return stimcount
Пример #5
0
def compute_shutter(band,trange,verbose=0,retries=20,shutgap=0.05):
    t = np.sort(np.array(gQuery.getArray(gQuery.uniquetimes(
        band,trange[0],trange[1])),dtype='float64')[:,0]/gQuery.tscale)
    ix = np.where(t[1:]-t[:-1]>=shutgap)
    return len(ix[0])*shutgap