コード例 #1
0
# background intensity fitting
bg_fit = mat.fitting_linear(np.arange(0, len(bg_int_tseries), 1),
                            bg_int_tseries)
pointer_pd = dat.add_columns(
    pointer_pd,
    ['bg_linear_fit', 'bg_linear_r2', 'bg_linear_a', 'bg_linear_b'],
    [[bg_fit[0]] * len(pointer_pd), [bg_fit[1]] * len(pointer_pd),
     [bg_fit[2]] * len(pointer_pd), [bg_fit[3]] * len(pointer_pd)])

# background correction
# use original measurement if fitting does not exist
if np.isnan(bg_fit[2]):
    bg = bg_int_tseries
else:
    bg = bg_fit[0]
pointer_pd['bg_cor_int'] = ana.bg_correction(pointer_pd['raw_int'], bg)
ctrl_pd['bg_cor_int'] = ana.bg_correction(ctrl_pd['raw_int'], bg)

# filter control traces
filter_ctrl = []
for i in range(len(ctrl_pd)):
    ctrl_int = ctrl_pd['bg_cor_int'][i]
    print(max(ctrl_int))
    print(min(ctrl_int))
    if (max(ctrl_int) - min(ctrl_int)) / max(ctrl_int) > 0.4:
        filter_ctrl.append(0)
        print(0)
    else:
        filter_ctrl.append(1)
        print(1)
ctrl_pd['filter'] = filter_ctrl
        # background intensity fitting
        bg_fit = mat.fitting_linear(np.arange(0, len(bg_int_tseries), 1),
                                    bg_int_tseries)
        pointer_pd = dat.add_columns(
            pointer_pd,
            ['bg_linear_fit', 'bg_linear_r2', 'bg_linear_a', 'bg_linear_b'],
            [[bg_fit[0]] * len(pointer_pd), [bg_fit[1]] * len(pointer_pd),
             [bg_fit[2]] * len(pointer_pd), [bg_fit[3]] * len(pointer_pd)])

        # background correction
        # use original measurement if fitting does not exist
        if np.isnan(bg_fit[2]):
            bg = bg_int_tseries
        else:
            bg = bg_fit[0]
        pointer_pd['bg_cor_int'] = ana.bg_correction(pointer_pd['raw_int'],
                                                     [bg] * len(pointer_pd))
        ctrl_pd['bg_cor_int'] = ana.bg_correction(ctrl_pd['raw_int'],
                                                  [bg] * len(ctrl_pd))

        # filter control traces
        ctrl_pd_ft = ble.filter_ctrl(ctrl_pd)
        pointer_pd['num_ctrl_spots_ft'] = [len(ctrl_pd_ft)] * len(pointer_pd)
        data_log['num_ctrl_spots'] = len(ctrl_pd_ft)

        print("### Image analysis: photobleaching correction ...")
        # photobleaching factor calculation
        if len(ctrl_pd_ft) != 0:
            pointer_pd = ble.frap_pb_correction(pointer_pd, ctrl_pd_ft)
            # normalize frap curve and measure mobile fraction and t-half based on curve itself
            frap_pd = ble.frap_analysis(pointer_pd, max_t,
                                        acquire_time_tseries, real_time,
コード例 #3
0
# background intensity fitting
bg_fit = mat.fitting_linear(np.arange(0, len(bg_int_tseries), 1),
                            bg_int_tseries)
pointer_pd = dat.add_columns(
    pointer_pd,
    ['bg_linear_fit', 'bg_linear_r2', 'bg_linear_a', 'bg_linear_b'],
    [[bg_fit[0]] * len(pointer_pd), [bg_fit[1]] * len(pointer_pd),
     [bg_fit[2]] * len(pointer_pd), [bg_fit[3]] * len(pointer_pd)])

# background correction
# use original measurement if fitting does not exist
if np.isnan(bg_fit[2]):
    bg = bg_int_tseries
else:
    bg = bg_fit[0]
pointer_pd['bg_cor_int'] = ana.bg_correction(pointer_pd['raw_int'],
                                             [bg] * len(pointer_pd))
ctrl_pd['bg_cor_int'] = ana.bg_correction(ctrl_pd['raw_int'],
                                          [bg] * len(ctrl_pd))

if analyze_organelle == 'nucleoli':
    pointer_nuclear_bg_pd = pointer_pd[
        pointer_pd['nuclear_bg_int'] != 'na'].copy().reset_index()
    pointer_nuclear_bg_pd['bg_cor_int'] = ana.bg_correction(
        pointer_nuclear_bg_pd['raw_int'],
        pointer_nuclear_bg_pd['nuclear_bg_int'])
    ctrl_nuclear_bg_pd = ctrl_pd[
        ctrl_pd['nuclear_bg_int'] != 'na'].copy().reset_index()
    ctrl_nuclear_bg_pd['bg_cor_int'] = ana.bg_correction(
        ctrl_nuclear_bg_pd['raw_int'], ctrl_nuclear_bg_pd['nuclear_bg_int'])

# filter control traces