Module airball.tools
The following documentation was automatically generated from the docstrings.
airball.tools
E_to_f(e, E)
Converts eccentric anomaly to true anomaly. Implemented from REBOUND using Numpy to handle vectorization.
Source code in src/airball/tools.py
348 349 350 351 352 353 | |
M_to_E(e, M)
Converts mean anomaly to eccentric anomaly. Implemented from REBOUND using Numpy to handle vectorization.
Source code in src/airball/tools.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
M_to_f(e, M)
Converts mean anomaly to true anomaly. Implemented from REBOUND using Numpy to handle vectorization.
Source code in src/airball/tools.py
356 357 358 359 | |
angle_between(v1, v2)
Returns the angle in radians between vectors 'v1' and 'v2'. Implemented from StackOverflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v1
|
array
|
The first vector. |
required |
v2
|
array
|
The second vector. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
theta |
float
|
The angle between the two vectors in units of radians. |
Example
angle_between((1, 0, 0), (0, 1, 0)) # 1.5707963267948966
angle_between((1, 0, 0), (1, 0, 0)) # 0.0
angle_between((1, 0, 0), (-1, 0, 0)) # 3.141592653589793
Source code in src/airball/tools.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
calculate_angular_momentum(sim)
Calculates the angular momentum of the system and of each particle in the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to calculate the angular momentum of. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
L |
array
|
The angular momentum of the system and of each particle in the system. |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
airball.tools.calculate_angular_momentum(sim)
Source code in src/airball/tools.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
calculate_eccentricity(sim, star)
Calculates the eccentricity of the flyby star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to calculate the eccentricity with respect to. |
required |
star
|
Star
|
The Star to calculate the eccentricity of. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
e |
float
|
The eccentricity of the flyby star. |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
star = airball.Star(m=1, b=500, v=5)
airball.tools.calculate_eccentricity(sim, star)
Source code in src/airball/tools.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
calculate_periastron(sim, star)
Using the impact parameter and the relative velocity at infinity between the two stars convert to the periastron of the flyby star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to calculate the periastron with respect to. |
required |
star
|
Star
|
The Star to calculate the periastron of. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
star_q |
Quantity
|
The periastron of the flyby star. |
Source code in src/airball/tools.py
529 530 531 532 533 534 535 536 537 538 539 540 541 | |
cartesian_elements(sim, star, rmax, values_only=False)
Returns the Cartesian elements in the Heliocentric frame, based on the total mass of the REBOUND Simulation. Implemented from REBOUND using Numpy to handle vectorization.
Args: sim (Simulation): The simulation with two bodies, a central star and a planet. star (Star): The star that is flying by. rmax (float): The starting distance of the flyby star. Defaults to units of AU. values_only (bool): Whether to return only the values of the hyperbolic orbital elements. If True, then the results can be used to add a new particle to a REBOUND Simulation. Defaults to False.
Returns:
| Name | Type | Description |
|---|---|---|
elements |
dict
|
A dictionary containing the hyperbolic orbital elements: |
values_only |
dict
|
A dictionary containing the hyperbolic orbital elements: |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the value for |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
star = airball.Star(m=1, b=500, v=5)
elements = hyperbolic_elements(sim, star, rmax=100)
Source code in src/airball/tools.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | |
encounter_rate(n, v, q, M, unit_set=_UnitSet())
The expected flyby encounter rate within an stellar environment, \(\Gamma = ⟨nσv⟩\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
float
|
The stellar number density (default units: \(\rm{pc}^{-3}\)) |
required |
v
|
float
|
The average velocity at infinity of the flyby (default units: km/s) |
required |
q
|
float
|
The periastron distance of the flyby (default units: AU) |
required |
M
|
float
|
The total mass of all the objects in the system such as the Sun, planets, star, etc. (default units: \(M_\odot\)) |
required |
unit_set
|
UnitSet
|
The set of units to use for the calculation (default UnitSet units) |
UnitSet()
|
Returns:
| Name | Type | Description |
|---|---|---|
rate |
float
|
The expected flyby encounter rate within an stellar environment |
Source code in src/airball/tools.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | |
gravitational_mu(sim, star=None, star_mass=None)
Calculate the gravitational parameter, mu, of the system. The gravitational parameter is the total mass of the system (Sun, planets, and flyby star) times the gravitational constant G.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to calculate the gravitational parameter of. |
required |
star
|
Star
|
The Star to calculate the gravitational parameter of. |
None
|
star_mass
|
Quantity
|
The mass of the flyby star to calculate the gravitational parameter of. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
mu |
Quantity
|
The gravitational parameter of the system. |
Source code in src/airball/tools.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
hasTrue(a)
Returns True if array a contains at least one element that is True. Returns False otherwise.
Source code in src/airball/tools.py
172 173 174 | |
hist(arr, bins=10, normalize=False, density=False, wfac=1)
Performs a histogram of the provided array over a linearly spaced range of the data using the provided number of bins. The histogram is normalized by the area under the curve if normalize=True. The width of the bins can be altered by the provided factor wfac. Implemented from StackOverflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
array
|
The array to histogram. |
required |
bins
|
int
|
The number of bins to use. |
10
|
normalize
|
bool
|
Whether to normalize the histogram. |
False
|
density
|
bool
|
Whether to return the density of the histogram. |
False
|
wfac
|
float
|
A factor to alter the width of the bins. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
x |
array
|
The bin centers. |
y |
array
|
The histogram values. |
w |
float
|
The width of the bins. |
Source code in src/airball/tools.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
hist10(arr, bins=10, normalize=False, density=False, wfac=1)
Performs a histogram of the provided array over a logarithmically spaced range of the data using the provided number of bins. The histogram is normalized by the area under the curve if normalize=True. The width of the bins can be altered by the provided factor wfac. Implemented from StackOverflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
array
|
The array to histogram. |
required |
bins
|
int
|
The number of bins to use. |
10
|
normalize
|
bool
|
Whether to normalize the histogram. |
False
|
density
|
bool
|
Whether to return the density of the histogram. |
False
|
wfac
|
float
|
A factor to alter the width of the bins. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
x |
array
|
The bin centers. |
y |
array
|
The histogram values. |
w |
float
|
The width of the bins. |
Source code in src/airball/tools.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
hyperbolic_elements(sim, star, rmax, values_only=False)
Calculate the flyby star's hyperbolic orbital elements based on the provided Simulation and starting distance (rmax).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The simulation with two bodies, a central star and a planet. |
required |
star
|
Star
|
The star that is flying by. |
required |
rmax
|
float
|
The starting distance of the flyby star. Defaults to units of AU. |
required |
values_only
|
bool
|
Whether to return only the values of the hyperbolic orbital elements. If True, then the results can be used to add a new particle to a REBOUND Simulation. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
elements |
dict
|
A dictionary containing the hyperbolic orbital elements: |
values_only |
dict
|
A dictionary containing the hyperbolic orbital elements: |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the value for |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
star = airball.Star(m=1, b=500, v=5)
elements = hyperbolic_elements(sim, star, rmax=100)
print(elements["a"])
Source code in src/airball/tools.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
hyperbolic_plane(sim, star)
Calculate the plane of the hyperbolic orbit of the flyby star using the position and velocity vectors of the flyby star when the star is a perihelion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The simulation with two bodies, a central star and a planet. |
required |
star
|
Star
|
The star that is flying by. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AB |
dict
|
The normalized vectors defining the plane of the hyperbolic orbit. The vectors are |
Source code in src/airball/tools.py
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
impulse_gradient(star)
Calculate the impulse gradient for a flyby star, \(\frac{2 G M}{v b^2}\).
Source code in src/airball/tools.py
807 808 809 810 | |
integrate(sims, tmaxes, n_jobs=-1, verbose=0)
Integrates the provided list of REBOUND Simulations to the provided times in a parallelized manner. The parallalization uses the joblib package, so the returned list of Simulations will be copies of the original Simulations. The original Simulations will not be modified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sims
|
list
|
A list of REBOUND Simulations. |
required |
tmaxes
|
list
|
A list of times to integrate each Simulation to. |
required |
n_jobs
|
int
|
The number of cores to use for parallelization. Default is -1 which uses all available cores. |
-1
|
verbose
|
int
|
The verbosity level. Default is 0 which is silent. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
sim_results |
list
|
A list of the integrated REBOUND Simulations. |
Source code in src/airball/tools.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
isList(array)
Determines if an object is a list or numpy array.
Source code in src/airball/tools.py
943 944 945 946 947 948 949 950 951 | |
isQuantity(var)
Determines if an object is an Astropy Quantity. Used for Stellar Environment initializations.
Source code in src/airball/tools.py
954 955 956 | |
link_c_heartbeat_with_rebound_c_library(filename, file_contents)
Prepare a C-Heartbeat function for use.
- Temporarily download the most recent version of REBOUND.
- Checkout the version of REBOUND currently being used.
- Compile the REBOUND library
- Compile the C-Heartbeat function using the REBOUND header file.
- Link the REBOUND C-library generating a C-Heartbeat library.
Source code in src/airball/tools.py
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | |
maxwell_boltzmann_dispersion_from_scale(scale)
Converts velocity dispersion (variance) \(\sigma\) to scale factor \(a\) for Maxwell-Boltzmann distributions, \(\sigma = a \sqrt{\frac{(3\pi - 8)}{\pi}}\).
Source code in src/airball/tools.py
818 819 820 821 822 | |
maxwell_boltzmann_mean_from_dispersion(sigma)
Converts velocity dispersion (variance) \(\sigma\) to mean \(\mu\) for Maxwell-Boltzmann distributions, \(\mu = 2 \sqrt{\frac{2\sigma^2}{3\pi - 8}}\).
Source code in src/airball/tools.py
839 840 841 842 843 844 | |
maxwell_boltzmann_mode_from_dispersion(sigma)
Converts velocity dispersion \(\sigma\) to mode (most common or typical value) for Maxwell-Boltzmann distributions, \(\rm{mode}= \sqrt{\frac{2\pi\sigma^2}{3\pi - 8}}\).
Source code in src/airball/tools.py
847 848 849 850 851 852 | |
maxwell_boltzmann_scale_from_dispersion(sigma)
Converts velocity dispersion (variance) \(\sigma\) to scale factor \(a\) for Maxwell-Boltzmann distributions, \(a = \sqrt{\frac{\pi\sigma^2}{3\pi - 8}}\).
Source code in src/airball/tools.py
825 826 827 828 829 | |
maxwell_boltzmann_scale_from_mean(mu)
Converts mean \(\mu\) to scale factor for Maxwell-Boltzmann distributions, \(a = \frac{\mu}{2}\sqrt{\frac{\pi}{2}}\).
Source code in src/airball/tools.py
832 833 834 835 836 | |
mod2pi(f)
Converts an angle to the range [0, 2pi). Implemented from REBOUND using Numpy to handle vectorization.
Source code in src/airball/tools.py
318 319 320 | |
moving_average(a, n=3, method=None)
Compute the moving average of an array of numbers using the nearest n elements. Adapted from StackOverflow.
The options for handling NaN values are: 'nn' (nearest neighbor), 'nan' (ignore NaNs), and None. The default is None which uses numpy.cumsum. The 'nn' method is slower than 'nan' but attempts to replace the NaN values with the average of the adjacent values. Thus, if the adjacent values are NaN, then it will also return NaN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
array
|
The array of numbers to compute the moving average of. |
required |
n
|
int
|
The number of elements to use in the moving average. |
3
|
method
|
str
|
The method to use for handling NaN values. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
result |
ndarray
|
The moving average of the array of numbers. |
Example
import airball
import numpy as np
a = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(airball.tools.moving_average(a, n=3)) # [2. 3. 4. 5. 6. 7. 8. 9.]
Source code in src/airball/tools.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
moving_median(arr, n=3, method=None)
Compute the moving median of an array of numbers using the nearest n elements. Adapted from StackOverflow.
The options for handling NaN values are: 'nn' (nearest neighbor), 'nan' (ignore NaNs), and None. The default is None which uses numpy.cumsum. The 'nn' method is not implemented and defaults to 'nan'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
array
|
The array of numbers to compute the moving median of. |
required |
n
|
int
|
The number of elements to use in the moving median. |
3
|
method
|
str
|
The method to use for handling NaN values. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
result |
ndarray
|
The moving median of the array of numbers. |
Example
import airball
import numpy as np
a = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(airball.tools.moving_median(a, n=3)) # [2. 3. 4. 5. 6. 7. 8. 9.]
Source code in src/airball/tools.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
notNone(a)
Returns True if array a contains at least one element that is not None. Returns False otherwise., Implemented from REBOUND particle.py
Source code in src/airball/tools.py
167 168 169 | |
numberOfElementsReturnedBySlice(start, stop, step)
Returns the number of elements returned by the slice(start, stop, step) function.
Source code in src/airball/tools.py
177 178 179 | |
q2b(mu, q, v, unit_set=_UnitSet())
Converting from the perihelion \(q\) to the impact parameter \(b\) considers gravitational focussing where \(b = q \sqrt(1 + \frac{2GM}{q v_∞^2})\) is the impact parameter, \(q\) is the perihelion, \(v_∞\) is the relative velocity at infinity, and \(M\) is the total mass of the flyby star and system experiencing the flyby encounter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
Quantity
|
The total mass of the system (Sun, planets, and flyby star) times the gravitational constant G |
required |
q
|
float
|
The perihelion distance (default units: AU) |
required |
v
|
float
|
The typical velocity from the distribution (default units: km/s) |
required |
unit_set
|
UnitSet
|
The set of units to use for the calculation (default UnitSet units) |
UnitSet()
|
Source code in src/airball/tools.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
rebound_units(sim)
Converts the units of a REBOUND Simulation into Astropy Units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to convert the units of. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
simunits |
UnitSet
|
The units of the REBOUND Simulation. |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
airball.tools.rebound_units(sim) # UnitSet with length==au, mass==solMass, and time==yr2pi
Source code in src/airball/tools.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | |
rotate_into_plane(sim, plane='invariable')
Rotates the simulation into the specified plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation containing the star and planets that will experience a flyby. |
required |
plane
|
(str, int)
|
The plane defining the orientation of the star: None, 'invariable', 'ecliptic', or int. |
'invariable'
|
Returns:
| Name | Type | Description |
|---|---|---|
rotation |
Rotation
|
The rotation that was applied to the simulation. |
Source code in src/airball/tools.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
save_as_simulationarchive(filename, sims, delete_file=True)
Saves a list of REBOUND Simulations as a SimulationArchive.
Source code in src/airball/tools.py
159 160 161 162 163 164 | |
semilatus_rectum(**kwargs)
Calculate the semi-latus rectum of a hyperbolic orbit, \(l = a(1-e^2)\).
Source code in src/airball/tools.py
565 566 567 | |
system_mass(sim)
The total bound mass of the system. The total bound mass is the mass of the central star plus the mass of all the objects on bound orbits around the central star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
The REBOUND Simulation to calculate the system mass of. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
total_mass |
Quantity
|
The total bound mass of the system. |
Source code in src/airball/tools.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
timestep_for_perihelion_resolution(sim)
Calculate the timestep required to resolve the perihelion of the orbiting bodies, see Hernandez, Zeebe, & Hadden (2023).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
Simulation
|
a REBOUND Simulation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
timestep |
float
|
The timestep required to resolve the perihelion of the orbiting bodies. If there are no orbiting bodies, then NAN is returned. |
Example
import rebound
import airball
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=5e-5, a=30)
print(airball.tools.timestep_for_perihelion_resolution(sim)) # 63.73977
Source code in src/airball/tools.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
unit_vector(vector)
Returns the unit vector of the vector. Fails if the vector is a list of Quantity objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
array
|
The vector to convert to a unit vector. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vector |
array
|
The unit vector of the vector. |
Source code in src/airball/tools.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
verify_unit(value, unit)
Verifies that the given value has the provided units. If the value is a Quantity and the units are not the same, then the value is converted to the provided units. If the value is not a Quantity, then the value is converted to a Quantity with the provided units. If the value is a numpy array, then the units are applied to each element of the array.
Source code in src/airball/tools.py
938 939 940 | |
vinf_and_b_to_e(mu, star_b, star_v)
Using the impact parameter to convert from the relative velocity at infinity between the two stars to the eccentricity of the flyby star. Equation (2) from Spurzem et al. (2009)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
Quantity
|
The total mass of the system (Sun, planets, and flyby star) times the gravitational constant G |
required |
star_b
|
Quantity
|
The impact parameter, |
required |
star_v
|
Quantity
|
The relative velocity at infinity between the central star and the flyby star (hyperbolic excess velocity). Default units are km/s. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
star_e |
Quantity
|
The eccentricity of the flyby star. |
Source code in src/airball/tools.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | |
vinf_and_b_to_q(mu, star_b, star_v)
Using the impact parameter to convert from the relative velocity at infinity between the two stars to the eccentricity of the flyby star. Equation (2) from Spurzem et al. (2009)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
Quantity
|
The total mass of the system (Sun, planets, and flyby star) times the gravitational constant G |
required |
star_b
|
Quantity
|
The impact parameter, |
required |
star_v
|
Quantity
|
The relative velocity at infinity between the central star and the flyby star (hyperbolic excess velocity). Default units are km/s. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
star_e |
Quantity
|
The eccentricity of the flyby star. |
Source code in src/airball/tools.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
vinf_and_q_to_b(mu, star_q, star_v)
Using the perihelion to convert from the relative velocity at infinity between the two stars to the eccentricity of the flyby star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
Quantity
|
The total mass of the system (Sun, planets, and flyby star) times the gravitational constant G |
required |
star_q
|
Quantity
|
The perihelion of the flyby star |
required |
star_v
|
Quantity
|
The relative velocity at infinity between the central star and the flyby star (hyperbolic excess velocity) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
star_b |
Quantity
|
The impact parameter, |
Source code in src/airball/tools.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
vinf_and_q_to_e(mu, star_q, star_v)
Using the perihelion to convert from the relative velocity at infinity between the two stars to the eccentricity of the flyby star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
Quantity
|
The total mass of the system (Sun, planets, and flyby star) times the gravitational constant G |
required |
star_q
|
Quantity
|
The perihelion of the flyby star |
required |
star_v
|
Quantity
|
The relative velocity at infinity between the central star and the flyby star (hyperbolic excess velocity) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
star_e |
Quantity
|
The eccentricity of the flyby star. |
Source code in src/airball/tools.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |