Skip to content

[WIP] Changes required for python 3 compatibility#23

Open
jchodera wants to merge 3 commits intomasterfrom
py3
Open

[WIP] Changes required for python 3 compatibility#23
jchodera wants to merge 3 commits intomasterfrom
py3

Conversation

@jchodera
Copy link
Member

Updating for python 3.x compatibility.

@jchodera
Copy link
Member Author

Hm, I'm running into:

the length of the elements is 3
{'N_scalingFactor': 0.79, 'Cl_scalingFactor': 0.8, 'HN_radius': 1.3, 'Br_scalingFactor': 0.8, 'I_scalingFactor': 0.8, 'Br_radius': 1.5, 'F_scalingFactor': 0.88, 'O_scalingFactor': 0.85, 'P_scalingFactor': 0.86, 'H_radius': 1.2, 'S_radius': 1.8, 'S_scalingFactor': 0.96, 'C_radius': 1.7, 'F_radius': 1.5, 'Si_scalingFactor': 0.8, 'H_scalingFactor': 0.85, 'I_radius': 1.5, 'P_radius': 1.85, 'N_radius': 1.55, 'O_radius': 1.5, 'C_scalingFactor': 0.72, 'Si_radius': 2.1, 'HN_scalingFactor': 0.85, 'Cl_radius': 1.7}
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/kombu/serialization.py", line 50, in _reraise_errors
    yield
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/kombu/utils/json.py", line 72, in dumps
    **dict(default_kwargs, **kwargs))
  File "/Users/choderaj/miniconda3/lib/python3.5/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/Users/choderaj/miniconda3/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Users/choderaj/miniconda3/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/kombu/utils/json.py", line 62, in default
    return super(JSONEncoder, self).default(o)
  File "/Users/choderaj/miniconda3/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: array(0.72) is not JSON serializable

@jchodera
Copy link
Member Author

I made the change required for celery 4's update to JSON, but am now running into:

lski1962:gbff.choderalab choderaj$ python parameterize-using-database.py --types parameters/gbsa-amber-mbondi2.types --parameters parameters/gbsa-amber-mbondi2.parameters --database $FREESOLV_PATH/database.pickle --iterations 500 --mcmcout MCMC --verbose --mol2 datasets/FreeSolv/FreeSolv/tripos_mol2 --subset 10
the length of the elements is 0
the length of the elements is 0
the length of the elements is 0
the length of the elements is 0
the length of the elements is 0
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
the length of the elements is 3
{'Si_scalingFactor': 0.8, 'Cl_scalingFactor': 0.8, 'N_radius': 1.55, 'C_radius': 1.7, 'HN_radius': 1.3, 'I_radius': 1.5, 'Br_radius': 1.5, 'O_radius': 1.5, 'C_scalingFactor': 0.72, 'S_scalingFactor': 0.96, 'F_scalingFactor': 0.88, 'P_scalingFactor': 0.86, 'Cl_radius': 1.7, 'H_radius': 1.2, 'Br_scalingFactor': 0.8, 'I_scalingFactor': 0.8, 'P_radius': 1.85, 'HN_scalingFactor': 0.85, 'H_scalingFactor': 0.85, 'O_scalingFactor': 0.85, 'F_radius': 1.5, 'S_radius': 1.8, 'N_scalingFactor': 0.79, 'Si_radius': 2.1}
Traceback (most recent call last):
  File "parameterize-using-database.py", line 149, in <module>
    obcmodel = model.GBFFAllModels(database, parameters, energytasks.celery_hydration_energies_factory, ngbmodels=3)
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/model.py", line 255, in __init__
    super(GBFFAllModels, self).__init__(database, initial_parameters, parameter_types, hydration_energy_factory)
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/model.py", line 35, in __init__
    self.model = self._create_bayesian_gbmodel(solvated_system_database, initial_parameters)
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/model.py", line 88, in _create_bayesian_gbmodel
    gbffmodel_with_mols = self._add_parallel_gbffmodel(database, gbffmodel)
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/model.py", line 182, in _add_parallel_gbffmodel
    gbffmodel['dg_gbsa'] = pymc.Deterministic(eval=hydration_energy_function, doc='ComputedDeltaG', name='dg_gbsa', parents=self.parameter_model, dtype=float, trace=True, verbose=1)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/pymc/PyMCObjects.py", line 443, in __init__
    verbose=verbose)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/pymc/Node.py", line 214, in __init__
    Node.__init__(self, doc, name, parents, cache_depth, verbose=verbose)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/pymc/Node.py", line 129, in __init__
    self.parents = parents
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/pymc/Node.py", line 147, in _set_parents
    self.gen_lazy_function()
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/pymc/PyMCObjects.py", line 454, in gen_lazy_function
    self._value.force_compute()
  File "LazyFunction.pyx", line 257, in pymc.LazyFunction.LazyFunction.force_compute (pymc/LazyFunction.c:2409)
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/hydration_energies/energytasks.py", line 322, in hydration_energies
    return compute_hydration_energies_celery(database, parameters, platform_name='CPU')
  File "/Users/choderaj/github/choderalab/gbff/gbff.choderalab/hydration_energies/energytasks.py", line 316, in compute_hydration_energies_celery
    energies = [float(energy) for energy in energy_group.get()]
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/celery/result.py", line 630, in get
    on_message=on_message,
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/celery/result.py", line 744, in join_native
    raise value
KeyError: 'molecule'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant