<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Reflection and Heating
For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering.
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
Step1:  As always, let's do imports and initialize a logger and a new bundle.
Step2:  Relevant Parameters
The parameters that define reflection and heating are all prefaced by "irrad_frac" (fraction of incident flux) and suffixed by "bol" to indicate that they all refer to a bolometric (rather than passband-dependent) process.  For this reason, they are not stored in the dataset, but rather directly in the component.
Each of these parameters dictates how much incident flux will be handled by each of the available processes.  For now these only include reflection (heating with immediate re-emission, without heat distribution) and lost flux.  In the future, heating with distribution and scattering will also be supported.
For each component, these parameters must add up to exactly 1.0 - and this is handled by a constraint which by default constrains the "lost" parameter.
Step3:  In order to see the effect of reflection, let's set "irrad_frac_refl_bol" of both of our stars to 0.9 - that is 90% of the incident flux will go towards reflection and 10% will be ignored.
Step4:  Since reflection can be a computationally expensive process and in most cases is a low-order effect, there is a switch in the compute options that needs to be enabled in order for reflection to be taken into account.  If this switch is False (which it is by default), the albedos are completely ignored and will be treated as if all incident light is lost/ignored.
Step5:  Reflection has the most noticeable effect when the two stars are close to each other and have a large temperature ratio.
Step6:  Influence on Light Curves (fluxes)
Step7:  Let's run models with the reflection switch both turned on and off so that we can compare the two results.  We'll also override delta to be a larger number since the computation time required by delta depends largely on the number of surface elements.
Step8:  Influence on Meshes (Intensities)
<ASSISTANT_TASK:>
Python Code:
#!pip install -I "phoebe>=2.3,<2.4"
Explanation: Reflection and Heating
For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering.
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
#logger = phoebe.logger('error')
b = phoebe.default_binary()
Explanation: As always, let's do imports and initialize a logger and a new bundle.
End of explanation
print(b['irrad_frac_refl_bol'])
print(b['irrad_frac_lost_bol'])
print(b['irrad_frac_refl_bol@primary'])
print(b['irrad_frac_lost_bol@primary@component'])
Explanation: Relevant Parameters
The parameters that define reflection and heating are all prefaced by "irrad_frac" (fraction of incident flux) and suffixed by "bol" to indicate that they all refer to a bolometric (rather than passband-dependent) process.  For this reason, they are not stored in the dataset, but rather directly in the component.
Each of these parameters dictates how much incident flux will be handled by each of the available processes.  For now these only include reflection (heating with immediate re-emission, without heat distribution) and lost flux.  In the future, heating with distribution and scattering will also be supported.
For each component, these parameters must add up to exactly 1.0 - and this is handled by a constraint which by default constrains the "lost" parameter.
End of explanation
b.set_value_all('irrad_frac_refl_bol', 0.9)
Explanation: In order to see the effect of reflection, let's set "irrad_frac_refl_bol" of both of our stars to 0.9 - that is 90% of the incident flux will go towards reflection and 10% will be ignored.
End of explanation
print(b['irrad_method@compute'])
Explanation: Since reflection can be a computationally expensive process and in most cases is a low-order effect, there is a switch in the compute options that needs to be enabled in order for reflection to be taken into account.  If this switch is False (which it is by default), the albedos are completely ignored and will be treated as if all incident light is lost/ignored.
End of explanation
b['sma@orbit'] = 4.0
b['teff@primary'] = 10000
b['teff@secondary'] = 5000
Explanation: Reflection has the most noticeable effect when the two stars are close to each other and have a large temperature ratio.
End of explanation
b.add_dataset('lc', times=np.linspace(0,1,101))
Explanation: Influence on Light Curves (fluxes)
End of explanation
b.run_compute(irrad_method='none', ntriangles=700, model='refl_false')
b.run_compute(irrad_method='wilson', ntriangles=700, model='refl_true')
afig, mplfig = b.plot(show=True, legend=True)
artists = plt.plot(b['value@times@refl_false'], b['value@fluxes@refl_true']-b['value@fluxes@refl_false'], 'r-')
Explanation: Let's run models with the reflection switch both turned on and off so that we can compare the two results.  We'll also override delta to be a larger number since the computation time required by delta depends largely on the number of surface elements.
End of explanation
b.add_dataset('mesh', times=[0.2], columns=['teffs', 'intensities@lc01'])
b.disable_dataset('lc01')
b.run_compute(irrad_method='none', ntriangles=700, model='refl_false', overwrite=True)
b.run_compute(irrad_method='wilson', ntriangles=700, model='refl_true', overwrite=True)
#phoebe.logger('debug')
afig, mplfig = b.plot(component='secondary', kind='mesh', model='refl_false', 
                      fc='intensities', ec='face', 
                      draw_sidebars=True, show=True)
afig, mplfig = b.plot(component='secondary', kind='mesh', model='refl_true', 
                      fc='intensities', ec='face', 
                      draw_sidebars=True, show=True)
afig, mplfig = b.plot(component='secondary', kind='mesh', model='refl_false', 
                      fc='teffs', ec='face', 
                      draw_sidebars=True, show=True)
afig, mplfig = b.plot(component='secondary', kind='mesh', model='refl_true', 
                      fc='teffs', ec='face', 
                      draw_sidebars=True, show=True)
Explanation: Influence on Meshes (Intensities)
End of explanation
<END_TASK>