salilab / bayesian_hdx

Support code for HDX data reduction
GNU Lesser General Public License v2.1
3 stars 3 forks source link

Using function pow instead of ^ operator #6

Closed r78v10a07 closed 4 years ago

r78v10a07 commented 4 years ago

the ^ operator does not work in python 3.6

Fragment start_res end_res exp_grid Traceback (most recent call last): File "/usr/local/bayesian_hdx/examples/workbench_executable.py", line 128, in init = init) File "/usr/local/bayesian_hdx/pyext/src/hdx_models.py", line 81, in init self.guess_init_exp_sequence(5) File "/usr/local/bayesian_hdx/pyext/src/hdx_models.py", line 203, in guess_init_exp_sequence f.exp_vals = sampling.enumerate_fragment(f, exp_grid, 2.0, num_models = 1) File "/usr/local/bayesian_hdx/pyext/src/sampling.py", line 576, in enumerate_fragment minscore = 1.0*10^34 TypeError: unsupported operand type(s) for ^: 'float' and 'int'

benmwebb commented 4 years ago

^ doesn't work as intended in any version of Python that I'm aware of (it has always been bitwise XOR, not exponentiation). It just doesn't raise an error in Python 2.

Your fix looks good to me and I'll merge it.