Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tutorial "Solver: The Inverse Problem", incomplete plot #31

Open
carlo-hue opened this issue Sep 10, 2023 · 1 comment
Open

tutorial "Solver: The Inverse Problem", incomplete plot #31

carlo-hue opened this issue Sep 10, 2023 · 1 comment

Comments

@carlo-hue
Copy link

HI,

I'm studying Phebe using the tutorials available on the phoebe website, really complete and well done!
Probably also due to my lack of experience with Python and Phoebe, I have some problems....

Following the tutorial "Solvers: The Inverse Problem", I copied in my file the instructions whic I report at the bottom (CODE 1)

After executing the plot instruction, I received the message: "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" and the resulting graph does not contain any vertical lines around the minimum, neither dashed nor solid

Continuing with instrucions:
print(b.adopt_solution(trial_run=True))
print(b.adopt_solution())

while the tutorial continues without errors, I receive the ERR1 message, which I report at the bottom

Then I've done flipping:
b.get_parameter(qualifier='requivsumfrac', component='binary', context='constraint')
b.flip_constraint('requivsumfrac', solve_for='sma@binary@component')

b.get_parameter(qualifier='teffratio', component='binary', context='constraint')
b.flip_constraint('teffratio', solve_for='teff@primary@component')

and the adopt function works but the plot remains unchanged (without vertical lines....)

Requests:

  • am I doing something wrong?
  • the tutorial refers to a different version from the one I downloaded (I have 2.4.11). In this case, how can I get the complete plot?

thanks!
Carlo

CODE1
import phoebe
from phoebe import u # units
import numpy as np
logger = phoebe.logger()
print(phoebe.list_available_solvers())

b = phoebe.default_binary()
b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,101))
b.run_compute(irrad_method='none')

times = b.get_value('times', context='model')
fluxes = b.get_value('fluxes', context='model') + np.random.normal(size=times.shape) * 0.01
sigmas = np.ones_like(times) * 0.02

b = phoebe.default_binary()
b.add_dataset('lc', times=times, fluxes=fluxes, sigmas=np.full_like(fluxes, fill_value=0.1))

b.add_solver('estimator.lc_geometry', solver='my_lcgeom_solver')
print(b.get_solver(solver='my_lcgeom_solver'))
b.run_solver(solver='my_lcgeom_solver', solution='my_lcgeom_solution')
_ = b.plot(solution='my_lcgeom_solution', show=True)

ERR1
ERROR: requivsumfrac@binary@orbit@component is currently constrained but cannot automatically temporarily flip as solve_for has several options (requiv@primary@star@component, requiv@secondary@star@component, sma@binary@orbit@component). Flip the constraint manually first, set adopt_values=False, or remove requivsumfrac@binary@orbit@component from adopt_parameters. (3 affected parameters, affecting adopt_solution)
ERROR: teffratio@binary@orbit@component is currently constrained but cannot automatically temporarily flip as solve_for has several options (teff@secondary@star@component, teff@primary@star@component). Flip the constraint manually first, set adopt_values=False, or remove teffratio@binary@orbit@component from adopt_parameters. (3 affected parameters, affecting adopt_solution)

@carlo-hue carlo-hue changed the title tutorial Solver:The Invere Problem, plot incomplete tutorial Solver: The Inverse Problem, incomplete plot Sep 10, 2023
@carlo-hue carlo-hue changed the title tutorial Solver: The Inverse Problem, incomplete plot tutorial "Solver: The Inverse Problem", incomplete plot Sep 10, 2023
@kecnry kecnry transferred this issue from phoebe-project/phoebe2-ui Sep 11, 2023
@kecnry
Copy link
Member

kecnry commented Sep 11, 2023

It looks like we forgot to update this tutorial after a recent release to account for new options in flipping these constraints. I moved this issue to the docs repository and will leave it open until we get a chance to update that tutorial.

If you follow the instructions in the error message, it should be able to adopt the solution, and I'm hoping that might also fix the error you were getting while attempting to plot. For more details on the concept of constraints and how to manually flip them, see the constraints tutorial. In short, the lcgeom solver is proposing values for the sum of fractional radii and temperature ratio, but those parameters are currently "read only" and so you need to choose which of the parameters that are mathematically tied to them should remain fixed and which should update as phoebe adopts those proposed values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants