Extracting time and light curve and flux #811
Replies: 3 comments 1 reply
-
The error message is telling you that you need to specify whether you want to get the times from the input dataset or the output model, since the information you passed to |
Beta Was this translation helpful? Give feedback.
-
Thanks, it worked but how can i save both times and fluxes in same file? I have made attempts, code ran but it is not saving. Can you please see? |
Beta Was this translation helpful? Give feedback.
-
thanks it worked |
Beta Was this translation helpful? Give feedback.
-
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
phoebe.update_all_passbands()
b.set_value('atm@primary',value='phoenix')
b.set_value('atm@secondary',value='phoenix')
#Initialize parameters
b.set_value('vgamma@system', 0.0)
b.set_value('requiv@primary@component', 0.2522)
b.set_value('teff@primary@component', 3100)
b.set_value('syncpar@primary@component',1.006)
b.set_value('gravb_bol@primary@component', 0.2)
b.set_value('irrad_frac_refl_bol@primary@component',0.5)
b.set_value('requiv@secondary@component',0.2417)
b.set_value('teff@secondary@component',3075)
b.set_value('syncpar@secondary@component',1.006)
b.set_value('gravb_bol@secondary@component',0.2)
b.set_value('irrad_frac_refl_bol@secondary@component',0.5)
b.set_value('period@binary@component',1.268390155)
b.set_value('per0@binary@component',125.307667)
b.set_value('dperdt@binary@component',0.0)
b.set_value('ecc@binary@component',0.0030)
b.set_value('t0_supconj@binary@component', 2458753.880746)
b.set_value('incl@binary@component', 89.59)
b.set_value('q@binary@component',0.93059)
b.set_value('sma@binary@component',3.7664)
b.set_value('t0@system',2458753.880746)
array=np.linspace(0,1.268390155,100)
b.add_dataset('lc', times=array, dataset='light'
, columns=['teffs'],overwrite=True)
b.add_feature('spot', component='primary', feature='spot01')
b.add_spot(component='secondary', feature='spot02')
b.set_value(qualifier='relteff', feature='spot01', value=0.96)
b.set_value(qualifier='radius', feature='spot01', value=35)
b.set_value(qualifier='colat', feature='spot01', value=90)
b.set_value(qualifier='long', feature='spot01', value=140)
b.run_compute( irrad_method='none', model='with_spot')
afig,mplfig=b.plot(show=True)
i want to extract the time and flux from this model and save it in a txt file. can anyone say me how to do it?
i tried via :print(b.get_parameter(qualifier='times'))
but i am getting this error:
ValueError Traceback (most recent call last)
/var/folders/jh/rmpks59s1pqf1m0f89q19zxh0000gp/T/ipykernel_68970/3010599603.py in ?()
----> 1 print(b.get_parameter(qualifier='times'))
~/mambaforge/lib/python3.10/site-packages/phoebe/parameters/parameters.py in ?(self, twig, **kwargs)
3009 -------
3010 * ValueError: if either 0 or more than 1 results are found
3011 matching the search.
3012 """
-> 3013 return self.get(twig=twig, **kwargs)
~/mambaforge/lib/python3.10/site-packages/phoebe/parameters/parameters.py in ?(self, twig, check_visible, check_default, check_advanced, check_single, **kwargs)
2659 # TODO: custom exception?
2660 raise ValueError("0 results found for twig: '{}', {}".format(twig, kwargs))
2661 elif len(ps) != 1:
2662 # TODO: custom exception?
-> 2663 raise ValueError("{} results found: {}".format(len(ps), ps.twigs))
2664 else:
2665 # then only 1 item, so return the parameter
2666 return ps._params[0]
ValueError: 2 results found: ['times@light@lc@dataset', 'times@light@phoebe01@with_spot@lc@model']
[ ]:
Beta Was this translation helpful? Give feedback.
All reactions