Back to the main page.

Bug 1452 - all functions should explicitly create a new output-structure

Status ASSIGNED
Reported 2012-05-02 15:55:00 +0200
Modified 2014-11-12 16:57:37 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Roemer van der Meij
URL:
Tags:
Depends on:
Blocks:
See also: http://bugzilla.fcdonders.nl/show_bug.cgi?id=2513

Roemer van der Meij - 2012-05-02 15:55:13 +0200

This is safer and cleaner than editing fields from the input-structure, and using that as output. And example situation is two comparable functions, ft_freqbaseline, and ft_timelockbaseline. The latter edits the input-structure, the former creates a fresh output-structure. If fields are implicitly kept by not removing them in the above, the consequences are difficult to oversee, and in the worst case might lead to accidentally using numerically incorrect information in subsequent analysis. Not just by the users themselves, but also by our code, assuming things that shouldn't be assumed. By making a fresh output-structure, and thus explicitly only keeping fields that are relevant and fit the analysis we prevent mistakes like above, at the costs of errors/bugs when data-structures change. (this bug is the result of a discussion at the ft-meeting relating to [[bugzilla:1448]])


Roemer van der Meij - 2012-05-02 15:57:46 +0200

At the moment the idea is to look for functions that have the same input as output argument, that should at least find many of the functions that need be changed (but some will be missed).


Robert Oostenveld - 2012-05-02 18:02:04 +0200

The best example for the discrepancy is in ft_freqbaseline which explicitly starts with a new freq, versus ft_timelockbaseline which modifies the input timelock and then discards some fields at the end.


Arjen Stolk - 2014-11-12 16:57:37 +0100

@roemer, forgive my ignorance, is this bug still actual?