A bug in Data may result in FRET or S histograms plots not to change after performing a second burst search on the same object (but no burst selection).
Many thanks to Danielis Rutkauskas for reporting this bug and providing an example notebook to reproduce it.
Steps to reproduce
In FRETBursts (up to version 0.5.9 included) the following steps reproduce the bug:
d.burst_search(F=6)
dplot(d, hist_fret)
[FRET histogram plot]
d.burst_search(F=12) # change some parameter
dplot(d, hist_fret)
[FRET histogram plot does not change]
Notes:
Although the second histogram plot is wrong, the data in d.E and d.S (and all the other burst attributes d.mburst, d.nd, d.na, etc...) is correct.
This bug does not affect the common workflow where burst selection is performed and the plot is performed on the object containing the bursts selection.
This bug does not affect fitting of FRET/S histograms when the fitter object is created by the user using bext.burst_fitter() as indicated in the docs.
Workaround
The easiest workaround is to reload the data each time you want to compare FRET or S histograms from different burst searches with no burst selection.
A second workaround that does not require reloading the data is replacing the FRET hist command:
dplot(d, hist_fret)
with:
if hasattr(d, 'E_fitter'): delattr(d, 'E_fitter')
dplot(d, hist_fret)
similarly the S hist command should be:
if hasattr(d, 'S_fitter'): delattr(d, 'S_fitter')
dplot(d, hist_S)
This bug will be fixed in FRETBursts version 0.6 and above.
Internal details
The bug is due to the incorrect handling of E_fitter and S_fitter attributes in Data. The Data object inherits from dict and all its attributes are also dictionary entries. The only exception are the E_fitter and S_fitter attributes that are not part of the dictionary and therefore are not copied when performing burst selection or Data.copy(). The fitter objects compute the FRET and S histograms (as well as computing the fitting and KDE).
When calling hist_fret or hist_S, new E_fitter or S_fitter attributes are created if not present. When the fitter attribute is already present (as in subsequent plots on the same objects) and other histograms parameters are not changes then the old object is used.
When performing a new burst search, the old E_fitter and S_fitter attributes should be deleted but they are not. This results in subsequent calls of the same plot to use the old histogram data.
Summary
A bug in
Data
may result in FRET or S histograms plots not to change after performing a second burst search on the same object (but no burst selection).Many thanks to Danielis Rutkauskas for reporting this bug and providing an example notebook to reproduce it.
Steps to reproduce
In FRETBursts (up to version 0.5.9 included) the following steps reproduce the bug:
Notes:
Although the second histogram plot is wrong, the data in
d.E
andd.S
(and all the other burst attributesd.mburst
,d.nd
,d.na
, etc...) is correct.This bug does not affect the common workflow where burst selection is performed and the plot is performed on the object containing the bursts selection.
This bug does not affect fitting of FRET/S histograms when the fitter object is created by the user using
bext.burst_fitter()
as indicated in the docs.Workaround
The easiest workaround is to reload the data each time you want to compare FRET or S histograms from different burst searches with no burst selection.
A second workaround that does not require reloading the data is replacing the FRET hist command:
with:
similarly the S hist command should be:
This bug will be fixed in FRETBursts version 0.6 and above.
Internal details
The bug is due to the incorrect handling of
E_fitter
andS_fitter
attributes inData
. TheData
object inherits fromdict
and all its attributes are also dictionary entries. The only exception are theE_fitter
andS_fitter
attributes that are not part of the dictionary and therefore are not copied when performing burst selection orData.copy()
. The fitter objects compute the FRET and S histograms (as well as computing the fitting and KDE).When calling
hist_fret
orhist_S
, newE_fitter
orS_fitter
attributes are created if not present. When the fitter attribute is already present (as in subsequent plots on the same objects) and other histograms parameters are not changes then the old object is used.When performing a new burst search, the old
E_fitter
andS_fitter
attributes should be deleted but they are not. This results in subsequent calls of the same plot to use the old histogram data.