Although not well-documented, PHOEBE 2.0 included the ability to
directly set linspace or arange to an array while only storing the
properties (start, stop, step, etc). If for some reason you managed to
find and use the capability, the behavior has changed slightly and is
included in a separate package called
nparray, which is included and
built within PHOEBE 2.1 as
Besides having much more flexibility, the only user-interface changes are that you cannot directly set the attributes for the properties from the Parameter.
In PHOEBE 2.0.x:
b.get_parameter('times').stop = 1
In PHOEBE 2.1.x:
If you didn’t happen to stumble on this in PHOEBE 2.0, you may find it useful. The nparray functionality allows you to store the start, stop, step values (in the case of linspace) instead of the entire array in memory. This is significantly cheaper to store when saving to json, for example, and allows for easily editing your step size without having to change the entire array. If you are writing your PHOEBE code within a script, this may seem like no use to you, but if you are in an interactive python console, then this can be quite handy.
The most useful of these “array creation functions” are also copied into the top-level of the phoebe package. These include: linspace, arange, logspace, and geomspace.
import phoebe phoebe.linspace(0, 1, 11)
<linspace start=0 stop=1 num=11 endpoint=True unit=None>
By setting a PHOEBE parameter to this value, you can then later edit any of the properties.
b = phoebe.default_binary() b.add_dataset('lc', times=phoebe.linspace(0, 1, 11))
<ParameterSet: 15 parameters | contexts: compute, dataset>
Parameter: times@lc01@dataset Qualifier: times Description: Observed times Value: <linspace start=0 stop=1 num=11 endpoint=True unit=d> Constrained by: Constrains: None Related to: None
You can see here that the value is being stored not as an array, but as
an nparray object with the properties to create that array. Once you (or
get_quantity), the array is
temporarily created on-the-fly and returned.
[ 0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. ]
You can now “edit” the properties of this array without re-building it.
Parameter: times@lc01@dataset Qualifier: times Description: Observed times Value: <linspace start=0 stop=2 num=11 endpoint=True unit=d> Constrained by: Constrains: None Related to: None
[ 0. 0.2 0.4 0.6 0.8 1. 1.2 1.4 1.6 1.8 2. ]