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
Hello, I am having an issue trying to plot the fit of radial velocities only when (rv) GPs are involved.
While trying to replicate the example in Juliet's documentation:
# Define minimum and maximum times to evaluate the model on:min_time, max_time=np.min(dataset.times_rv['FEROS'])-30,\
np.max(dataset.times_rv['FEROS'])+30# Create model times on which we will evaluate the model:model_times=np.linspace(min_time,max_time,5000)
# Extract full model and components of the RV model:full_model, components=results.rv.evaluate('FEROS', t=model_times, GPregressors=model_times, return_components=True)
importmatplotlib.pyplotaspltinstruments= ['HARPS','FEROS']
colors= ['red','black']
fig=plt.figure(figsize=(10,4))
forinstrument,colorinzip (instruments,colors):
plt.errorbar(dataset.times_rv[instrument]-2454705,dataset.data_rv[instrument] -components['mu'][instrument], \
yerr=dataset.errors_rv[instrument], fmt='o', label=instrument+' data',mfc='white', mec=color, ecolor=color, \
elinewidth=1)
plt.plot(model_times-2454705,full_model-components['mu']['FEROS'],label='Full model',color='black')
plt.plot(model_times-2454705,results.rv.model['deterministic'],label='Keplerian component', color='steelblue')
plt.plot(model_times-2454705,results.rv.model['GP'], label='GP component',color='red')
plt.xlim([3701,3715])
plt.ylabel('Radial velocity (m/s)')
plt.xlabel('Time (BJD - 2454705)')
plt.legend(ncol=2)
I get the following error:
---------------------------------------------------------------------------IndexErrorTraceback (mostrecentcalllast)
<ipython-input-41-2ae74457e435>in<module>910# Extract full model and components of the RV model:--->11full_model, components=results.rv.evaluate('FEROS', t=model_times, GPregressors=model_times, return_components=True)
1213importmatplotlib.pyplotaspltD:\anaconda3\lib\site-packages\juliet\fit.pyinevaluate_model(self, instrument, parameter_values, resampling, nresampling, etresampling, all_samples, nsamples, return_samples, t, GPregressors, LMregressors, return_err, alpha, return_components, evaluate_transit)
2388else:
2389->2390x=self.evaluate_model(instrument=instrument, parameter_values=self.posteriors, resampling=resampling, \
2391nresampling=nresampling, etresampling=etresampling, all_samples=all_samples, \
2392nsamples=nsamples, return_samples=return_samples, t=t, GPregressors=GPregressors, \
D:\anaconda3\lib\site-packages\juliet\fit.pyinevaluate_model(self, instrument, parameter_values, resampling, nresampling, etresampling, all_samples, nsamples, return_samples, t, GPregressors, LMregressors, return_err, alpha, return_components, evaluate_transit)
2116self.generate_lc_model(current_parameter_values, evaluate_lc=True)
2117else:
->2118self.generate_rv_model(current_parameter_values, evaluate_global_errors=True)
21192120# Save residuals (and global errors, in the case of global models):D:\anaconda3\lib\site-packages\juliet\fit.pyingenerate_rv_model(self, parameter_values, evaluate_global_errors)
1802self.model['global'][self.instrument_indexes[instrument]] =self.model[instrument]['deterministic']
1803ifevaluate_global_errors:
->1804self.model['global_variances'][self.instrument_indexes[instrument]] =self.yerr[self.instrument_indexes[instrument]]**2+ \
1805parameter_values['sigma_w_'+instrument]**21806IndexError: index59isoutofboundsforaxis0withsize59
It looks like the error is related to GPregressors, but of course the evaluation can't be done without it.
The text was updated successfully, but these errors were encountered:
I have found out that, with a GP model, everytime results.rv.evaluate() is called the "results" are updated and this makes it impossible to call the function again (if for example one is trying to plot points from two or more instruments, or if one is trying to make more than one plot using results.rv.evaluate).
P.S. Even more strange is that this error can't be bypassed by making a copy of "results" (dataset.fit) because the copy also gets overwritten after results.rv.evaluate() is called.
Yes, this is actually not a desirable output of calling the evaluate method for sure, and is in my to-do to look at. I hope to have it fixed for the next juliet version; will thus leave this open for now!
Thanks for bringing this up with such a detailed report!
Finally got to this -- fixed on dev. Will be on the next juliet version --- but users that need this/find this problem can go and install the dev version.
Hello, I am having an issue trying to plot the fit of radial velocities only when (rv) GPs are involved.
While trying to replicate the example in Juliet's documentation:
I get the following error:
It looks like the error is related to GPregressors, but of course the evaluation can't be done without it.
The text was updated successfully, but these errors were encountered: