Closed camarman closed 1 year ago
I'm not sure I can help/understand, it seems the question is more about simplemc than about dynesty. The docs on dynesty.plot are here https://dynesty.readthedocs.io/en/stable/api.html#module-dynesty.plotting and the demos https://github.com/joshspeagle/dynesty/tree/master/demos also have many examples of what dynesty.plot can do.
Thanks for the reply. I have done some tests, and it seems the problem is about SimpleMC. It's using an old and modified version of the dynesty.
For instance, the SimpleMC defines
sampler = NestedSampler(self.logLike, self.priorTransform, self.dims,
bound=nestedType, sample = 'unif', nlive = nlivepoints,
pool = pool, queue_size=nprocess, use_pool={'loglikelihood': False})
sampler.run_nested(dlogz=accuracy, outputname=self.outputpath,
addDerived=self.addDerived, simpleLike=self.L)
M = sampler.results
when I try to get importance_weights()
via print(M.importance_weights())
, SimpleMC complains;
return self[name]
~~~~^^^^^^
KeyError: 'importance_weights'
and
raise AttributeError(name)
AttributeError: importance_weights
Due to this error I cannot perform any plotting operations, since importance_weights()
is not defined in SimpleMC and it seems dyplot need that attribute for plotting.
I'm not sure I can help/understand
I am sorry about that. I have also realized that I wasn't clear enough. I was trying to ask if there is a feature in dynesty that I can import data from chains. By doing that, I thought I could perform the plotting operations in SimpleMC more easily.
It turns out that I can implement them easily, but now I am getting this error.
importance_weights is a new attribute introduced in recent version of dynesty. if you wish you can use dyplot from an older version.
if you want to make dyplot work with non-dynesty objects, something like this works fine
class Res:
def __init__(self, samples, whts):
self.D={}
self.D['samples'] = samples
self.whts = whts
def __getitem__(self,x):
return self.D[x]
def importance_weights(self):
return self.whts
whts=np.random.uniform(size=10000);
dyplot.cornerplot(Res(np.random.normal(size=(10000,2)),whts/whts.sum()))
I think you either should just use the released version of dynesty then I'll be happy to answer questions about it, but if you're using some modified version of dynesty, I don't think I can help.
if you wish you can use dyplot from an older version.
Thank you very much!! I have never thought installing the older version of the dynesty. Now, I can plot perfectly fine :)
I think you either should just use the released version of dynesty then I'll be happy to answer questions about it, but if you're using some modified version of dynesty, I don't think I can help.
Sadly, there's not much I can do since I am using another program (SimpleMC) to do the data analysis. I kind of contacted with the developers of the SimpleMC. Maybe they update in the future. Also, it seems they have modified the dynest somehow but I am not sure exactly how. Nevertheless, I have just run dyplot.cornerpoints
and dyplot.traceplot
without any problem.
Dynesty version I have installed SimpleMC, where dynesty is implemented into the program. It seems that they are using the dynesty version from 2 years ago.
Background
I can
triangle_plot
viagetdist
for nested sampling in SimpleMC by using the following steps:First obtaining the
samples
from SimpleMC for a given config:(where
DriverMC
andexecuter
belongs to SimpleMC.) Later on, I can definesamples
viaMCSamples
and plot anything viagetdist
The full example can be seen from here.
Your question
1) Is there a similar procedure that I can follow so that I use
dyplot
?or
2) Is there a way to use
dyplot
by using these files types obtained from SimpleMC ?