hatzakislab / DeepFRET-GUI

GNU General Public License v3.0
9 stars 5 forks source link

Overwrites traces when exporting if trace names are not defined properly. #15

Open simonbonano opened 4 years ago

simonbonano commented 4 years ago

If you load a movie which name ends with ".tif" and the trace names are not defined, the function get_tracename() will name the traces like:

movie.tif_1 movie.tif_2 movie.tif_3 etc.

When exporting traces, the function export_trace_to_txt() will split the trace name at "." and replace the second part with ".txt" to ensure the right file extension:

movie.txt movie.txt movie.txt etc.

Thus the export names are all the same and the files will be overwritten. A quick fix to this issue is attached here as a screendump, however a more elegant solution should be implemented.

Skærmbillede 2020-09-08 kl  15 08 01

AI-rrr commented 4 years ago

we solved it a bit differently: """ Exports the trace to the file location specified by self.savename. :param dir_to_join: output directory, optional, passed to get_savename :param keep_nan_columns: Whether to keep columns that are nan, passed to get_export_txt """ savename = self.get_savename(dir_to_join=dir_to_join) if not savename.endswith(".txt"): savename = savename + ".txt"

    with open(savename, "w") as f:
        f.write(self.get_export_txt(keep_nan_columns=keep_nan_columns))