You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry just a question about saving the results with naima.
When the particle distribution are saved as a metadata blob as
electron_e = np.logspace(11, 15, 100) * u.eV
electron_dist = ECPL(electron_e)
# The first object returned must be the model photon spectrum, and
# subsequent objects will be stored as metadata blobs
return IC(data), (electron_e, electron_dist), We
it plots the electron distribution versus electron energy. Is there any way to
save spectrum with best parameters in a ascii file, for example:
electron_e electron_dist
$$$$ $$$$$
$$$$ $$$$$
....... .........
Thank you in advance
The text was updated successfully, but these errors were encountered:
@astrolog1986 - There is a function in the plot module that allows you to obtain this sort of information, but currently it is only used used internally. The function is naima.plot.find_ML. The function takes a sampler and lets you specify the index of the blob for which you want to obtain the ML (maximum likelihood) value. For your example above, the index would be 1. This how you can use it (I assume a sampler that has already been run stored in the variable sampler):
ML: The value of the loglikelihood for the returned model (which is the highest among all the samples).
ML_params: A tuple of the parameters that result in the maximum likelihood.
ML_err: A 1-sigma estimate of the confidence interval for each of the parameters considering all the samples.
ML_model: The model corresponding to the highest likelihood. The shape of this variable will always be (model_energy, model_value), and corresponds to the values saved in the metadata blobs.
It might be worthwile to have a high-level function that does this and only returns the metadata blob of interest, so I'll keep the issue open and rename it to add that function.
zblz
changed the title
saving the results with naima
Add a function to get a best-fit metadata blob
Jan 26, 2017
Hi,
Sorry just a question about saving the results with naima.
When the particle distribution are saved as a metadata blob as
electron_e = np.logspace(11, 15, 100) * u.eV
electron_dist = ECPL(electron_e)
it plots the electron distribution versus electron energy. Is there any way to
save spectrum with best parameters in a ascii file, for example:
electron_e electron_dist
$$$$ $$$$$
$$$$ $$$$$
....... .........
Thank you in advance
The text was updated successfully, but these errors were encountered: