Skip to content

Commit 43bd931

Browse files
committed
Fix on the MCMC chains outputs)
1 parent 02aa5ed commit 43bd931

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

examples/pyLIMA_example_1.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@
145145
# the parameters.
146146
### Let's fit again using MCMC. This might take some time ...
147147

148-
my_fit5 = MCMC_fit.MCMCfit(fspl)
149-
my_fit5.model_parameters_guess = guess_parameters
150-
my_fit5.fit()
148+
my_fit5 = MCMC_fit.MCMCfit(fspl,rescale_photometry=True)
151149

150+
my_fit5.model_parameters_guess = guess_parameters[:4]
151+
my_fit5.fit()
152+
my_fit5.fit_outputs()
152153
### Now your MCMC run is complete. Congratulations!
153154
### You can now plot the chains and explore how they evolve for each parameter.
154155
### For example, to see how the chains for u0 evolve, do:

pyLIMA/fits/MCMC_fit.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,12 @@ def reconstruct_chains(self, mcmc_samples, mcmc_prob):
268268
columns_to_swap += self.rescale_photometry_parameters_index
269269

270270
if self.rescale_astrometry:
271-
columns_to_swap += self.rescale_photometry_parameters_index
271+
columns_to_swap += self.rescale_astrometry_parameters_index
272272

273273
if (columns_to_swap != []):
274274

275275
old_column = columns_to_swap
276-
new_column = np.arange(old_column[-1]+1,Rangej-1,1).tolist()
277-
276+
new_column = np.arange(old_column[-1]+1,Rangej,1).tolist()
278277
MCMC_chains_with_fluxes[:, :, old_column + new_column] = MCMC_chains_with_fluxes[:, :,new_column +old_column]
279278

280279
#MCMC_chains[:,:,-1] = np.copy(MCMC_chains_with_fluxes[:,:,-1])

pyLIMA/outputs/file_outputs.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,12 @@ def json_output(fit_object,json_name='./pyLIMA_fit.json'):
3939

4040
elif (key == 'MCMC_chains_with_fluxes'):
4141

42-
header = [key for key in fit_object.priors_parameters.keys()] +[
43-
'priors',
44-
fit_object.loss_function ]
42+
header = [key for key in fit_object.priors_parameters.keys()]
4543
distributions_to_output[key] = [tosave,header]
4644

4745
elif (key == 'DE_population'):
4846

4947
header = [key for key in fit_object.priors_parameters.keys()]
50-
5148
distributions_to_output[key] = [tosave,header]
5249

5350
else:

0 commit comments

Comments
 (0)