Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
In [ ]:
!pip install -I "phoebe>=2.2,<2.3"
As always, let's do imports and initialize a logger and a new Bundle. See Building a System for more details.
In [1]:
%matplotlib inline
In [2]:
import phoebe
logger = phoebe.logger()
b = phoebe.default_binary()
Line profiles have an extra dimension than LC and RV 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 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). Some parameters are only visible based on the values of other parameters, so we'll pass check_visible=False
(see the filter API docs 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.
In [4]:
print(b.get_dataset(kind='lp').times)
See the Compute Times & Phases tutorial.
In [5]:
print(b.get_parameter(qualifier='compute_times'))
In [6]:
print(b.get_parameter(qualifier='compute_phases', context='dataset'))
In [7]:
print(b.get_parameter(qualifier='compute_phases_t0'))
In [8]:
print(b.filter(qualifier='wavelengths'))
In [9]:
print(b.get_parameter(qualifier='wavelengths', component='binary'))
Line profiles will be computed for each component in which the wavelengths are provided. If we wanted to expose the line profile for the binary as a whole, we'd set the wavelenghts for wavelengths@binary
. If instead we wanted to expose per-star line profiles, we could set the wavelengths for both wavelengths@primary
and wavelengths@secondary
.
If you're passing wavelengths to the b.add_dataset call, it will default to filling the wavelengths at the system-level. To override this, pass components=['primary', 'secondary']
, as well. For example: b.add_dataset('lp', wavelengths=np.linspace(549,551,101), components=['primary', 'secondary'])
.
Note that observation flux_densities
parameters are exposed per-time, according to the value of times
passed to add_dataset.
flux_densities
parameters will be exposed in the model based on compute_times
/compute_phases
if not empty, otherwise according to times
. For more information, see the Compute Times & Phases tutorial.
In [10]:
print(b.filter(qualifier='flux_densities'))
In [11]:
print(b.get_parameter(qualifier='flux_densities',
component='binary',
time=0.0))
Note that, like flux_densities
, sigmas
parameters are exposed per-time, according to the value of times
passed to add_dataset.
In [12]:
print(b.filter(qualifier='sigmas'))
In [13]:
print(b.get_parameter(qualifier='sigmas',
component='binary',
time=0))
In [14]:
print(b.get_parameter(qualifier='profile_func'))
In [15]:
print(b.get_parameter(qualifier='profile_rest'))
In [16]:
print(b.get_parameter(qualifier='profile_sv'))
In [17]:
b.run_compute(irrad_method='none')
Out[17]:
In [18]:
print(b.filter(context='model').twigs)
The model for a line profile dataset will expose flux-densities at each time and for each component where the corresponding wavelengths Parameter was not empty. Here since we used the default and exposed line-profiles for the entire system, we have a single entry per-time.
In [19]:
print(b.filter(qualifier='flux_densities', context='model'))
In [20]:
print(b.get_parameter(qualifier='flux_densities', context='model', time=0))
In [21]:
afig, mplfig = b.filter(dataset='lp01', context='model', time=0).plot(show=True)
In [22]:
b.add_dataset('mesh', times=[0], dataset='mesh01')
Out[22]:
In [23]:
print(b.get_parameter(qualifier='columns').choices)
Since line profiles are passband-dependent, we get all passband-dependent mesh quantities (except relative intensities/luminosities that would require pblum scaling) as options (see LC for details). Additionally, we get rvs@lp01
, which under-the-hood is being used to determine the doppler shift of the line profile per-element and then summed over the star (see RV for details). To avoid large amounts of data being stored in the mesh with an extra dimension, the per-element line profiles are never stored, and therefore not able to be exposed to the user.