コード例 #1
0
ファイル: test_import.py プロジェクト: agustrionopj/phoebe2
def _export(filename, plot=False):
    """
    this isn't run during testing, but should be edited to run on certain versions
    of phoebe to then store the .phoebe file in this directory and ensure it can
    be imported later
    """


    if LooseVersion(phoebe.__version__) >= LooseVersion("2.2"):
       raise ImportError("script runs on PHOEBE 2.1.x")
       exit()

    b = phoebe.default_binary()
    # TESS:default was renamed to TESS:T in 2.2
    b.add_dataset('lc', times=np.linspace(0,1,11), passband='TESS:default')
    b.add_dataset('rv', times=phoebe.linspace(0,1,4))
    b.add_dataset('lp', times=phoebe.linspace(0,1,4), wavelengths=np.linspace(500,510,51))
    b.add_dataset('mesh', times=[0])

    b.run_compute()

    if plot:
        b.plot(show=True, time=0)

    b.save(os.path.join(dir, filename))
コード例 #2
0
def get_binary_flux_kepler(teff1, teff2, q, ecc):
    base_flux = get_flux_value_kepler(teff1)
    b = phoebe.default_binary()
    b.set_value('q', value=q)
    b.set_value('ecc', value=ecc)
    b.set_value('teff', component='primary', value=teff1)
    #    b.set_value('r',component='secondary',value=0.5)
    b.set_value('teff', component='secondary', value=teff2)
    b.set_value(
        'q', value=0.75
    )  #b.add_compute('lc',atm@primary='ck2004',atm@second='ck2004')
    b.add_dataset('lc',
                  dataset='lc01',
                  atm='blackbody',
                  ld_func='interp',
                  times=phoebe.linspace(0, 2, 101),
                  passband='Kepler:mean',
                  intens_weighting='energy')
    #    b.add_dataset('lc',dataset='lc01',ld_func='interp',times = phoebe.linspace(0,1,101),passband='Kepler:mean',intens_weighting='energy')
    b.run_compute(irrad_method='none')
    #    b['lc01@model'].plot(x='phases',c='blue')
    #    b.savefig('lc_kepler.eps')
    times1 = b['value@times@lc01@latest@model']
    fluxes1 = b['value@fluxes@lc01@latest@model'] * base_flux
    return times1, fluxes1
コード例 #3
0
ファイル: test_l3.py プロジェクト: alex-w/phoebe2
def test_binary(plot=False, gen_comp=False):
    b = phoebe.Bundle.default_binary()

    b.add_dataset('lc', times=phoebe.linspace(0, 1, 21))
    b.add_compute('phoebe', irrad_method='none', compute='phoebe2')
    if gen_comp:
        b.add_compute('legacy', refl_num=0, compute='phoebe1')

    # set matching atmospheres
    b.set_value_all('atm', 'extern_planckint')

    # set matching limb-darkening, both bolometric and passband
    b.set_value_all('ld_mode_bol', 'manual')
    b.set_value_all('ld_func_bol', 'linear')
    b.set_value_all('ld_coeffs_bol', [0.0])

    b.set_value_all('ld_mode', 'manual')
    b.set_value_all('ld_func', 'linear')
    b.set_value_all('ld_coeffs', [0.0])
    # b.set_value_all('ecc', 0.2)

    #turn off albedos (legacy requirement)
    b.set_value_all('irrad_frac_refl_bol', 0.0)

    b.set_value('l3', 0.5)
    b.set_value('l3_frac', 0.2, check_visible=False)

    for l3_mode in ['flux', 'fraction']:
        if plot: print("l3_mode={}".format(l3_mode))
        b.set_value('l3_mode', l3_mode)

        if plot: print("running phoebe2 model...")
        b.run_compute(compute='phoebe2', model='phoebe2model', overwrite=True)
        if gen_comp:
            if plot: print("running phoebe1 model...")
            b.run_compute(compute='phoebe1',
                          model='phoebe1model',
                          overwrite=True)
            b.filter(model='phoebe1model').save(
                'test_l3_{}.comp.model'.format(l3_mode))
        else:
            b.import_model(os.path.join(
                os.path.dirname(__file__),
                'test_l3_{}.comp.model'.format(l3_mode)),
                           model='phoebe1model',
                           overwrite=True)

        phoebe2_val = b.get_value('fluxes@phoebe2model')
        phoebe1_val = b.get_value('fluxes@phoebe1model')

        if plot:
            b.plot(dataset='lc01', show=True, legend=True)

            print("max (rel):",
                  abs((phoebe2_val - phoebe1_val) / phoebe1_val).max())

        assert (np.allclose(phoebe2_val, phoebe1_val, rtol=5e-3, atol=0.))

    return b
コード例 #4
0
ファイル: text_extinction.py プロジェクト: renlliang3/phoebe2
def test_binary(plot=False):
    b = phoebe.Bundle.default_binary()

    b.add_dataset('lc', times=phoebe.linspace(0, 1, 21))

    b.set_value('Av', 0.2)
    b.flip_constraint('ebv', solve_for='Av')
    b.set_value('ebv', 0.25)

    # enable and implement assertions once extinction tables are available
    # b.run_compute(irrad_method='none')

    return b
コード例 #5
0
def run_comparison_models(b):
    b.add_compute('legacy')
    b.add_compute('ellc', rv_method='flux-weighted')
    # for jktebop, we'll use requiv_max_limit=1.0 to allow the semi-detached case to run
    b.add_compute('jktebop', requiv_max_limit=1.0)
    
    b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,1001))
    b.add_dataset('rv', compute_phases=phoebe.linspace(0,1,1001))
    
    if True:
        b.set_value_all('irrad_method', 'none')  # if not using this, then we need to use dynamical RVs for ellc
    else:
        b.set_value_all('rv_method', kind='ellc', value='dynamical')
          
    b.set_value_all('pblum_method', 'phoebe')
    
    b.set_value_all('ld_mode', 'lookup')
    b.set_value_all('ld_func', 'linear')
    
    b.run_compute(kind='phoebe', model='phoebe2_model', ntriangles=3000)
    b.run_compute(kind='legacy', model='phoebe1_model', gridsize=60)
    b.run_compute(kind='ellc', model='ellc_model')
    b.run_compute(kind='jktebop', model='jktebop_model')
    return b
コード例 #6
0
def get_foreground_flux_tess(teff, d):
    base_flux = get_flux_value_tess(teff)
    d0 = 1
    #kepler passband flux
    star_pb1 = phoebe.default_star()
    star_pb1.set_value('teff', value=teff)
    star_pb1.add_dataset('lc',
                         dataset='lc01',
                         atm='blackbody',
                         ld_func='interp',
                         times=phoebe.linspace(0, 2, 101),
                         passband='TESS:default',
                         intens_weighting='energy')
    #    star_pb1.add_dataset('lc',dataset='lc01',ld_func='interp',times = phoebe.linspace(0,1,101),passband='TESS:default',intens_weighting='energy')
    star_pb1.run_compute(irrad_method='none')
    star_pb1_flux = star_pb1['value@fluxes@lc01@latest@model'] * (
        d0 / d)**2 * base_flux
    return star_pb1_flux
コード例 #7
0
print(b.filter(qualifier=['t0_supconj', 't0_perpass']))

# ## Contribution to Light Curves
#
# At 18 degrees/day and an (anomalistic) orbital period of 1 day, we can expect to see a 90 degree precession over 5 cycles of the data.  So let's first set the anomalistic period by flipping the constraint and setting its value and then create 5 different LC and ORB datasets (so that we can plot each separately or as a different color).

# In[16]:

b.flip_constraint('period_anom', solve_for='period')
b.set_value('period_anom', 1.0)

# In[17]:

for i in range(5):
    b.add_dataset('lc', compute_phases=phoebe.linspace(i, i + 1, 101))
    b.add_dataset('orb', compute_phases=phoebe.linspace(i, i + 1, 101))

# Since we really only care about the precession for this toy-case, we'll save ourselves some time by disabling irradiation.  Both irradiation and distortion (we'll leave distortion so that we can better see the ellipsoidal variations near periastron) can be expensive, particularly in eccentric systems.

# In[18]:

b.run_compute(irrad_method='none')

# If we plot our synthetic light curves in phase-space, we can see the result of the precession on the timings (and depths) of the eclipses.  Note that, by default, plotting in phases will use the sidereal `period` and `t0_supconj`.  Here the first eclipse (at `time=t0_supconj=0`) will be defined at `phase=0`, and then the rest of the light curve is folded based on the sidereal `period`.  This allows us to see the separation between eclipses lengthen (and eventually they would shorten) over time.

# In[19]:

_ = b.plot(kind='lc', x='phases', show=True, legend=True)

# To instead phase by the anomalistic period, we can pass `period='period_anom'` to the plot call.  (Note that these are being passed to [b.to_phase](../api/phoebe.frontend.bundle.Bundle.to_phase.md) under-the-hood).  Now we see the eclipses occur earlier and earlier with each cycle, with respect to the phase of periastron.
コード例 #8
0
b['gravb_bol@primary'] = 1.0
b['teff@secondary'] = 5200
b['gravb_bol@secondary'] = 0.32

b['q@binary'] = 0.96 / 1.8
b['incl@binary'] = 88

b['period@binary'] = 1.0
b['sma@binary'] = 6.0

#
# We'll add [lc](./LC.ipynb), [rv](./RV.ipynb), and [mesh](./MESH.ipynb) datasets so that we can see how they're each affected by boosting.

# In[4]:

times = phoebe.linspace(0, 1, 101)

# In[5]:

b.add_dataset('lc', times=times, dataset='lc01')

# In[6]:

b.add_dataset('rv', times=times, dataset='rv01')

# In[7]:

b.add_dataset('mesh',
              times=[0.6],
              dataset='mesh01',
              columns=['boost_factors@lc01'])
コード例 #9
0
# In[3]:

b.add_spot(component='primary',
           relteff=0.90,
           long=0,
           colat=90,
           radius=20,
           feature='spot01')

# Adding Datasets
# -------------------

# In[4]:

b.add_dataset('lc', compute_times=phoebe.linspace(-0.1, 0.1, 201))

# Because we have such a cool transiting object, we'll have to use blackbody atmospheres and manually provide limb-darkening.

# In[5]:

b.set_value(qualifier='atm', component='secondary', value='blackbody')
b.set_value(qualifier='ld_mode', component='secondary', value='func_provided')

# In[6]:

anim_times = phoebe.linspace(-0.1, 0.1, 101)

# In[7]:

b.add_dataset('mesh',
コード例 #10
0
logger = phoebe.logger()

b = phoebe.default_binary()


# Dataset Parameters
# --------------------------

# Line profiles have an extra dimension than [LC](LC.ipynb) and [RV](RV.ipynb) datasets which have times as their independent variable.  For that reason, the parameters in the LP dataset are tagged with individual times instead of having a separate times array.  This allows the flux_densities and sigmas to be per-time.  Because of this, `times` is not a parameter, but instead **must** be passed when you call [b.add_dataset](../api/phoebe.frontend.bundle.Bundle.add_dataset.md) if you want to attach actual line-profile data (`flux_densities`) to your dataset.  At that point, in order to change the times you would need to remove and re-add the dataset.  If you only want to compute synthetic line profiles, use `compute_times` or `compute_phases` instead.
# 
# Let's add a line profile dataset to the Bundle (see also the [lp API docs](../api/phoebe.parameters.dataset.lp.md)).  Some parameters are only visible based on the values of other parameters, so we'll pass `check_visible=False` (see the [filter API docs](../api/phoebe.parameters.ParameterSet.filter.md) for more details).  These visibility rules will be explained below.

# In[3]:


b.add_dataset('lp', times=[0,1,2], wavelengths=phoebe.linspace(549, 551, 101))
print(b.get_dataset(kind='lp', check_visible=False))


# For information on the included passband-dependent parameters (not mentioned below), see the section on the [lc dataset](LC.ipynb).

# ### times

# In[4]:


print(b.get_dataset(kind='lp').times)


# ### compute_times / compute_phases
# 
コード例 #11
0
ファイル: ORB.py プロジェクト: 591704553/phoebe2-docs

print(b.get_parameter(qualifier='ltte'))


# The `ltte` parameter sets whether light travel time effects (Roemer delay) are included.  If set to False, the positions and velocities are returned as they actually are for that given object at that given time.  If set to True, they are instead returned as they were or will be when their light reaches the origin of the coordinate system.
# 
# See the [ltte tutorial](../ltte.ipynb) as well as the [Systemic Velocity Example Script](../examples/vgamma.ipynb) for an example of how 'ltte' and 'vgamma' (systemic velocity) interplay.

# Synthetics
# ------------------

# In[11]:


b.set_value_all('compute_times', phoebe.linspace(0,3,201))


# In[12]:


b.run_compute()


# In[13]:


print(b.filter(context='model').twigs)


# In[14]:
コード例 #12
0
# As always, let's do imports and create a new Bundle.  See [Building a System](building_a_system.ipynb) for more details.

# In[1]:


import phoebe
from phoebe import u # units

b = phoebe.default_binary()


# In[2]:


b.add_dataset('lc', times=phoebe.linspace(0,10,101), dataset='lc01')


# Overriding Computation Times
# ----------------------------
# 
# If `compute_times` is not empty (by either providing `compute_times` *or* `compute_phases`), the provided value will be used to compute the model instead of those in the `times` parameter.
# 
# In the case of a [mesh dataset](MESH.ipynb) or [orbit dataset](ORB.ipynb), observations cannot be attached to the dataset, so a `times` parameter does not exist.  In this case `compute_times` or `compute_phases` will *always* be used.

# In[3]:


print(b.filter(qualifier=['times', 'compute_times'], context='dataset'))

コード例 #13
0
logger = phoebe.logger()

b = phoebe.default_binary()

# Dataset Parameters
# --------------------------

# Line profiles have an extra dimension than [LC](LC.ipynb) and [RV](RV.ipynb) datasets which have times as their independent variable.  For that reason, the parameters in the LP dataset are tagged with individual times instead of having a separate times array.  This allows the flux_densities and sigmas to be per-time.  Because of this, `times` is not a parameter, but instead **must** be passed when you call [b.add_dataset](../api/phoebe.frontend.bundle.Bundle.add_dataset.md) if you want to attach actual line-profile data (`flux_densities`) to your dataset.  At that point, in order to change the times you would need to remove and re-add the dataset.  If you only want to compute synthetic line profiles, use `compute_times` or `compute_phases` instead.
#
# Let's add a line profile dataset to the Bundle (see also the [lp API docs](../api/phoebe.parameters.dataset.lp.md)).  Some parameters are only visible based on the values of other parameters, so we'll pass `check_visible=False` (see the [filter API docs](../api/phoebe.parameters.ParameterSet.filter.md) for more details).  These visibility rules will be explained below.

# In[3]:

b.add_dataset('lp',
              times=[0, 1, 2],
              wavelengths=phoebe.linspace(549, 551, 101))
print(b.get_dataset(kind='lp', check_visible=False))

# For information on the included passband-dependent parameters (not mentioned below), see the section on the [lc dataset](LC.ipynb).

# ### times

# In[4]:

print(b.get_dataset(kind='lp').times)

# ### compute_times / compute_phases
#
# See the [Compute Times & Phases tutorial](compute_times_phases.ipynb).

# In[5]:
コード例 #14
0
ファイル: pblum.py プロジェクト: renlliang3/phoebe2-docs
import phoebe
from phoebe import u # units
import numpy as np

logger = phoebe.logger()

b = phoebe.default_binary()


# And we'll add a single light curve dataset so that we can see how passband luminosities affect the resulting synthetic light curve model.

# In[4]:


b.add_dataset('lc', times=phoebe.linspace(0,1,101), dataset='lc01')


# Lastly, just to make things a bit easier and faster, we'll turn off [irradiation (reflection)](reflection_heating.ipynb), use blackbody atmospheres, and disable [limb-darkening](limb_darkening.ipynb) (so that we can play with weird temperatures without having to worry about falling of the grids).

# In[5]:


b.set_value('irrad_method', 'none')
b.set_value_all('ld_mode', 'manual')
b.set_value_all('ld_func', 'linear')
b.set_value_all('ld_coeffs', [0.])
b.set_value_all('ld_mode_bol', 'manual')
b.set_value_all('ld_func_bol', 'linear')
b.set_value_all('ld_coeffs_bol', [0.])
b.set_value_all('atm', 'blackbody')
コード例 #15
0
ファイル: RV.py プロジェクト: renlliang3/phoebe2-docs
# In[13]:


print(b.get_parameter(qualifier='rv_grav', component='primary'))


# See the [Gravitational Redshift example](../examples/grav_redshift.ipynb) for more details on the influence this parameter has on radial velocities.

# Synthetics
# ------------------

# In[14]:


b.set_value_all('times', phoebe.linspace(0,1,101))


# In[15]:


b.run_compute(irrad_method='none')


# In[16]:


print(b.filter(context='model').twigs)


# In[17]:
コード例 #16
0
# In[2]:

import phoebe
from phoebe import u  # units
import numpy as np
import matplotlib.pyplot as plt

logger = phoebe.logger()

b = phoebe.default_binary()

# And we'll attach some dummy datasets.  See the [datasets tutorial](datasets.ipynb) for more details.

# In[3]:

b.add_dataset('orb', compute_times=phoebe.linspace(0, 10, 10), dataset='orb01')

b.add_dataset('lc', compute_times=phoebe.linspace(0, 1, 101), dataset='lc01')

# Default Compute Options
# ----------------------------------
#
# Any default Bundle already has a set of default compute options to run the backend for PHOEBE 2.  In most cases, you can just edit the options in this default set of compte options.
#

# In[4]:

print(b.computes)

# In[5]:
コード例 #17
0
print(b.filter(qualifier='requiv*', context='component'))

# In[5]:

b.set_value('requiv', component='primary', value=1.1)
b.set_value('requiv', component='secondary', value=0.9)

# Adding Datasets
# -------------------
#
# We'll add light curve, orbit, and mesh datasets.

# In[6]:

b.add_dataset('lc', compute_times=phoebe.linspace(-2, 2, 201), dataset='lc01')

# In[7]:

b.add_dataset('orb', compute_times=phoebe.linspace(-2, 2, 201))

# In[8]:

anim_times = phoebe.linspace(-2, 2, 101)

# In[9]:

b.add_dataset('mesh',
              compute_times=anim_times,
              coordinates='uvw',
              dataset='mesh01')
コード例 #18
0
b.set_value('syncpar', component='secondary', value=1.5)

# Adding Datasets
# -------------------
#
# We'll add radial velocity, line profile, and mesh datasets.  We'll compute the rvs through the whole orbit, but the mesh and line profiles right around the eclipse - just at the times that we want to plot for an animation.

# In[3]:

anim_times = phoebe.arange(0.44, 0.56, 0.002)

# We'll add two identical datasets, one where we compute only dynamical RVs (won't include Rossiter-McLaughlin) and another where we compute flux-weighted RVs (will include Rossiter-McLaughlin).

# In[4]:

b.add_dataset('rv', times=phoebe.linspace(0, 1, 201), dataset='dynamicalrvs')

b.set_value_all('rv_method', dataset='dynamicalrvs', value='dynamical')

# In[5]:

b.add_dataset('rv', times=phoebe.linspace(0, 1, 201), dataset='numericalrvs')

b.set_value_all('rv_method', dataset='numericalrvs', value='flux-weighted')

# For the mesh, we'll save some time by only exposing plane-of-sky coordinates and the 'rvs' column.

# In[6]:

b.add_dataset('mesh',
              compute_times=anim_times,
コード例 #19
0
b.flip_constraint('mass@secondary', 'q')
b.set_value('mass@secondary@component', value=1.0) #1.0

b.set_value('requiv@primary@star@component', value=1.21) #1.21

b.set_value('teff@primary@star@component', value=6300) #6300
b.set_value('teff@secondary@star@component', value=6000) #6000

b.set_value('incl@orbit', value=68) #68

b.set_value('t0_supconj', value=0.80) #0.80

b.set_value('pblum_mode', 'dataset-scaled')

#Add Other Datasets
b.add_dataset('orb', compute_times=pb.linspace(0,4,1001), dataset='orb01')
b.add_dataset('rv', compute_times=pb.linspace(0,1,1001), dataset='rv01')
b.add_dataset('mesh', compute_times=pb.linspace(0,1,101), dataset='mesh01')
b.set_value('columns', value=['teffs'])
#b.set_value('coordinates', value=['xyz'])

b.run_compute(irrad_method='none', model='Initial_Fit')
b['lc01'].plot(x='phase', legend=True, s=0.01, ylabel=r'Flux', xlabel='Phase', save=path+'Initial_Fit.png')
b['lc01'].plot(x='phase', legend=True, s=0.01, ylabel=r'Flux', xlabel='Phase', save=path+'Initial_Fit.pdf')
print('Initial Plotted\n')

#Plot Orbit
b['orb01@model'].plot(time=1.0, xlabel=r'$x$', ylabel=r'$y$', xunit='AU', yunit='AU', save=path+'Others/'+'Orbit.png')
b['orb01@model'].plot(time=1.0, xlabel=r'$x$', ylabel=r'$y$', xunit='AU', yunit='AU', save=path+'Others/'+'Orbit.pdf')
print('Orbit Plotted\n')
コード例 #20
0
# In[5]:

print(b.filter(qualifier=['mass', 'requiv', 'teff'], context='component'))

# In[6]:

b['irrad_frac_refl_bol@primary'] = 1.0
b['irrad_frac_refl_bol@secondary'] = 0.6

# Now we'll compute the light curves with wilson and horvat irradiation, and plot the relative differences between the two as a function of phase, for several different values of the inclination.
#
# Note that Figure 8 excluded eclipse effects, but that ability is not included in PHOEBE 2.0, so there will be a slight discrepancy for inclinations which exhibit eclipses.

# In[7]:

phases = phoebe.linspace(0, 1, 101)
b.add_dataset('lc', times=b.to_time(phases))

# In[8]:

for incl in [0, 30, 60, 90]:
    b.set_value('incl@binary', incl)
    b.run_compute(irrad_method='wilson')
    fluxes_wilson = b.get_value('fluxes', context='model')
    b.run_compute(irrad_method='horvat')
    fluxes_horvat = b.get_value('fluxes', context='model')
    plt.plot(phases, (fluxes_wilson - fluxes_horvat) / fluxes_wilson,
             label='i={}'.format(incl))

plt.xlabel('phase')
plt.ylabel('[F(wilson) - F(horvat)] / F(wilson)')
コード例 #21
0
# In[3]:

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(
コード例 #22
0
# Let's first initialize a bundle and change some of the parameter values. We'll then export the computed models as "observables" to use with the rv_geometry estimator.

# In[2]:


b = phoebe.default_binary()
# set parameter values
b.set_value('q', value = 0.6)
b.set_value('incl', component='binary', value = 84.5)
b.set_value('ecc', 0.2)
b.set_value('per0', 63.7)
b.set_value('sma', component='binary', value= 7.3)
b.set_value('vgamma', value= -32.84)

# add an rv dataset
b.add_dataset('rv', compute_phases=phoebe.linspace(0,1,101))

#compute the model
b.run_compute()

# extract the arrays from the model that we'll use as observables in the next step and add noise to the rvs
times = b.get_value('times', context='model', component='primary', dataset='rv01')
np.random.seed(0) # to ensure reproducibility with added noise
rvs1 = b.get_value('rvs', component='primary', context='model', dataset='rv01') + np.random.normal(size=times.shape)
rvs2 = b.get_value('rvs', component='secondary', context='model', dataset='rv01') + np.random.normal(size=times.shape)
sigmas_rv = np.ones_like(times) * 2


# ### Initialize the bundle

# To showcase the rv_estimator, we'll start with a fresh default bundle.
コード例 #23
0
b.set_value('period', component='binary', value=1000.0 * u.d)
b.set_value('teff', component='primary', value=17000 * u.K)
b.set_value('teff', component='secondary', value=4000 * u.K)
b.set_value('requiv', component='primary', value=4.22173036 * u.solRad)
b.set_value('requiv', component='secondary', value=40.732435 * u.solRad)
b.flip_constraint('mass@primary', solve_for='sma@binary')
b.set_value('mass', component='primary', value=6.5 * u.solMass)
b.flip_constraint('mass@secondary', solve_for='q')
b.set_value('mass', component='secondary', value=1.9145 * u.solMass)

# And then create three light curve datasets at the same times, but in different passbands

# In[5]:

times = phoebe.linspace(-20, 20, 101)
b.add_dataset('lc', times=times, dataset='B', passband="Johnson:B")
b.add_dataset('lc', times=times, dataset='R', passband="Cousins:R")
b.add_dataset('lc', times=times, dataset='KEP', passband="Kepler:mean")

# Now we'll set some atmosphere and limb-darkening options

# In[6]:

b.set_value_all('atm', 'ck2004')
b.set_value_all('gravb_bol', 0.0)
b.set_value_all('ld_mode_bol', 'manual')
b.set_value_all('ld_func_bol', 'linear')
b.set_value_all('ld_coeffs_bol', [0.0])

# And flip the extinction constraint so we can provide E(B-V).
コード例 #24
0
# In[2]:

import phoebe
from phoebe import u  # units

logger = phoebe.logger()

b = phoebe.default_binary()

# And we'll attach some dummy datasets.  See [Datasets](datasets.html) for more details.

# In[3]:

b.add_dataset('orb',
              compute_times=phoebe.linspace(0, 10, 1000),
              dataset='orb01')

# In[4]:

b.add_dataset('lc', compute_times=phoebe.linspace(0, 10, 1000), dataset='lc01')

# Available Backends
# ----------------------------
#
# See the [Compute Tutorial](./compute) for details on adding compute options and using them to create synthetic models.
#
# The following list in any version of PHOEBE can always be accessed via [phoebe.list_available_computes](../api/phoebe.list_available_computes.md).
#
# Note also that all of these are listed on the [backends](../backends.md) page and their available functionality is compared in the [compute backend comparison table](../examples/compute_comparison_table.ipynb).
コード例 #25
0
b.set_value('period', component='binary', value=0.0897780065 * u.d)
b.set_value('teff', component='primary', value=13247 * u.K)
b.set_value('teff', component='secondary', value=3650 * u.K)
b.set_value('requiv', component='primary', value=0.0160 * u.solRad)
b.set_value('requiv', component='secondary', value=0.1669 * u.solRad)
b.flip_constraint('mass@primary', solve_for='sma@binary')
b.set_value('mass', component='primary', value=0.4477 * u.solMass)
b.flip_constraint('mass@secondary', solve_for='q')
b.set_value('mass', component='secondary', value=0.1501 * u.solMass)

# Now we'll create datasets for LSST u,g,r, and i bands.

# In[6]:

period = b.get_value('period', component='binary')
times = phoebe.linspace(-0.1 * period, 0.6 * period, 501)
b.add_dataset('lc', times=times, dataset='u', passband="LSST:u")
b.add_dataset('lc', times=times, dataset='g', passband="LSST:g")
b.add_dataset('lc', times=times, dataset='r', passband="LSST:r")
b.add_dataset('lc', times=times, dataset='i', passband="LSST:i")

# And set options for the atmospheres and limb-darkening.

# In[7]:

b.set_value_all('atm', component='primary', value='blackbody')
b.set_value_all('ld_mode', component='primary', value='manual')
b.set_value_all('ld_func', component='primary', value='quadratic')
b.set_value('ld_coeffs',
            component='primary',
            dataset='u',
コード例 #26
0
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt

logger = phoebe.logger('error')

b = phoebe.default_binary()


# Now let's add a light curve dataset to see how ltte affects the timings of eclipses.

# In[3]:


b.add_dataset('lc', times=phoebe.linspace(-0.05, 0.05, 51), dataset='lc01')


# Relevant Parameters
# ------------------------
# 
# The 'ltte' parameter in context='compute' defines whether light travel time effects are taken into account or not.

# In[4]:


print(b['ltte@compute'])


# Comparing with and without ltte
# --------------------------------------------
コード例 #27
0
# In[5]:


b['period@orbit']=10*u.d
b['teff@secondary']=5780.*u.K
b['requiv@secondary']=1.0*u.solRad
b.flip_constraint('mass@primary', solve_for='sma@binary')
b.flip_constraint('mass@secondary', solve_for='q')


# And then create three light curve datasets at the same times, but in different passbands

# In[6]:


times = phoebe.linspace(0, 10, 301)
b.add_dataset('lc', times=times, dataset='B', passband="Johnson:B")
b.add_dataset('lc', times=times, dataset='R', passband="Cousins:R")


# Now we'll set some atmosphere and limb-darkening options

# In[7]:


b.set_value_all('gravb_bol', 0.0)
b.set_value_all('ld_mode', 'manual')
b.set_value_all('ld_func', 'linear')
b.set_value_all('ld_coeffs', [0.0])

コード例 #28
0
# 
# We'll add radial velocity, line profile, and mesh datasets.  We'll compute the rvs through the whole orbit, but the mesh and line profiles right around the eclipse - just at the times that we want to plot for an animation.

# In[3]:


anim_times = phoebe.arange(0.44, 0.56, 0.002)


# We'll add two identical datasets, one where we compute only dynamical RVs (won't include Rossiter-McLaughlin) and another where we compute flux-weighted RVs (will include Rossiter-McLaughlin).

# In[4]:


b.add_dataset('rv', 
              times=phoebe.linspace(0,1,201), 
              dataset='dynamicalrvs')

b.set_value_all('rv_method', dataset='dynamicalrvs', value='dynamical')


# In[5]:


b.add_dataset('rv', 
              times=phoebe.linspace(0,1,201), 
              dataset='numericalrvs')

b.set_value_all('rv_method', dataset='numericalrvs', value='flux-weighted')

コード例 #29
0
import matplotlib.pyplot as plt

logger = phoebe.logger()

b = phoebe.default_binary()

# In[3]:

b.set_value(qualifier='pitch', component='primary', value=30)

# Model without Spots
# --------------------------

# In[4]:

b.add_dataset('lc', times=phoebe.linspace(0, 1, 101))

# In[5]:

b.run_compute(irrad_method='none', model='no_spot')

# Adding Spots
# ---------------------

# Let's add a spot to the primary component in our binary, which we have already misaligned by 30 degrees in pitch.
#
# The 'colat' parameter defines the colatitude on the star measured from its North (spin) Pole.  The 'long' parameter measures the longitude of the spot - with longitude = 0 being defined as pointing towards the other star at t0.  See the [spots tutorial](../tutorials/spots.ipynb) for more details.
#
# We'll place this spot at the South Pole, which should be pointing towards the observer because we pitched the north pole away from the observer.

# In[6]:
コード例 #30
0

import phoebe
from phoebe import u # units
import numpy as np

b = phoebe.default_binary()


# And then we'll build a synthetic "dataset" and initialize a new bundle with those data

# In[3]:


b = phoebe.default_binary()
b.add_dataset('lc', times=phoebe.linspace(0,5,1001))
b.run_compute()

times = b.get_value('times@model')
fluxes = b.get_value('fluxes@model')
sigmas = np.ones_like(times) * 0.01

b = phoebe.default_binary()
b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,101),
              times=times, fluxes=fluxes, sigmas=sigmas,
              dataset='lc01')


# mask_enabled and mask_phases parameters
# ----------------------------
#