Open DAyres31 opened 3 months ago
What version of matplotlib do you have installed? We are tracking a number of compatibility issues with matplotlib 3.5.2 or later so it may be worth trying to downgrade to a version older than that.
I have version 3.9.0 currently. Is there a specific version that is recommended for use with phoebe?
Can you please try with matplotlib 3.5.1 and let us know if that solves the problem? If so, I'll add this to the list and will probably just officially exclude new matplotlib in the requirements until we can go through and make all the necessary updates.
Thanks!
I am trying to gain familiarity with PHOEBE in order to use this package for future projects. In doing so I am following along the example code and ran into an issue with properly plotting the lc_geometry solver portion. I try running this code and get the following error "ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part." Now I am assuming this has to do with the way the solver is working but am not quite sure. I'd appreciate any advice on how to fix this issue.
Code: import matplotlib.pyplot as plt
plt.rc('font', family='serif', size=14, serif='STIXGeneral') plt.rc('mathtext', fontset='stix') import phoebe import numpy as np
logger = phoebe.logger('error')
we'll set the random seed so that the noise model is reproducible
np.random.seed(123456789) print("Code works up to here (checkpoint 1)",end ='\n')
begin stage 2 of inverse problem follow along
b = phoebe.default_binary() b.set_value('ecc', 0.2) b.set_value('per0', 25) b.set_value('teff@primary', 7000) b.set_value('teff@secondary', 6000) b.set_value('sma@binary', 7) b.set_value('incl@binary', 80) b.set_value('q', 0.3) b.set_value('t0_supconj', 0.1) b.set_value('requiv@primary', 2.0) b.set_value('vgamma', 80)
lctimes = phoebe.linspace(0, 10, 1005) rvtimes = phoebe.linspace(0, 10, 105) b.add_dataset('lc', compute_times=lctimes) b.add_dataset('rv', compute_times=rvtimes)
b.add_compute('ellc', compute='fastcompute') b.set_value_all('ld_mode', 'lookup') b.run_compute(compute='fastcompute')
fluxes = b.get_value('fluxes@model') + np.random.normal(size=lctimes.shape) 0.01 fsigmas = np.ones_like(lctimes) 0.02
rvsA = b.get_value('rvs@primary@model') + np.random.normal(size=rvtimes.shape) 10 rvsB = b.get_value('rvs@secondary@model') + np.random.normal(size=rvtimes.shape) 10 rvsigmas = np.ones_like(rvtimes) * 20 print("Code works up to here (checkpoint 2)",end ='\n')
begin step 3 of the inverse problem (Establishing parameters and building data)
b = phoebe.default_binary()
b.set_value('latex_repr', component='binary', value='orb') b.set_value('latex_repr', component='primary', value='1') b.set_value('latex_repr', component='secondary', value='2')
b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,201), times=lctimes, fluxes=fluxes, sigmas=fsigmas, dataset='lc01')
b.add_dataset('rv', compute_phases=phoebe.linspace(0,1,201), times=rvtimes, rvs={'primary': rvsA, 'secondary': rvsB}, sigmas=rvsigmas, dataset='rv01')
b.set_value_all('ld_mode', 'lookup') afig, mplfig = b.plot(x='phases', show=True) print("Code works up to here (checkpoint 3)",end ='\n')
start section 4 of the example (RV geometry solver)
b.add_solver('estimator.rv_geometry', rv_datasets='rv01', solver='rvgeom_solver') b.run_solver(kind='rv_geometry', solution='rv_geom_sol') print(b.adopt_solution('rv_geom_sol', trial_run=True)) afig, mplfig = b.plot(solution='rv_geom_sol', show=True, save='figure_rv_geometry.pdf') print("Code works up to here (checkpoint 4)", end = '\n')
start section 5 of the inverse problem example (LC geometry solver)
b.add_solver('estimator.lc_geometry', lc_datasets='lc01', solver='lcgeom_solver') b.run_solver(solver='lcgeom_solver', solution='lc_geom_sol') print(b.adopt_solution('lc_geom_sol', trial_run=True))
afig, mplfig = b.plot(solution = 'lc_geom_sol', show=True, save='figure_lc_geometry.pdf') print("Code works up to here (checkpoint 5)",end = "\n") b.adopt_solution('lc_geom_sol', adopt_parameters='mask_phases')