Пример #1
0
def pipeline_seg2(st, segment, cfile=None, vys_timeout=vys_timeout_default):
    """ Submit pipeline processing of a single segment to scheduler.
    No multi-threading or scheduling.
    """

    # plan fft
    wisdom = search.set_wisdom(st.npixx, st.npixy)

    data = source.read_segment(st, segment, timeout=vys_timeout, cfile=cfile)
    data_prep = source.data_prep(st, data)

    for dmind in range(len(st.dmarr)):
        delay = util.calc_delay(st.freq, st.freq.max(), st.dmarr[dmind],
                                st.inttime)
        data_dm = search.dedisperse(data_prep, delay)

        for dtind in range(len(st.dtarr)):
            data_dmdt = search.resample(data_dm, st.dtarr[dtind])
            canddatalist = search.search_thresh(st,
                                                data_dmdt,
                                                segment,
                                                dmind,
                                                dtind,
                                                wisdom=wisdom)

            features = candidates.calc_features(canddatalist)
            search.save_cands(st, features, canddatalist)
Пример #2
0
def pipeline_dataprep(st, candloc):
    """ Prepare (read, cal, flag) data for a given state and candloc.
    """

    segment, candint, dmind, dtind, beamnum = candloc.astype(int)

    # prep data
    data = source.read_segment(st, segment)
    data_prep = source.data_prep(st, data)

    return data_prep
Пример #3
0
def pipeline_dataprep(st, candloc):
    """ Prepare (read, cal, flag) data for a given state and candloc.
    """

    segment, candint, dmind, dtind, beamnum = candloc

    # propagate through to new candcollection
    st.prefs.segmenttimes = st._segmenttimes.tolist()

    # prep data
    data = source.read_segment(st, segment)
    flagversion = "rtpipe" if hasattr(st, "rtpipe_version") else "latest"
    data_prep = source.data_prep(st, segment, data, flagversion=flagversion)

    return data_prep
Пример #4
0
def prep_and_search(st, segment, data, devicenum=None):
    """ Bundles prep and search functions to improve performance in distributed.
    """

    data = source.data_prep(st, segment, data)

    if st.prefs.fftmode == "cuda":
        candcollection = search.dedisperse_search_cuda(st, segment, data, devicenum)
    elif st.prefs.fftmode == "fftw":
        candcollection = search.dedisperse_search_fftw(st, segment, data)
    else:
        logger.warn("fftmode {0} not recognized (cuda, fftw allowed)"
                    .format(st.prefs.fftmode))

    return candcollection
Пример #5
0
def pipeline_dataprep(st, candloc):
    """ Prepare (read, cal, flag) data for a given state and candloc.
    """

    from rfpipe import source

    segment, candint, dmind, dtind, beamnum = candloc

    # propagate through to new candcollection
    st.prefs.segmenttimes = st._segmenttimes.tolist()

    # prep data
    data = source.read_segment(st, segment)
    flagversion = "rtpipe" if hasattr(st, "rtpipe_version") else "latest"
    data_prep = source.data_prep(st, segment, data, flagversion=flagversion)

    return data_prep
Пример #6
0
def prep_and_search(st, segment, data, devicenum=None, returnsoltime=False):
    """ Bundles prep and search functions to improve performance in distributed.
    devicenum refers to GPU device for search.
    returnsoltime is option for data_prep to return solution time too.
    """

    from rfpipe import source, search, reproduce, candidates

    ret = source.data_prep(st, segment, data, returnsoltime=returnsoltime)
    if returnsoltime:
        data, soltime = ret
    else:
        data = ret
        soltime = None

    if st.prefs.fftmode == "cuda":
        candcollection = search.dedisperse_search_cuda(st,
                                                       segment,
                                                       data,
                                                       devicenum=devicenum)
    elif st.prefs.fftmode == "fftw":
        candcollection = search.dedisperse_search_fftw(st, segment, data)
    else:
        logger.warning(
            "fftmode {0} not recognized (cuda, fftw allowed)".format(
                st.prefs.fftmode))
        return

    # calc other features for cc, plot, save


#    if len(st.features):
    if st.prefs.savecandcollection or st.prefs.saveplots or st.prefs.returncanddata:
        # or not all([f in candcollection.array.dtype.fields for f in st.features]):
        candcollection = reproduce.reproduce_candcollection(candcollection,
                                                            data=data)

    candcollection.soltime = soltime

    candidates.save_cands(st, candcollection)

    return candcollection
Пример #7
0
def prep_and_search(st, segment, data, devicenum=None):
    """ Bundles prep and search functions to improve performance in distributed.
    """

    from rfpipe import source, search

    data = source.data_prep(st, segment, data)
    # TODO: implement   returnsoltime=True

    if st.prefs.fftmode == "cuda":
        candcollection = search.dedisperse_search_cuda(st, segment, data,
                                                       devicenum=devicenum)
    elif st.prefs.fftmode == "fftw":
        candcollection = search.dedisperse_search_fftw(st, segment, data)
    else:
        logger.warning("fftmode {0} not recognized (cuda, fftw allowed)"
                       .format(st.prefs.fftmode))

    # TODO: attach telcal solution time as mjd to candcollection
    return candcollection
        i for i in [integration0 - 1, integration0, integration0 + 1]
        if i >= 0 and i < st.nints
    ]
    dms = [
        dm for dm in [dmind0 - 1, dmind0, dmind0 + 1]
        if dm >= 0 and dm < len(st.dmarr)
    ]
    mocklocs = []
    for i in integrations:
        for dm in dms:
            mocklocs.append((segment, i, dm, dtind0, 0))

#     mockloc = (segment, integration0, dmind0, dtind0, 0)
    logger.info(f'Injecting mock transient with parameters:{mock[0]}')
    data = source.read_segment(st, segment)
    data = source.data_prep(st, segment, data)
    if not np.any(
            data):  # Should fix: TypeError: can't convert complex to float
        logger.info('Data is all zeros or empty. Trying a new injection.')
#         continue

    logger.info(
        f'Trying to find the injected transient at mocklocs: {mocklocs}')
    cds = []
    snrs = []
    for mockloc in mocklocs:
        data_corr = reproduce.pipeline_datacorrect(st, mockloc, data_prep=data)
        cd_t = reproduce.pipeline_canddata(st, mockloc, data_corr)
        cds.append(cd_t)
        snrs.append(cd_t.snr1)