Plots and animations#
General dynamic (direct) driver#
plot#
Plot system configuration using matplotlib
- DirectBase.plot(t=None, i=None, inorm=None, nsphere=None, ssphere=None, colorize=False, fig=None, ax=None, focal=None, box=None, angle=[30, 30], rotate=None, rotscale=None, ntrack=10000, lenhyp=5, lenpar=10, tight=None, t0=0, truncate=3, spin=None, axes=None, culling=False, legend=None, legend_ncol=1, legend_loc='lower left', markersize=None, unit=None, unit_name=None, hide_axes=False, jacobi=True, cms=True, cms_orbit=True, cms_labels=None, cms_style=None, origin=True, return_fig=False, return_ax=False, elim=None, flatten=True, showtime=True, label=None)#
Plot orbits. Setup (default) or at time t.
plot3#
3D plot system evolution using matplotlib
- DirectBase.plot3(t=None, i=None, trail=None, itrail=None, gamma=1, nsphere=None, ssphere=None, colorize=False, msphere=None, fig=None, ax=None, focal=None, box=None, box_boundary=0.01, angle=[30, 30], rotate=None, rotscale=None, t0=0, tight=None, spin=None, spin_j=None, spin_w=None, spin_scale=None, spin_scale_factor=1, spin_scale_j=None, spin_scale_w=None, spin_trail=False, spin_trail_gamma=None, spin_trail_alpha=None, spin_col_j='b', spin_col_w='r', spin_print_scale=False, spin_arrow=None, legend=None, legend_ncol=1, legend_loc='lower left', label=None, axes=None, axes_trail=False, axes_trail_gamma=None, axes_trail_alpha=None, culling=False, track=None, track_all=None, markersize=None, unit=None, unit_name=None, verbose=False, hide_axes=False, zoom=None, save=None, save_dpi=None, save_format=None, return_fig=False, return_ax=False, gw=None, gw_scale=None, gw_size=None, gw_nsphere=None, gw_opacity=None, gw_mode=None, flatten=True, showtime=True)#
3D plot of orbits
- Parameters:
t – end time of plot (default: end of run)
i – model number of end of pot (default: end of run, exclusive with t)
trail – length of trail in time units
imaginary component:
- < 0
add fraction of time until end of trajectory
- > 0
add fraction of time since start of trajectory
itrail – length of trail in model numbers
nsphere – resolution of sphere
ssphere – size scale of sphere
msphere – min radius to plot sphere, as fraction of max box dimension
(0.01 seems a good choice)
colorize – color of image
fig – figure object to draw in (for animations)
ax – axes to use for drawing
tight – use tight_layout
box – bounding box for plot (for animations)
TrueEntire trajectory
Ellispisremaining trajectory
Nonejust entire trail
"TrackFinal"Track and remaining trajectory
"TrackInitial"entire trajectory up to this point
box_boundary – add some extra space to fix broken matplotlib clip
angle – view angles
rotate – vector of rotation angles per model or rotation scale
rotscale – timescale for rotation by one degree
track – object to track:
- int
index of orbit
- list, tuple
indices of stars
track_all – what to include in box:
Trueplot all objects, not just tracked
Nonedo not plot non-tracked objects (default)
Falsedo not box all objects, but still plot them
axes (bool) – draw body axes
axes_trail (bool) – trails on body axes
axes_trail_gamma – gamma of body axes trails
axes_trail_alpha – alpha of body axes trails
gw –
- show strain of external GW source;
default - True if souce exists
gw_scale – scale factor on strain.
realive to max if negative
- -1
results in a line in strain direction (default)
gw_size – size of visualisation.
relative to plot size if negative,
in cm otherwise,
default: -0.25
gw_nsphere – enable 3d rendering
number of sphere elements in each direction
True - 12
default: nsphere
gw_opacity – opacity of sphere
- 0
transparent,
- 1
opaque
default: 0.2
gw_mode – mode index of gw to plot
default: 0
plotly#
Plot system configuration using plotly
- DirectBase.plotly(t=None, i=None, inorm=None, ntrack=10000, lenhyp=5, lenpar=10, tight=None, t0=0, truncate=3, elim=None)#
Plot orbits. Similar to plot but use plotly`.
vtk#
Plot system evolution using vtk
- DirectBase.vtk(*args, **kwargs)#
movie#
Easy interface to movie package to make animations
- DirectBase.movie(filename, *args, **kwargs)#
parameters: cc - copyright text
EXAMPLE:#
from multistar import multi as M, Direct as D m = M("^/mardling_unstable.toml") m.runs(YR/3600, 3600) m.movie('unstable.mp4', inorm=2, box=[[-2.5,0.5],[-1.2,1.2],[-0.5,0.5]], angle=[90,90]) m.movie('unstable_cms.mp4', box=[[-1.25,0.75],[-0.8,0.8],[-.001,.001]], angle=[90,90]) m = M("^/nested.toml") m.runs(1 * YR / 3600, 3600*10) m.movie('quad.webm', box=[[-1,1],[-1.,1],[-1,1]],) m = M("/home/alex/kepler/quadruple/paired.toml") m.runs(1*YR/3600, 3600*10) m.movie('qp.webm', box=[[-.8,.8],[-.8,.8],[-.05,.05]],) m = M("^/paired.toml") m.runs(1*YR/3600, 3600*10) m.movie('qpt.webm', box=[[-.8,.8],[-.6,.6],[-.05,.05]], angle=[60,45], trail=1e7, rotate=[0.1,0]) m.movie('qpt2.webm', box=[[-.8,.8],[-.6,.6],[-.05,.05]], angle=[60,45], trail=1e7, rotate=[-0.1,0.01*np.pi]) m = M("^/paired.toml") m.runs(1*YR/3600, 3600*10) m.movie('quadt10.webm',box=[[-.8,.8],[-.8,.8],[-.8,.8]], angle=[60,45], step=10, trail=3.16e7, rotate=[-0.02,0]) m = M("^/paired.toml") m.runs(1*YR/3600, 3600*25) m.movie('quadt20.webm',box=[[-.8,.8],[-.8,.8],[-.8,.8]], angle=[60,45], step=10, trail=3.16e7, rotate=[-0.02,0]) h = H("^/nested.toml") h.rund(25*YR) h.movie('ht2.webm', dt=3600j, box=[[-.5,.5],[-.5,.5],[-.5,.5]],trail=0.5*YR, rotate=[-0.02,0], rotscale=5e5) # note the 'j' after the number of desired steps. m = M('^/eight.toml') m.runs(1*YR/3600, 3600*10) m.movie('eight.webm',start=3600,step=5,nstep=721, box=[[-.20,.20],[-.1,.1],[-.01,.01]], trail=0.3*YR, t0=YR) m.movie('eight_orb.webm', step=5, nstep=721, box=[[-.25,.25],[-.25,.25],[-.02,.02]]) m = M('^/circle.toml') m.runs(1*YR/3600, 3600*2) m.movie('circle.webm',start=900,step=5,nstep=721, box=[[-.30,.30],[-.3,.3],[-.02,.02]], trail=0.4*YR, t0=YR/3) m = M('^/circle.toml') m.runs(1*YR/3600, 3600*70) m.movie('circle_full_1080p.webm',size='1080p',step=5, trail=0.5*YR) m = M('^/square.toml') m.runs(1*YR/3600, 3600*2) m.movie('square.webm',start=900,step=5,nstep=721, box=[[-.45,.45],[-.45,.45],[-.02,.02]], trail=0.25*YR, t0=YR/4) m = M('^/square.toml') m.runs(1*YR/3600, 3600*12) m.movie('square_full_1080p.webm',size='1080p',step=5, trail=0.5*YR) m = M('~/python/runs/TIC_114936199.toml') m.rund(10*YR) m.movie('TIC_114936199.webm',dt=0.1*DAY, trail=0.1*YR, tstop=6*YR,angle=[0,-90],box=[[-0.8,0.8],[-.02,.02],[-0.8,0.8]]) m = M('^/mercury.toml') m.rund(1000*YR) m.movie('mercury.webm', dt=0.1*YR, trail=0.1*YR, angle=[45,-35], box=[[-1,1],[-1,1],[-.2,.2]]) from multistar.grid.bbbh import Study as S m = S.M(T=1.06,i=135) m.rund() m.movie('bbhtde.webm', dt=3600j, trail=1*YR, tstart=-16j*YR) m = M('^didymos') m.runs(60, 12000) m.movie('didymos2.webm', dt=60, trail=DAY/2, tstop=2*DAY, angle=[45,-35], box=[[-1,1],[-1,1],[-.2,.2]], nsphere=1, axes=True, size='1080p', culling=True) m = M('^trojian') m.rund(DAY*3600, dtmax=0.1*DAY) m.movie('trojan.webm', dt=DAY, trail=100*DAY, angle=[45,-35], box=[[-1,1],[-1,1],[-.2,.2]], size='1080p') m = M('^arrokoth') m.rund(10000*YR) m.movie('arrokoth-17s.webm', dt=10*YR, trail=100*YR, track=0, box=..., size='1080p') m.movie('arrokoth-2.8m.webm', dt=1*YR, trail=100*YR, track=0, box=..., size='1080p') m = M('^TOI-1338') m.rund(3*YR) m.movie('TOI-1338.webm', dt=YR/600, trail=10*DAY, box=..., size='1080p') m.movie('TOI-1338-big.webm', dt=YR/600, trail=30*DAY, box=..., unit='AU', markersize=10, legend=True) m = M('^arrokoth') m.rund(1500*YR) m.runs(60, 15000, cont=(m.t[-1] - 10*DAY)*1j) m.zerotime(zero_offset=True, final=True) m.movie('arrokoth-10d.webm',track=0,trail=10*DAY,nsphere=48,unit='km',box=[25,25,25], angle=[30,120]) from physconst import * from multistar import multi as M m = M('^arrokoth', update={'body 2.orientation_deg': [0,0,97]}) m.rund(13000*YR) m.zerotime(zero_offset=True, final=True) # m.plot3(track=0, itrail=1000, nsphere=20, msphere=0.01) m.movie('arrokoth-2-97-log-v2.webm', track=0, trail=10*DAY-0.1j, nsphere=48, msphere=0.01, unit='km', angle=[30,120], dt='log', nstep=3600, framerate=60, toffset=DAY, box='TrackFinal') from multistar import multi as M m = M("^hyperion_only", update={'hyperion.orientation_deg':[0,0.01,0],'hyperion.image':'~/kepler/multistar/images/moon-2k_moon.jpg'}) m.runs(YR/1000,3600*5) m.movie('hyperion_5min.webm', size='720p', framerate=60, track=[1], nsphere=48, trail=50*DAY, axes=True, axes_trail=True, culling=True) from multistar import multi as M m = M("^hyperion_only", update={'orbit.en'=0.1,'hyperion.image':'~/kepler/multistar/images/moon-2k_moon.jpg'}) m.runs(YR/1000,3600) m.movie('hyperion_aligned_1min.webm', size='720p', framerate=60, track=[1], nsphere=48, trail=50*DAY, axes=True, axes_trail=True, culling=True) from multistar import multi as M m = M("^hyperion_only", update={'hyperion.orientation_deg':[0,0.1,0],'hyperion.image':'~/kepler/multistar/images/moon-2k_moon.jpg'}) m.runs(YR/1000,3600) m.movie('hyperion_1min_jw.webm', size='720p', framerate=60, track=[1], box=True, nsphere=48, trail=100*DAY, spin=2, zoom=1.5, spin_trail=True, culling=True) from multistar import multi as M m = M(r'-gw',update={'gw.euler_deg':[-28,119,37],'dtd':None}) m.runs(1.29342039e+09*5/1200,1199) m.movie('gw_test.webm', size='720p', framerate=60, track=0, box=True, gw_nsphere=48, trail=1.29342039e+09/2, culling=True,gw_size=1/4,gw_opacity=1,nparallel=6) from multistar import multi as M m = M(r'-gw',update={'gw.euler_deg':[0,0,0],'gw.alpha_deg':90}) m.runs(1.29342039e+09*5/1200,1199) m.movie('gw_simple_bh_perpendicular.webm', size='720p', framerate=60, track=0, box=True, trail=1.29342039e+09/2,nparallel=6, angle=[60,60])
Specialized dynamic (direct) driver#
- DirectBase.plot_jc()#
plot all angular momenta, orbits relative to CM, and spins
- DirectBase.plot_jctc()#
plot total CM angular momentum conservation
- DirectBase.plot_jh()#
plot all hierarchical binary angular momenta and spins
- DirectBase.plot_aj(axis='z')#
plot angles of all hierarchical binary angular momenta and spins relative to axes 0,1, or 2 (x, y, or z)
- DirectBase.plot_ajh()#
plot angles of all hierarchical binary angular momenta and spins
- DirectBase.plot_jhtc()#
plot total hierarchical angular momentum conservation
- DirectBase.plot_eb(specific=True)#
plot (specific) energy of bodies relative to CM
negative (bound) values are plotted as solid lines
center of mass is at rest by definition in Jacobi coordinates
- DirectBase.plot_ec(specific=True)#
plot (specific) energy of coordinate pairs
negative (bound) values are plotted as solid lines
- DirectBase.plot_et(plot=True)#
plot total energy conservation
- DirectBase.plot_eo(specific=True)#
plot (specific) energy of orbits
- specific
True|False Whether to plot specific energy (default) or energy
negative (bound) values are plotted as solid lines
- specific
- DirectBase.plot_en(sel=None, log1me=False, elim=None)#
plot orbit eccentricities
- DirectBase.plot_an(sel=None, ylog=None, elim=None)#
plot orbit separations
- DirectBase.plot_P(sel=None, ylog=False)#
plot rotation period
- DirectBase.plot_Po(sel=None)#
plot orbital period
- DirectBase.plot_PP(instantaneous=False, ylog=False)#
plot orbital and spin period
- DirectBase.plot_rn(sel=None, ylog=False)#
plot separations
- DirectBase.plot_eccp(pairs=None, *, sel=None, exclude=None, elim=None)#
plot pair orbit eccentricities
- pairs
list of pairs to inlcude
- sel
list of stars to include
- excludep
list of pairs to exclude
- DirectBase.plot_bound(specific=True)#
plot binding energies
- DirectBase.plot_f(i=0, tstart=None)#
plot orientation quaternion components
- DirectBase.plot_o(i=0)#
plot orientation vector components (sort-of useles)
- DirectBase.plot_abj(i=0)#
plot angle of body axes to object angular momentum
- i
select body
- DirectBase.plot_abw(i=0)#
plot angle of body axes to angular velocity vector
- i
select body
- DirectBase.plot_abjo(i=0, j=0)#
plot angle of body axes to orbit angular momentum
- i
select body
- j
select orbit
- DirectBase.plot_abjt(i=0)#
plot angle of body axes to total angular momentum
- i
select body
- DirectBase.plot_ajj(i0=0, i1=1)#
plot angle of angular momentuma between two bodies
- i0, i1
select two bodies
- DirectBase.plot_ajojo(i0=0, i1=1)#
plot angle of orbit angular momentum between two orbits
- i0, i1
select two orbits
- DirectBase.plot_ajo(i=0, j=0)#
plot angle of body angular momentuma to orbit angular momentum
- i
select body
- j
select orbit
- DirectBase.plot_ajt(sel=None)#
plot angle between spin and total angular momemtum
- DirectBase.plot_ajot(sel=None)#
plot angle between orbital and total angular momemtum
- DirectBase.plot_awj(sel=None)#
plot angle between angular velocity and angular momentum
- DirectBase.plot_rpa(j=0)#
plot track in a-rp plane
- j
select orbit
- DirectBase.plot_j(i=-1)#
plot angular momentum coordinates
- i
select orbit
- DirectBase.plot_w(i=-1)#
plot angular velocity coordinates
- i
select orbit
- DirectBase.plot_section_q(section='rxmin', i=-1, j=-1, s=0, arc=False, mode=None, relative=True)#
plot section of trajectory in quaternion
- section
'rxmin' where to take slice:
- i
select object
- j
select orbit
- s
select component of quaternion
- arc
True|False convert to angles
- mode
'time',None color/shading
- section
- DirectBase.plot_section_w(section='rxmin', i=-1, j=-1, mode=None, relative=True)#
plot section of trajectory in quaternion magnitude
- section
'rxmin' where to take slice
- i
select object
- j
select orbit
- s
select component of quaternion
- arc
True|False convert to angles
- mode
'time'|None color/shading
- section
Graviational Wave plots#
- DirectBase.plot_gwb()#
plot binary fequency of background binary
- DirectBase.plot_gwh()#
plot stratin
Uses
\(h_{ij}\,h^{ij} = 8\,h^2\)
\(\frac{\mathrm{d}}{\mathrm{d}t} h = \omega h\)
Note
array contains \(\left[\frac{\mathrm{d}}{\mathrm{d}t} h_{ij}, \frac12\, \frac{\mathrm{d}^2}{\mathrm{d}t^2}\,h,\omega\right]\)
- DirectBase.plot_gw_res(iorb=None, n=None, fig=None, ax=None, zoom=True)#
plot fequency of background and foreground binaries
- DirectBase.plot_gw_phase(igw=0, iorb=0, n=2, fig=None, ax=None, trig=False)#
plot phase difference of background and foreground binaries
- DirectBase.plot_gw_strain(igw=None, d=0, showleg=True, fig=None, ax=None)#
Plot gravitational wave strain
- Parameters:
igw – gw mode or binary
d – derivative
0hh0
1hh1
2hh2
-1hh0 amplitude
-2total strain (\(h\mathord{:}h/8\))
Binary direct driver (Direct2)#
- Direct2.plot_orb_3d()#
make 3D plot of orbit
This routine may be superseeded by DirectBase.plot3
- Direct2.plot_check(normal=True, **kwargs)#
plot angular momentum check
- Direct2.plot_force(index, sel=None, flags=None)#
plot forces by index
use
flags='all'to plot all forces
- Direct2.plot_dw(i=0, mode='w', rel=False, sel=None)#
plot angular velocity rates of change
- Direct2.plot_j(sel=None, **kwargs)#
Plot angular momentum componnets
- Direct2.plot_jn(sel=None, **kwargs)#
Plot angular momentum magnitudes
- Direct2.plot_w(gr=True, **kwargs)#
Plot angular velocity components
- Direct2.plot_wn(gr=True, **kwargs)#
Plot angular velocity magnitudes
- Direct2.plot_p(gr=True, **kwargs)#
Plot orbit and spin periods
- Direct2.plot_e(gr=True, **kwargs)#
plot Runge-Lenz vector
- Direct2.plot_en(gr=True, **kwargs)#
plot eccentricty of orrbit
- Direct2.plot_r(gr=True, **kwargs)#
plot different distance-like obit elements
- Direct2.plot_i(gr=True, **kwargs)#
plot physical (relative) inclinations
- Direct2.plot_it(gr=True, **kwargs)#
plot inclinations of j’s relative to total
- Direct2.plot_phase(sel=None, gr=True, **kwargs)#
plot inclinations of j’s relative to total
- Direct2.plot_jo(sel=None, gr=True, **kwargs)#
plot angular momemtum components relative to orbit
- Direct2.plot_wo(sel=None, gr=True, **kwargs)#
plot angular velocity components relative to orbit
Secular driver (Secular2)#
- Secular2.plot_check(sel=None, time_digits=None)#
plot check of angular momentum conservation
- Secular2.plot_j(sel=None, digits=3, components=None)#
Plot angular velocity components
- Secular2.plot_jn(sel=None, digits=3)#
Plot angular velocity magnitude
- Secular2.plot_w(sel=None, digits=3, components=None)#
plot angular velocity components
- Secular2.plot_wn(sel=None, digits=3)#
plot angular velocity vector comonnents
- Secular2.plot_p(sel=None, digits=3)#
plot period
- Secular2.plot_e(sel=None, digits=3)#
Plot components of Runge-Lenz vector
- Secular2.plot_en(sel=None, digits=3)#
Plot numerical eccentricty
- Secular2.plot_r(sel=None, digits=3)#
Plot radii
- Secular2.plot_i(sel=None, digits=3)#
plot inclinations
- Secular2.plot_it(gr=True, sel=None, digits=3, **kwargs)#
plot inclinations of j’s relative to total
- Secular2.plot_jo(sel=None, digits=3, components=None)#
plot angular momemtum components relative to orbit
- Secular2.plot_wo(sel=None, digits=3, components=None)#
plot angular momemtum components relative to orbit
- Secular2.plot_jt(sel=None, digits=3, components=None)#
plot angular momemtum components relative to total
- Secular2.plot_wt(sel=None, digits=3, components=None)#
plot angular momemtum components relative to total direction
- Secular2.plot_a(sel=None, digits=3)#
plot rate of apsidal advance, dot{vec{e}}/norm{e}cdothat{q}
precession relative to total angular momentum of the system
- Secular2.plot_djn(sel=None, digits=3)#
plot rate of chnage of total angular momentum
- Secular2.plot_dj(sel=None, digits=3, components=None)#
plot rate of change of angular momentum componnents
- Secular2.plot_E(sel=None, digits=3)#
plot orbital and rotational energies
- Secular2.plot_dE(sel=None, digits=3)#
plot rate of change of orbital and rotational energies
- Secular2.plot_phi(sel=None, trig=False, digits=3)#
plot phase of precession relative to e with respect to h