unibe-cns / NEAT

NEAT (NEural Analysis Toolkit)
Other
12 stars 15 forks source link

Fix two bugs related to pickle #129

Closed NeoNeuron closed 3 years ago

NeoNeuron commented 3 years ago
  1. FitTreeGF.setImpedancesInTree() function fail to pickle if self.path does not exists. Following error raised:

    FileNotFoundError: [Errno 2] No such file or directory: 'data/GF_sequence_discrimination_atRest__eh=-75.00.p'

    Fixation: Add dir existence detection and create one if it does not exist.

  2. Nested classes defined in examples/sequence_discrimination.py cannot be pickled. Following error raised:

    
    Traceback (most recent call last):
    File "neat/tools/fittools/compartmentfitter.py", line 230, in setImpedancesInTree
    tree = pickle.load(file)
    EOFError: Ran out of input

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "sequence_discrimination.py", line 284, in plotSim(delta_ts=[0.]) File "sequence_discrimination.py", line 218, in plotSim ctree = c_fit.fitModel(fit_locs, recompute=recompute) File "neat/tools/fittools/compartmentfitter.py", line 1155, in fitModel self.fitPassive(recompute=recompute, pprint=pprint, File "neat/tools/fittools/compartmentfitter.py", line 616, in fitPassive fit_tree.setImpedancesInTree(recompute=recompute, pprint=pprint) File "neat/tools/fittools/compartmentfitter.py", line 243, in setImpedancesInTree pickle.dump(self, file) AttributeError: Can't pickle local object 'plotSim..BrancoSimTree'


Fixation: Move class definition outside of the definition of function.
WillemWybo commented 3 years ago

@NeoNeuron Thanks much for these bug fixes!