예제 #1
0
def process_experiment(_experiment, _overwrite=False):
    _arguments = [(_experiment, int(_series.split('_')[1]), _overwrite)
                  for _series in paths.image_files(paths.serieses(_experiment))
                  ]
    _p = Pool(CPUS_TO_USE)
    _p.starmap(process_series, _arguments)
    _p.close()
예제 #2
0
def process_experiment(_experiment, _overwrite=False):
    _arguments = []
    for _tuple in load.experiment_groups_as_tuples(_experiment):
        _experiment, _series_id, _group = _tuple
        _arguments.append((_experiment, _series_id, _group, _overwrite))

    _p = Pool(CPUS_TO_USE)
    _p.starmap(process_group, _arguments)
    _p.close()
예제 #3
0
def _phase_coherence(
    signal_pair: Tuple[TimeSeries, TimeSeries], params: PCParams
) -> Tuple[Tuple[TimeSeries, TimeSeries], ndarray, ndarray, ndarray, ndarray]:
    """
    Function which uses `wpc` to calculate phase coherence for a single pair of signals. The signals must have
    their wavelet transforms attached in their `output_data` member variable.

    :param signal_pair: tuple containing 2 signals
    :param params: the params object with parameters for the function
    :return:
    [tuple] the pair of signals;
    [2D array] the time-localised phase coherence;
    [1D array] phase coherence;
    [1D array] phase difference;
    [1D array] time-localised phase coherence of surrogates
    """
    s1, s2 = signal_pair

    wt1 = s1.output_data.values
    wt2 = s2.output_data.values

    freq = s1.output_data.freq
    fs = s1.frequency

    # Calculate surrogates.
    surr_count = params.surr_count
    surr_method = params.surr_method
    surr_preproc = params.surr_preproc
    surrogates, _ = surrogate_calc(s1, surr_count, surr_method, surr_preproc,
                                   fs)

    # Calculate surrogates.
    pool = Pool()
    args = [(wt1, surrogates[i], params) for i in range(surr_count)]
    tpc_surr = pool.starmap(_wt_surrogate_calc, args)

    if len(tpc_surr) > 0:
        tpc_surr = np.mean(tpc_surr, axis=0)

    # Calculate phase coherence.
    tpc, pc, pdiff = wpc(wt1, wt2, freq, fs)

    return signal_pair, tpc, pc, pdiff, tpc_surr
        ('SN20_Bleb_fromStart', 14, 0, 1, -235, 30),
        ('SN20_Bleb_fromStart', 14, 0, 2, 120, 230),
        ('SN20_Bleb_fromStart', 14, 0, 3, -230, 105),
        ('SN20_Bleb_fromStart', 14, 0, 4, 205, 35),
        ('SN20_Bleb_fromStart', 14, 1, 2, 110, -180),
        ('SN20_Bleb_fromStart', 14, 1, 3, -220, 25),
        ('SN20_Bleb_fromStart', 14, 1, 4, -150, 0),
        ('SN20_Bleb_fromStart', 14, 2, 3, 160, -130),
        ('SN20_Bleb_fromStart', 14, 2, 4, -75, 210),
        ('SN20_Bleb_fromStart', 14, 3, 4, 220, 105),
        ('SN20_Bleb_fromStart', 15, 0, 1, 0, 235),
        ('SN20_Bleb_fromStart', 16, 0, 1, 0, -225),
        ('SN20_Bleb_fromStart', 16, 0, 2, -80, 130),
        ('SN20_Bleb_fromStart', 16, 1, 2, -60, -120),
        ('SN20_Bleb_fromStart', 17, 0, 2, -180, 0),
        ('SN20_Bleb_fromStart', 17, 0, 3, 155, 0),
        ('SN20_Bleb_fromStart', 17, 1, 2, -225, -115),
        ('SN20_Bleb_fromStart', 17, 1, 3, -135, 20),
        ('SN20_Bleb_fromStart', 18, 0, 1, -110, -175),
        ('SN20_Bleb_fromStart', 19, 0, 1, 70, -150),
        ('SN20_Bleb_fromStart', 19, 1, 2, -100, 115),
        ('SN20_Bleb_fromStart', 19, 1, 3, 60, -170),
        ('SN20_Bleb_fromStart', 19, 2, 3, 135, 185),
        ('SN20_Bleb_fromStart', 20, 0, 1, 175, 20),
        ('SN20_Bleb_fromStart', 20, 0, 2, 205, -60),
        ('SN20_Bleb_fromStart', 20, 1, 2, -135, 80),
    ]
    _p = Pool(CPUS_TO_USE)
    _answers = _p.starmap(process_fake_following, _arguments)
    _p.close()