pik-copan / pyunicorn

Unified Complex Network and Recurrence Analysis Toolbox
http://pik-potsdam.de/~donges/pyunicorn/
Other
195 stars 87 forks source link

KeyError 'e' on Surrogates test_pearson_correlation #86

Closed robbisg closed 5 years ago

robbisg commented 7 years ago

Hi all,

I ran test_pearson_correlation as explained in the API docs.

s = Surrogates(data[0].T) 
surrogate = s.AAFT_surrogates(data[0].T)
r = Surrogates.SmallTestData().test_pearson_correlation(data[0].T, surrogate)
# I ran also r = s.test_pearson_correlation(data[0].T, surrogate) and I got the same!

I use weave 0.15.0 and I had the following backtrace.

KeyError                                  Traceback (most recent call last)
<ipython-input-505-ee14c2032a31> in <module>()
----> 1 r = Surrogates.SmallTestData().test_pearson_correlation(data[0].T, surrogate)

/usr/local/lib/python2.7/dist-packages/pyunicorn/timeseries/surrogates.pyc in test_pearson_correlation(self, original_data, surrogates, fast)
    810         if fast:
    811             weave.inline(fastCode, arg_names=args, compiler='gcc',
--> 812                          extra_compile_args=['-O3'])
    813         else:
    814             weave.inline(code, arg_names=args,

/usr/local/lib/python2.7/dist-packages/weave/inline_tools.pyc in inline(code, arg_names, local_dict, global_dict, force, compiler, verbose, support_code, headers, customize, type_converters, auto_downcast, newarr_converter, **kw)
    364                                     type_converters=type_converters,
    365                                     auto_downcast=auto_downcast,
--> 366                                     **kw)
    367 
    368             function_catalog.add_function(code,func,module_dir)

/usr/local/lib/python2.7/dist-packages/weave/inline_tools.pyc in compile_function(code, arg_names, local_dict, global_dict, module_dir, compiler, verbose, support_code, headers, customize, type_converters, auto_downcast, **kw)
    494     # setting.  All input keywords are passed through to distutils
    495     mod.compile(location=storage_dir,compiler=compiler,
--> 496                 verbose=verbose, **kw)
    497 
    498     # import the module and return the function.  Make sure

/usr/local/lib/python2.7/dist-packages/weave/ext_tools.pyc in compile(self, location, compiler, verbose, **kw)
    359         #self.set_compiler(compiler)
    360 
--> 361         kw,file = self.build_kw_and_file(location,kw)
    362 
    363         # This is needed so that files build correctly even when different

/usr/local/lib/python2.7/dist-packages/weave/ext_tools.pyc in build_kw_and_file(self, location, kw)
    340                                    info.extra_link_args()
    341         kw['sources'] = kw.get('sources',[]) + source_files
--> 342         file = self.generate_file(location=location)
    343         return kw,file
    344 

/usr/local/lib/python2.7/dist-packages/weave/ext_tools.pyc in generate_file(self, file_name, location)
    301 
    302     def generate_file(self,file_name="",location='.'):
--> 303         code = self.module_code()
    304         if not file_name:
    305             file_name = self.name + '.cpp'

/usr/local/lib/python2.7/dist-packages/weave/ext_tools.pyc in module_code(self)
    209             self.header_code(),
    210             self.support_code(),
--> 211             self.function_code(),
    212             self.python_function_definition_code(),
    213             self.module_init_code(),

/usr/local/lib/python2.7/dist-packages/weave/ext_tools.pyc in function_code(self)
    275         all_function_code = ""
    276         for func in self.functions:
--> 277             all_function_code += func.function_code()
    278         return ''.join(all_function_code) + '\n'
    279 

/usr/local/lib/python2.7/dist-packages/weave/inline_tools.pyc in function_code(self)
     83     def function_code(self):
     84         from .ext_tools import indent
---> 85         decl_code = indent(self.arg_declaration_code(),4)
     86         cleanup_code = indent(self.arg_cleanup_code(),4)
     87         function_code = indent(self.code_block,4)

/usr/local/lib/python2.7/dist-packages/weave/inline_tools.pyc in arg_declaration_code(self)
     68         """Return the declaration code as a string."""
     69         arg_strings = [arg.declaration_code(inline=1)
---> 70                        for arg in self.arg_specs]
     71         return "".join(arg_strings)
     72 

/usr/local/lib/python2.7/dist-packages/weave/standard_array_spec.pyc in declaration_code(self, templatize, inline)
    159 
    160     def declaration_code(self,templatize=0,inline=0):
--> 161         res = self.template_vars(inline=inline)
    162         cap_name = self.name.upper()
    163         res['cap_name'] = cap_name

/usr/local/lib/python2.7/dist-packages/weave/standard_array_spec.pyc in template_vars(self, inline)
    152         res = common_base_converter.template_vars(self,inline)
    153         if hasattr(self,'var_type'):
--> 154             res['num_type'] = num_to_c_types[self.var_type]
    155             res['num_typecode'] = num_typecode[self.var_type]
    156         res['array_name'] = self.name + "_array"

KeyError: 'e'
jdonges commented 7 years ago

Please check this.

jkroenke commented 5 years ago

This bug could not be reproduced and was probably solved in the migration process from python 2 to python 3.