tritemio / FRETBursts

Burst analysis software for smFRET. **Moved to OpenSMFS organization**
https://github.com/OpenSMFS/FRETBursts
GNU General Public License v2.0
16 stars 17 forks source link

Error when selecting bursts with nofret=True #34

Closed chungjjang80 closed 8 years ago

chungjjang80 commented 8 years ago

After bursts selection with "nofret=True", the program doesn't show a histogram correctly in some cases. For example,
Case1)

ds=Sel(d, select_bursts.size, th1=50, nofret=True)
ds_FRET=Sel(ds, select_bursts.S, S1=0.3, S2=0.7, nofret=True)
hist_fret(ds)
hist_fret(ds_FRET)

Case2)

ds=Sel(d, select_bursts.size, th1=50, nofret=True)
hist_fret(ds)
ds_FRET=Sel(ds, select_bursts.S, S1=0.3, S2=0.7, nofret=True)
hist_fret(ds_FRET)

The program shows the right histograms in case1 but not in case2. With "nofret=False", the program always shows the histogram correctly.

tritemio commented 8 years ago

Thanks for the report, I confirm this is a bug in FRETBursts plotting, I'll fix it ASAP.

The root of the problem is that when selecting bursts and using nofret=True, the old fitter object is also copied and not recomputed. Then the caching in hist_data (called by hist_E and hist_S) is fooled and uses the old fitter data. The problem does not show up when selecting bursts and using nofret=False (the default).

Note that the bursts data (e.g. ds_FRET.E, ds_FRET.nd) is correct, only the plotted histogram is wrong.

As a workaround, before a fix is released, you can delete the old fitter objects manually before the new plot:

ds_FRET.delete('E_fitter')
ds_FRET.delete('S_fitter')
hist_fret(ds_FRET)