---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-10-2f61fa542c74> in <module>
2 with pm.Model() as model:
3 h=pm.Uniform('h', lower=100, upper=1000)
----> 4 like = pm.DensityDist('like', lnlike, observed={'h': h})
5 trace = pm.sample(draws=100, cores=2, step=pm.Metropolis())
~/anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
44 total_size = kwargs.pop('total_size', None)
45 dist = cls.dist(*args, **kwargs)
---> 46 return model.Var(name, dist, data, total_size)
47 else:
48 raise TypeError("Name needs to be a string but got: {}".format(name))
~/anaconda3/lib/python3.7/site-packages/pymc3/model.py in Var(self, name, dist, data, total_size)
843 with self:
844 var = MultiObservedRV(name=name, data=data, distribution=dist,
--> 845 total_size=total_size, model=self)
846 self.observed_RVs.append(var)
847 if var.missing_values:
~/anaconda3/lib/python3.7/site-packages/pymc3/model.py in __init__(self, name, data, distribution, total_size, model)
1442 self.missing_values = [datum.missing_values for datum in self.data.values()
1443 if datum.missing_values is not None]
-> 1444 self.logp_elemwiset = distribution.logp(**self.data)
1445 # The logp might need scaling in minibatches.
1446 # This is done in `Factor`.
<ipython-input-9-fa5ba6237de9> in lnlike(h)
1 #@as_op(itypes=[tt.dscalar], otypes=[tt.dscalar])
2 def lnlike(h):
----> 3 vol=np.array(compute_volume(h))*domega
4 nsim=np.array(bin_in_five_subtypes(wispsim.SPGRID, (vol*interpolated_lf_values)))
5 #compute chi-square
<ipython-input-4-a338fa65093b> in compute_volume(h)
53 vls=[]
54 for l, b in lbs:
---> 55 vls.append(easy_non_integral_volume(l,b,dmin, dmax, h))
56 vs.append(np.nansum(vls))
57 return vs
<ipython-input-4-a338fa65093b> in easy_non_integral_volume(l, b, dmin, dmax, h)
28 rd=np.sqrt( (ds * np.cos( b ) )**2 + Rsun * (Rsun - 2 * ds * np.cos( b ) * np.cos( l ) ) )
29 zd=Zsun+ ds * np.sin( b - np.arctan( Zsun / Rsun) )
---> 30 rh0=density_function(rd, zd,h=h )
31 return np.nansum(rh0*ds**3)
32
<ipython-input-4-a338fa65093b> in density_function(r, z, h)
11 zpart=np.exp(-abs(z-Zsun)/h)
12 rpart=np.exp(-(r-Rsun)/l)
---> 13 return zpart*rpart
14
15 def custom_volume(l,b,dmin, dmax, h):
~/anaconda3/lib/python3.7/site-packages/theano/tensor/var.py in __mul__(self, other)
153 # and the return value in that case
154 try:
--> 155 return theano.tensor.mul(self, other)
156 except (NotImplementedError, AsTensorError):
157 return NotImplemented
~/anaconda3/lib/python3.7/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
668 # compute output value once with test inputs to validate graph
669 thunk = node.op.make_thunk(node, storage_map, compute_map,
--> 670 no_recycling=[])
671 thunk.inputs = [storage_map[v] for v in node.inputs]
672 thunk.outputs = [storage_map[v] for v in node.outputs]
~/anaconda3/lib/python3.7/site-packages/theano/gof/op.py in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
953 try:
954 return self.make_c_thunk(node, storage_map, compute_map,
--> 955 no_recycling)
956 except (NotImplementedError, utils.MethodNotDefined):
957 # We requested the c code, so don't catch the error.
~/anaconda3/lib/python3.7/site-packages/theano/gof/op.py in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
856 _logger.debug('Trying CLinker.make_thunk')
857 outputs = cl.make_thunk(input_storage=node_input_storage,
--> 858 output_storage=node_output_storage)
859 thunk, node_input_filters, node_output_filters = outputs
860
~/anaconda3/lib/python3.7/site-packages/theano/gof/cc.py in make_thunk(self, input_storage, output_storage, storage_map, keep_lock)
1215 cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
1216 input_storage, output_storage, storage_map,
-> 1217 keep_lock=keep_lock)
1218
1219 res = _CThunk(cthunk, init_tasks, tasks, error_storage, module)
~/anaconda3/lib/python3.7/site-packages/theano/gof/cc.py in __compile__(self, input_storage, output_storage, storage_map, keep_lock)
1155 output_storage,
1156 storage_map,
-> 1157 keep_lock=keep_lock)
1158 return (thunk,
1159 module,
~/anaconda3/lib/python3.7/site-packages/theano/gof/cc.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)
1622 node.op.prepare_node(node, storage_map, None, 'c')
1623 module = get_module_cache().module_from_key(
-> 1624 key=key, lnk=self, keep_lock=keep_lock)
1625
1626 vars = self.inputs + self.outputs + self.orphans
~/anaconda3/lib/python3.7/site-packages/theano/gof/cmodule.py in module_from_key(self, key, lnk, keep_lock)
1153 # Is the source code already in the cache?
1154 module_hash = get_module_hash(src_code, key)
-> 1155 module = self._get_from_hash(module_hash, key, keep_lock=keep_lock)
1156 if module is not None:
1157 return module
~/anaconda3/lib/python3.7/site-packages/theano/gof/cmodule.py in _get_from_hash(self, module_hash, key, keep_lock)
1063 if (key[0] and not key_broken and
1064 self.check_for_broken_eq):
-> 1065 self.check_key(key, key_data.key_pkl)
1066 self._update_mappings(key, key_data, module.__file__, check_in_keys=not key_broken)
1067 return module
~/anaconda3/lib/python3.7/site-packages/theano/gof/cmodule.py in check_key(self, key, key_pkl)
1267 # part of the key is not broken.
1268 for other in self.similar_keys.get(get_safe_part(key), []):
-> 1269 if other is not key and other == key and hash(other) != hash(key):
1270 raise AssertionError(
1271 "Found two keys that are equal but have a different hash. "
~/anaconda3/lib/python3.7/site-packages/theano/gof/utils.py in __eq__(self, other)
196 return (type(self) == type(other) and
197 tuple(getattr(self, a) for a in props) ==
--> 198 tuple(getattr(other, a) for a in props))
199 dct['__eq__'] = __eq__
200
KeyboardInterrupt: