phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
76 stars 28 forks source link

Fitting and modeling rv #769

Closed JLE64315 closed 5 months ago

JLE64315 commented 11 months ago

I write a small code to fit and modeling rvc, so that, I have used mainly:

http://phoebe-project.org/docs/2.4/tutorials/RV_estimators

but when I do: print(b.adopt_solution('rv_geom_sol', trial_run=True)) ParameterSet: 6 parameters t0_supconj@binary@orbit@com...: 2458378.3764338 d q@binary@orbit@component: 1.1290389041433213 asini@binary@orbit@component: 57.788272734575344 solRad ecc@binary@orbit@component: 0.11236343171903222 per0@binary@orbit@component: 96.53880763374414 deg vgamma@system: 0.7967788027296319 km / s but if I do: print(b.get_value('ecc@binary@orbit@component')) write 0, why not 0.11...

¿How can I get the mass-minimum of both components, with the parameters obtained?

thank you, I have more questions, but maybe with the answer of this, I can resolve the rest.

amiszuda commented 11 months ago

The reason you're getting a default eccentricity value (i.e. ecc=0) is that you did not adopt the estimated value. You just trial-printed it to check what the estimates are. If you want to adopt these estimates you should b.adopt_solution('rv_geom_sol') without trial_run=True. As to the min-values of the masses, if you adopt the q estimate, the masses should automatically be recalculated, as they depend on various other parameters, e.g. the mass-ratio, the orbital period and asini.

JLE64315 commented 11 months ago

The reason you're getting a default eccentricity value (i.e. ecc=0) is that you did not adopt the estimated value. You just trial-printed it to check what the estimates are. If you want to adopt these estimates you should b.adopt_solution('rv_geom_sol') without trial_run=True. As to the min-values of the masses, if you adopt the q estimate, the masses should automatically be recalculated, as they depend on various other parameters, e.g. the mass-ratio, the orbital period and asini.

then, I get: ValueError: failed to pass checks Run Checks Report: FAIL ERROR: asini@binary@orbit@component is currently constrained but cannot automatically temporarily flip as solve_for has several options (sma@binary@orbit@component, incl@binary@orbit@component). Flip the constraint manually first, set adopt_values=False, or remove asini@binary@orbit@component from adopt_parameters. (3 affected parameters, affecting adopt_solution)

I add to the code: b.flip_constraint('asini@binary', solve_for='sma@binary')

and then I have a long message with more data: (AND NOT PLOT) runfile('/Users/javier/Documents/astrofisica/binarias/HD224151/phoebe3.py', wdir='/Users/javier/Documents/astrofisica/binarias/HD224151') Thu, 13 Jul 2023 13:05 PASSBANDS WARNING Online passbands unavailable (reached max tries). Pass refresh=True to force another attempt or repeat_errors=False to avoid showing this message. Thu, 13 Jul 2023 13:05 BUNDLE WARNING Atmosphere parameters out of bounds: ldatm=ck2004, teff=[6000.], logg=[5.26751145], abun=[0.] ParameterSet: 25 parameters t0_supconj@binary@component: 0.2866228000954071 d q@binary@component: 1.129460767096737 asini@binary@component: 57.788340160985626 solRad ecc@binary@component: 0.11236869971745425 per0@binary@component: 96.53618445944211 deg vgamma@system: 0.776998542813087 km / s C t0_perpass@binary@component: 0.47990128083797856 d C t0_ref@binary@component: 0.23624999185969206 d C compute_phases@rvs1@dataset: [] C mass@primary@component: 6.752177068528357 solMass C sma@primary@component: 30.6507938610493 solRad C asini@primary@component: 30.6507938610493 solRad C requiv_max@primary@component: 19.284396669173244 solRad C mass@secondary@component: 7.626319091393035 solMass C sma@secondary@component: 27.137546299936325 solRad C asini@secondary@component: 27.137546299936325 solRad C requiv_max@secondary@component: 20.416191491564145 solRad C sma@binary@component: 57.788340160985626 solRad C ecosw@binary@component: -0.012791004318490945 C esinw@binary@component: 0.11163832175698338 C mean_anom@binary@component: 347.1261787545587 deg C logg@primary@component: 5.2675114549356605 C logg@secondary@component: 5.320382604818586 C requivratio@binary@component: 1.0 C requivsumfrac@binary@component: 0.03460905771697957 Traceback (most recent call last):

File "/Users/javier/opt/anaconda3/envs/spyder/lib/python3.8/site-packages/phoebe/frontend/bundle.py", line 10320, in compute_ld_coeffs ld_coeffs = pb.interpolate_ldcoeffs(teff, logg, abun, ldcs, ld_func, photon_weighted)

File "/Users/javier/opt/anaconda3/envs/spyder/lib/python3.8/site-packages/phoebe/atmospheres/passbands.py", line 1844, in interpolate_ldcoeffs raise ValueError('Atmosphere parameters out of bounds: ldatm=%s, teff=%s, logg=%s, abun=%s' % (ldatm, req[:,0][nanmask], req[:,1][nanmask], req[:,2][nanmask]))

ValueError: Atmosphere parameters out of bounds: ldatm=ck2004, teff=[6000.], logg=[5.26751145], abun=[0.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/javier/Documents/astrofisica/binarias/HD224151/phoebe3.py", line 55, in b.run_compute()

File "/Users/javier/opt/anaconda3/envs/spyder/lib/python3.8/site-packages/phoebe/parameters/parameters.py", line 424, in _send_if_client return fctn(self, *args, **kwargs)

File "/Users/javier/opt/anaconda3/envs/spyder/lib/python3.8/site-packages/phoebe/frontend/bundle.py", line 11918, in run_compute self.compute_ld_coeffs(compute=compute, skip_checks=True, set_value=True, **{k:v for k,v in kwargs.items() if k in computeparams.qualifiers})

File "/Users/javier/opt/anaconda3/envs/spyder/lib/python3.8/site-packages/phoebe/frontend/bundle.py", line 10325, in compute_ld_coeffs raise ValueError("Could not lookup ld_coeffs for {}. Try changing ld_coeffs_source{} to a table that covers a sufficient range of values or set ld_mode{} to 'manual' and manually provide coefficients via ld_coeffs{}. Enable 'warning' logger to see out-of-bound arrays.".format(ldcs_param.twig, bol_suffix, bol_suffix, bol_suffix))

ValueError: Could not lookup ld_coeffs for ld_coeffs_source_bol@primary@star@component. Try changing ld_coeffs_source_bol to a table that covers a sufficient range of values or set ld_mode_bol to 'manual' and manually provide coefficients via ld_coeffs_bol. Enable 'warning' logger to see out-of-bound arrays.

¿What does it mean?

Thank very much.

amiszuda commented 11 months ago

Once you adopt these parameters, your bundle changes, and so does the physical properties of the stars. In this particular example the log g is out-of-bounds, as CK2004 tables cover models up to log g=5.0. One thing you can do is changing the atmospheres to, e.g. PHOENIX or blackbody, but these will require changing the options for limb darneking. Try following the tutorials on limb darkening (http://phoebe-project.org/docs/latest/tutorials/limb_darkening) and atmospheres (http://phoebe-project.org/docs/latest/tutorials/atm_passbands). Have fun :)

JLE64315 commented 11 months ago

Thank you very much. I'll let you know how I get on.

JLE64315 commented 11 months ago

Sorry, ¿How can I implement magnitudes in my code? or ¿Must be fluxes (W/m2)? In afirmative case, any module of python to do this conversion.

Thank you. nota: I remember Phoebe 0.2... had the option to use magnitudes or fluxes.

kecnry commented 11 months ago

phoebe 2 only supports fluxes (see this comment and the discussion for more details) - you'll need to convert your observations from magnitudes into fluxes if you want to compare or fit to them.

aprsa commented 5 months ago

This should really be a discussion, not an issue, so I'm closing this; if there are any lingering problems/concerns, please feel free to start a discussion.