Stellar dynamics
mlpoppyns.simulator.stellar_dynamics.coordinate_conversions
Conversions between different coordinate systems and related issues.
Authors:
Vanessa Graber (graber@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
check_radial_coordinate(r)
Check that the distance from the origin is not negative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the origin in units of length. |
required |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
20 21 22 23 24 25 26 27 28 | |
convert_cylindrical_to_all_coordinates(dict_pop_dyn)
Converts a population's positions and velocities from galactocentric cylindrical (polar) coordinates to ICRS, and galactic coordinate frames.
The resulting sky coordinates, distances, proper motions and line of sight velocity are added to the input dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_pop_dyn
|
dict
|
A dictionary containing the initial polar coordinates and velocities of a population of neutron stars. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The input dictionary
|
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
galactocentric_to_galactic(x, y, z, v_x, v_y, v_z)
Calculating the galactic longitude l, galactic latitude b, distance, pm_l, pm_b proper motion components and line of sight velocity v_ls from the galactocentric coordinates x, y, z and velocity v_x, v_y, v_z. The galactocentric coordinates refer to the galactocentric reference frame defined as a right-handed reference frame with the Sun located at the coordinate point (x = 0 kpc, y = 8.3 kpc, z = 0.02 kpc). We use the astropy.coordinates package that allows automatic conversions between coordinate systems. l = 0 deg, b = 0 deg corresponds to the location of the Galactic center, l increase anticlockwise (in the direction of galactic rotation as seen from the Sun) and ranges in the interval [-180, 180] deg while b is in the range [-90, 90] deg.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
x coordinate in [kpc] in the galactocentric reference frame. |
required |
y
|
ndarray
|
y coordinate in [kpc] in the galactocentric reference frame. |
required |
z
|
ndarray
|
z coordinate in [kpc] in the galactocentric reference frame. |
required |
v_x
|
ndarray
|
x component of the velocity in [km/s] in galactocentric reference frame. |
required |
v_y
|
ndarray
|
y component of the velocity in [km/s] in galactocentric reference frame. |
required |
v_z
|
ndarray
|
z component of the velocity in [km/s] in galactocentric reference frame. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray]
|
Galactic longitude l, Galactic latitude b in [deg], distance in [kpc], pm_l, pm_b proper motion components in [mas/yr] and line of sight velocity v_ls in [km/s]. |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
galactocentric_to_icrs(x, y, z, v_x, v_y, v_z)
Calculating the ICRS (International Celestial Reference Frame) coordinates RA, DEC, distance and proper velocities v_RA, v_DEC, v_ls from galactocentric spatial coordinates and velocities x, y, z, v_x, v_y and v_z. This galactocentric coordinates refers to the galactocentric reference frame used in the simulation defined as a right-handed reference frame with the Sun located at the coordinate point (x = 0 kpc, y = 8.5 kpc, z = 0.02 kpc). We use the astropy.coordinates package that allows automatic conversions between coordinate systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
x coordinate in [kpc] in galactocentric reference frame. |
required |
y
|
ndarray
|
y coordinate in [kpc] in galactocentric reference frame. |
required |
z
|
ndarray
|
z coordinate in [kpc] in galactocentric reference frame. |
required |
v_x
|
ndarray
|
x velocity component in [km/s] in galactocentric reference frame. |
required |
v_y
|
ndarray
|
y velocity component in [km/s] in galactocentric reference frame. |
required |
v_z
|
ndarray
|
z velocity component in [km/s] in galactocentric reference frame. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray]
|
RA, DEC coordinates in [deg], distance from the ICRS origin in [kpc], proper motion pm_RA, pm_DEC components in [mas/yr] in the ICRS reference frame and the line of sight velocity in [km/s]. |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
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 126 127 128 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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
polar_to_cartesian(r, phi)
Calculating the Cartesian x and y coordinates from plane polar r and phi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Radial component (magnitude of the vector) in plane polar coordinates, r>0. |
required |
phi
|
ndarray
|
Angular coordinate, [0, 2*pi]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
x and y coordinates in a Cartesian system. |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
speed_cylindrical_to_cartesian(v_r, v_phi, v_z, phi)
Calculating the galactocentric Cartesian v_x, v_y and v_z velocity components from cylindrical galactocentric components v_r, v_phi and v_z.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_r
|
ndarray
|
Radial velocity component in a cylindrical galactocentric frame. |
required |
v_phi
|
ndarray
|
Azimuthal velocity component in a cylindrical galactocentric frame. |
required |
v_z
|
ndarray
|
z velocity component in a cylindrical galactocentric frame. |
required |
phi
|
ndarray
|
Azimuthal angle [0, 2*pi] in cylindrical coordinates. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray, ndarray]
|
v_x, v_y and v_z velocity components in a Cartesian galactocentric frame. |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
spherical_to_cartesian(r, theta, psi)
Calculating the Cartesian x, y and z coordinates from spherical coordinates r, theta and psi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Radial component (magnitude of the vector) in spherical coordinates, r>0. |
required |
theta
|
ndarray
|
Polar angle, [0, pi]. |
required |
psi
|
ndarray
|
Azimuthal angle, [0, 2*pi]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray, ndarray]
|
x, y and z coordinates in a Cartesian system. |
Source code in mlpoppyns/simulator/stellar_dynamics/coordinate_conversions.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
mlpoppyns.simulator.stellar_dynamics.dynamical_evolution
Dynamical evolution of the neutron stars in the galactic potential.
We solve the system of dynamical differential equations in cylindrical coordinates, using a galactocentric reference frame. Here we are using the scipy.integrate.odeint package which uses the method 'LSODA' (Adams/BDF method with automatic stiffness detection and switching) from the Fortran library ODEPACK.
We improve performance with Numba, which allows just-in-time (JIT) compilation.
Authors:
Vanessa Graber (graber@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
check_angular_momentum_energy_conservation(dict_pop_initial_dyn, dict_pop_final_dyn, logger)
This function computes the total energy and angular momentum (L_z) of a stellar population before and after a dynamical evolution. It reports the percentage variation of each quantity to assess conservation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_pop_initial_dyn
|
dict
|
Dictionary containing the initial dynamical properties of the population. |
required |
dict_pop_final_dyn
|
dict
|
Dictionary containing the final dynamical properties of the population. |
required |
logger
|
Logger
|
Logger instance used to output conservation diagnostics (energy and angular momentum variations). |
required |
Source code in mlpoppyns/simulator/stellar_dynamics/dynamical_evolution.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 | |
dynamical_eq_system(t, initial_cond, galactic_model)
System of dynamical equations to solve to determine the orbits of the neutron stars in the galactic potential. The differential equation are written in cylindrical galactocentric coordinates (r, phi, z).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Unused time variable, required for the integration below. |
required |
initial_cond
|
ndarray
|
Array of 6 components defining the initial conditions in cylindrical coordinates (r0, phi0, z0, v_r0, omega0, v_z0) with the following units ([kpc], [rad], [kpc], [kpc/yr], [rad/yr], [kpc/yr]). |
required |
galactic_model
|
GalaxyModelBase
|
A galactic model to calculate the needed potential. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of 6 values of the first order and second order derivatives at each time step. |
Source code in mlpoppyns/simulator/stellar_dynamics/dynamical_evolution.py
83 84 85 86 87 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 126 127 | |
dynamical_evolution(initial_cond, t_age)
Performing the dynamical evolution of the neutron star population for a given galactic potential, starting from a set of initial conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_cond
|
ndarray
|
Array of 6 components defining the initial conditions in cylindrical coordinates (r0, phi0, z0, v_r0, omega0, v_z0) with the following units ([kpc], [rad], [kpc], [kpc/yr], [rad/yr], [kpc/yr]). |
required |
t_age
|
ndarray
|
Array of neutron star ages in [yr]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, dict]
|
Tuple consisting of a two-dimensional array of shape (NS_number, 6) defining the neutron stars' final positions r [kpc], phi [rad], z [kpc] and velocities in [kpc/yr] in cylindrical coordinates and a dictionary containing the time evolution of these quantities for each neutron star (if the option to save the time evolution is enabled). |
Source code in mlpoppyns/simulator/stellar_dynamics/dynamical_evolution.py
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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
evolve_population_dyn(dict_pop_initial_dyn, output_path)
Evolve the dynamical properties of a neutron star population over time based on initial conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_pop_initial_dyn
|
dict
|
Dictionary containing initial magneto-rotational properties of the population. |
required |
output_path
|
Path
|
The path where the evolution data will be saved if enabled in the configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing the properties of the evolved neutron star population. |
Source code in mlpoppyns/simulator/stellar_dynamics/dynamical_evolution.py
231 232 233 234 235 236 237 238 239 240 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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
initialize_population_dyn(age)
Initialize the dynamical properties of a neutron star population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age
|
ndarray
|
An array of ages in [yr] for the neutron stars in the population to be initialized. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing the initialized dynamical properties of the neutron star population. |
Source code in mlpoppyns/simulator/stellar_dynamics/dynamical_evolution.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
mlpoppyns.simulator.stellar_dynamics.galactic_model
Model for the Milky Way gravitational potential.
We consider two different models:
1) gmFK06: A galactic structure as in Faucher-Giguère & Kaspi (2006). Their model consists of three components: a disk-halo, a bulge and a nucleus. The parameters of the model are taken from Table B1 in Kuijken & Gilmore (1989).
2) gmM19: The galaxy model from Marchetti et al. (2019). This is a four-component galactic potential model consisting of a Hernquist bulge and nucleus (Hernquist 1990), a Miyamoto-Nagai disk (Miyamoto & Nagai 1975) and a Navarro-Frenk-White halo (Navarro et al. 1996). The parameters of the model are taken from Table 1 in Marchetti et al. (2019) and are chosen to fit the enclosed mass profile of the Milky Way (Bovy 2015).
To improve performance when evolving the neutron stars' position in the galactic potential (see dynamical_evolution.py), we add Numba's jit decorator to all functions.
Authors:
Vanessa Graber (graber@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
GalaxyModelBase
Base class for any galaxy model to ensure that a common interface between all of them is respected. The following abstract methods must be implemented or an error will be raised.
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
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 85 86 87 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 126 | |
total_angular_momentum_z(v_phi, r)
Value of the z-component of the total angular momentum of the system, which is a conserved quantity in axisymmetric potentials. We assume here that all the stars have unit mass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_phi
|
ndarray
|
Array of magnitudes of the orbital speed of the stars in [km/s]. |
required |
r
|
ndarray
|
Array of distances from the galactic axis in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Value of the total energy of the system in [erg]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
total_energy(v, r, z)
Value of the total energy of the system, sum of the total kinetic energy and the total gravitational potential energy. We assume here that all the stars have unit mass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
Array of magnitudes of the speed of the stars in [km/s]. |
required |
r
|
ndarray
|
Array of distances from the galactic axis in [kpc]. |
required |
z
|
ndarray
|
Array of distances from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Value of the total energy of the system in [erg]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
GalaxyModelFK06
Bases: GalaxyModelBase
Galaxy model from Faucher-Giguère & Kaspi (2006). This model consists of a disk-halo component, a bulge component, and a nucleus component. The parameters of the model are taken from Table 1 in Kuijken & Gilmore (1989) (in Faucher-Giguère & Kaspi (2006) the nucleus and bulge are erroneously inverted).
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 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 660 661 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 700 701 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 | |
MW_potential(r, z)
Total Milky Way gravitational potential defined in eq. (13) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the Galactic potential in [erg]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
b_potential(r, z)
A spherical bulge component gravitational potential as defined in eq. (15) in Faucher-Giguère & Kaspi (2006). Note that we assume this potential to be spherical following Carlberg & Innanen (1987), while Faucher-Giguère & Kaspi take r to be the cylindrical coordinate, not the spherical one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance in the galactic disk from the galactic centre in [kpc]. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the bulge potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
cylind_coord_gradient_mw_potential(r, z)
Gradient in cylindrical coordinates of the Milky Way gravitational potential defined in eq. (13) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Gradient of the galactic potential in cylindrical coordinates. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
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 | |
dh_potential(r, z)
A cylindrical disk-halo component gravitational potential as defined in eq. (14) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the disk-halo potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
n_potential(r, z)
A spherical nucleus component gravitational potential as defined in eq. (15) in Faucher-Giguère & Kaspi (2006). Note that we assume this potential to be spherical following Carlberg & Innanen (1987), while Faucher-Giguère & Kaspi take r to be the cylindrical coordinate, not the spherical one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the nucleus potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
r_z_derivatives_b_potential(r, z)
Derivatives with respect to r and z of the bulge component gravitational potential defined in eq. (15) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Derivatives with respect to r and z of the bulge potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
r_z_derivatives_dh_potential(r, z)
Derivatives with respect to r and z of the disk-halo component gravitational potential defined in eq. (14) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Derivatives with respect to r and z of the disk-halo potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
r_z_derivatives_n_potential(r, z)
Derivatives with respect to r and z of the nucleus component gravitational potential defined in eq. (15) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Derivatives with respect to r and z of the nucleus potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
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 | |
shape_parameter(z)
Shape parameter for the disk-halo potential from Carlberg & Innamen (1987) and its derivative with respect to the height z from the galactic disk. First term in the denominator of eq. (13) in Faucher-Giguère & Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Value of the shape parameter and its derivative with respect to z. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
GalaxyModelM19
Bases: GalaxyModelBase
Galaxy model from Marchetti et al. (2019). This is a four-component galactic potential model consisting of a Hernquist bulge and nucleus (Hernquist 1990), a Miyamoto-Nagai disk (Miyamoto & Nagai 1975) and a Navarro-Frenk-White halo (Navarro et al. 1996). The parameters of the model are taken from Table 1 in Marchetti et al. (2019) and are chosen to fit the enclosed mass profile of the Milky Way (Bovy 2015).
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 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 239 240 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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 395 396 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 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
MW_potential(r, z)
Total Milky Way gravitational potential in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the Galactic potential in [erg]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
b_potential(r, z)
A spherical Hernquist bulge component gravitational potential as defined in eq. (7) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the bulge potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
cylind_coord_gradient_mw_potential(r, z)
Gradient in cylindrical coordinates of the Milky Way gravitational potential for the components defined in eq. (7,8,9) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Gradient of the galactic potential in cylindrical coordinates. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
d_potential(r, z)
A cylindrical Miyamoto-Nagai disk component gravitational potential as defined in eq. (8) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the disk-halo potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
h_potential(r, z)
A spherical Navarro-Frenk-White halo component gravitational potential as defined in eq. (9) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the bulge potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
n_potential(r, z)
A spherical Hernquist nucleus component gravitational potential as defined in eq. (7) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
ndarray
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Value of the bulge potential in [erg/g]. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
r_z_derivatives_b_potential(r, z)
Derivatives with respect to r and z of the bulge component gravitational potential defined in eq. (7) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns: (Tuple[float, float]): Derivatives with respect to r and z of the bulge potential.
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
r_z_derivatives_d_potential(r, z)
Derivatives with respect to r and z of the disk component gravitational potential defined in eq. (8) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Derivatives with respect to r and z of the disk potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
r_z_derivatives_h_potential(r, z)
Derivatives with respect to r and z of the halo component gravitational potential defined in eq. (9) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Derivatives with respect to r and z of the halo potential. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
r_z_derivatives_n_potential(r, z)
Derivatives with respect to r and z of the nucleus component gravitational potential defined in eq. (7) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance from the galactic rotation axis in [kpc], i.e., cylindrical r coordinate. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns: (Tuple[float, float]): Derivatives with respect to r and z of the nucleus potential.
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
shape_parameter(z)
Shape parameter for the disk potential from Marchetti et al. (2019) and its derivative with respect to the height z from the galactic disk. Second term in the denominator of eq. (8) in Marchetti et al. (2019).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Value of the shape parameter and its derivative with respect to z. |
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
initialize_galactic_model()
Initializing the galactic model employed in the simulation. We have implemented two versions, i.e., the galactic structure of Faucher-Giguère & Kaspi (2006) (with parameters from Kuijken & Gilmore (1989)) and Galaxy model from Marchetti et al. (2019). The galactic_model variable is made available on a global level.
Source code in mlpoppyns/simulator/stellar_dynamics/galactic_model.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
mlpoppyns.simulator.stellar_dynamics.initial_position
Initial galactocentric position for the stellar population.
We follow Faucher-Giguère & Kaspi (2006) and choose a galactocentric coordinate system, where the Galactic center is located at the origin. In terms of Galactic latitude l and longitude b, the x-,y-, and z-axes are parallel to (l, b) = (90, 0), (180, 0) and (0, 90), respectively, forming a right-handed Cartesian frame. This implies that the Sun is positioned at (x=0, y=8.5 kpc). Moreover, we define r = (x^2 + y^2)^0.5 as the distance from the Galactic center in the Galactic plane and phi = arctan(y/x). Here, the angle phi is the same as theta in Faucher-Giguère & Kaspi (2006). We reserve the variable theta for the polar angle in a spherical coordinate system.
Authors:
Vanessa Graber (graber@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
calculate_noise_for_coordinates(r, NS_number)
Calculating noise for the angular and radial coordinate to smear out the distribution and avoid artificial features near the Galactic center; see Sec. 3.2.1 in Faucher-Giguère & Kaspi (2006) for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Array of distances from the Galactic center in [kpc]. |
required |
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Array of noise for the galactocentric coordinates phi [rad], r [kpc]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
calculate_r_phi_electron_density(t_age)
Calculating the position at birth of each random neutron star in a cylindrical reference frame according to the Galactic electron density distribution ymw16 (see Yao et al. 2017).
Using the notebook ns_distribution_ne_model.ipynb, we create a 2D NumPy array containing the electron density distribution in polar coordinates (r, phi). This 2D array is saved in the file YMW16_density_model.npy in mlpoppyns/simulator/stellar_dynamics, and it is used to sample the neutron star positions in the Galaxy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_age
|
ndarray
|
Array of neutron star ages in [yr]. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Polar r and phi coordinates in [kpc] and [rad], respectively, for each generated neutron star. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
calculate_r_phi_spiral_model(t_age, spiral_model)
Calculating the position at birth of each random neutron star in a cylindrical reference frame for a given radial and spiral arm model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_age
|
ndarray
|
Array of neutron star ages in [yr]. |
required |
spiral_model
|
SpiralModelBase
|
A class specifying the spiral arm structure model. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Polar r and phi coordinates in [kpc] and [rad], respectively, for each generated neutron star. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
calculate_z(NS_number)
Drawing a random distance from the Galactic plane in [kpc] for each neutron star according to the probability density function for the height, and randomly distribute the stars above and below the Galactic plane, since we expect that this distribution to be symmetric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
NS_number
|
int
|
Number of neutron stars for which to draw a distance from the Galactic plane. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of distances z from the Galactic plane in [kpc] for the simulated neutron star. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
pdf_initial_height(z)
Probability density function for the height from the Galactic equatorial plane according to eq. (2) in Gullon et al. (2014).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Distance from the Galactic plane in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Distribution of stars per kpc in z direction. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
pdf_radial_density_VV21(r)
The Milky Way's radial density of supernova remnants including both core-collapse and thermonuclear supernovae. The model distribution is the exponential model from eq. (9) from the work of Verberne & Vink (2021).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the Galactic center in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
SNR radial density in [1/kpc]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
pdf_radial_density_YK04(r)
The Milky Way's stellar radial density in the Galactic plane according to eq. (15) of Yusifov & Küçük (2004).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distance from the Galactic center in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Stellar radial density in [1/kpc]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
random_scatter_about_plane(z, NS_number)
Randomly distribute positive height values within z about the Galactic plane located at z=0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Array of heights in [kpc] with positive values. |
required |
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of heights in [kpc] randomly scattered above or below 0. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
smear_initial_coordinates(r, phi, NS_number)
Smear the initial radial and angular coordinates in the galactocentric frame by adding noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distances from the Galactic center in [kpc]. |
required |
phi
|
ndarray
|
Azimuthal coordinate of the stars on the spiral arms [rad]. |
required |
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Galactocentric coordinates phi [rad], r [kpc] with noise applied. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
spiral_arm_time_evol(phi0, t)
Evolving the spiral arm positions backward for a given age t. We assume that the Galactic spiral structure rotates rigidly in clockwise direction with a period of 250 Myr (see 'A guided map to the spiral arms in the Galactic disk of the Milky Way' by Vallée (2017)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi0
|
ndarray
|
Current angular positions in [rad] for the chosen spiral pattern. |
required |
t
|
ndarray
|
Times in [yr] to propagate backward. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Angular positions in [rad] for the spiral pattern as they were t years ago. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_position.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
mlpoppyns.simulator.stellar_dynamics.initial_velocity
Initial velocity distribution for the stellar population.
The velocity is composed of two contributions, the neutron stars' proper motion caused by kicks during the supernova as well as the motion of the galaxy itself. For the former, we follow Gullon et al. (2014).
Authors:
Vanessa Graber (graber@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
circular_velocity(r, z)
Circular velocity in [kpc/yr] for a circular orbit at a distance r from the galactic center and at a height z from the galactic plane. This velocity is evaluated by assuming equilibrium between the gravitational acceleration in the r direction due to the galactic potential and the centrifugal acceleration due to rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Distance in the galactic disk from the galactic center in [kpc]. |
required |
z
|
float
|
Height from the galactic disk in [kpc]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Value of the circular velocity in [kpc/yr]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
kick_velocity_double_maxwell(NS_number)
Draw random kick velocity values from a double Maxwell distribution as suggested in Igoshev (2020).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Kick velocities in [kpc/yr]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
kick_velocity_exp(NS_number)
Draw random kick velocity values from an exponential distribution as suggested in Faucher-Giguère amd Kaspi (2006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Kick velocities in [kpc/yr]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
kick_velocity_lognormal(mean, sigma, NS_number)
Draw random kick velocity values from a double Maxwell distribution as suggested in Disberg and Mandel (2025).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mean
|
float
|
Mean of the log-normal distribution. |
required |
sigma
|
float
|
Standard deviation of the log-normal distribution, in [s]. |
required |
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Kick velocities in [kpc/yr]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
kick_velocity_maxwell(NS_number)
Draw random kick velocity values from a Maxwell distribution as suggested in Hobbs et al. (2005).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
NS_number
|
int
|
Total number of neutron stars created in the simulation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Kick velocities in [kpc/yr]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
pdf_kick_velocity_double_maxwell(v)
Double Maxwell probability density function for the neutron stars' initial kick velocity magnitude following eq. (5) and section 4.2 in Igoshev (2020).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
Initial kick velocity magnitude in [km/s]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Stellar kick velocity distribution in [1/(km/s)]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
pdf_kick_velocity_exp(v)
Spherically symmetric exponential probability density function for the neutron stars' initial kick velocity magnitude following eq. (5) in Ofek (2009).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
Initial kick velocity magnitude in [km/s]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Stellar kick velocity distribution in [1/(km/s)]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
pdf_kick_velocity_maxwell(v)
Maxwell probability density function for the neutron stars' initial kick velocity magnitude following section 6.2 in Hobbs et al. (2005).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
Initial kick velocity magnitude in [km/s]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Stellar kick velocity distribution in [1/(km/s)]. |
Source code in mlpoppyns/simulator/stellar_dynamics/initial_velocity.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
mlpoppyns.simulator.stellar_dynamics.load_dynamical_database
Module to load a dynamically evolved population database.
Authors:
Vanessa Graber (graber @ ice.csic.es)
Michele Ronchi (ronchi @ ice.csic.es)
Alberto Garcia-Garcia (garciagarcia @ ice.csic.es)
Celsa Pardo Araujo (pardo @ ice.csic.es)
load_database_dyn(dyn_path, n_batchsize, idx_remove, logger)
Load a batch of a dynamically evolved population from a .csv file, convert coordinates and return a dictionary with the dynamical information of the selected stars.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dyn_path
|
Path
|
Path to the directory containing the dynamically evolved population data. |
required |
n_batchsize
|
int
|
Batch size of stars to select when loading the data. |
required |
idx_remove
|
list
|
List of indices to remove from the dynamical database. |
required |
logger
|
Logger
|
Logger to use. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing the data of the selected dynamical population chunk. |
Source code in mlpoppyns/simulator/stellar_dynamics/load_dynamical_database.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
mlpoppyns.simulator.stellar_dynamics.spiral_model
Model for the Milky Way spiral arms.
We consider two different models:
1) saFK06: A galactic spiral structure according to eq. (12) of Faucher-Giguère & Kaspi (2006) (see also Wainscoat et al. 1992). Their model consists of four arms plus a Local arm from Wainscoat et al. (1992).
2) saYMW17: A galactic spiral structure according to eq. (12) of Faucher-Giguère & Kaspi (2006) but with parameters re-adapted from Yao et al. (2017). Their model consists of four arms plus a Local arm from Hou et al. (2014).
Authors:
Michele Ronchi (ronchi@ice.csic.es)
SpiralModelBase
Base class for any spiral model to ensure that a common interface between all of them is respected. The following abstract methods must be implemented or an error will be raised.
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.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 85 86 87 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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
calculate_phi(r, arm_index)
Calculating the angular coordinates of a neutron star for a given distance from the galactic center incorporating the Milky Way's arm structure according to eq. (12) of Faucher-Giguère & Kaspi (2006) (see also Wainscoat et al. 1992).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Distances from the galactic center in [kpc]. |
required |
arm_index
|
ndarray
|
indices for the respective spiral arms, 0 < arm_index < 6. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Galactocentric phi coordinates in [rad]. |
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
check_arm_index(arm_index)
Check that the index for the spiral galaxy arms is not <1 or >5.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arm_index
|
ndarray
|
Index for the respective spiral arms. |
required |
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
98 99 100 101 102 103 104 105 106 | |
generate_arm_index(arm_number, NS_number)
Generate an array of indices related to the spiral arm associated to each star according to a probability evaluated taking into account the radial distribution of stars and the limited extension of the Local arm with respect to the other arms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arm_number
|
int
|
Number of arms to simulate. |
required |
NS_number
|
int
|
Number of stars to simulate. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of random indices for the spiral arm associated to each star. |
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
SpiralModelFK06
Bases: SpiralModelBase
Spiral structure of Faucher-Giguère & Kaspi (2006) with the addition of the Local arm from Wainscoat et al. (1992). Spiral arm parameters from table 2 in Faucher-Giguère & Kaspi (2006) and table 1 in Wainscoat et al. (1992) assuming a Sun galactocentric distance R_sun = 8.5 kpc. The Local arm has a radial extension ~ 0.55 rad in the range [1.13, 1.68] rad (see Wainscoat et al. 1992).
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
SpiralModelYMW17
Bases: SpiralModelBase
Spiral structure of Yao et al. (2017), see also Hou et al. (2014). Spiral arm parameters from table 1 in Yao et al. (2017) assuming a Sun galactocentric distance R_sun = 8.3 kpc. The Local arm has a radial extension ~ 1.05 rad in the range [0.87, 1.92] rad (see Hou et al. 2014).
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
initialize_spiral_model()
Initializing the spiral model employed in the simulation. We have implemented two versions, i.e., the spiral structure of Faucher-Giguère & Kaspi (2006) (with the addition of the Local arm from Wainscoat et al. (1992)) and the spiral model from Yao et al. (2017). The spiral_model variable is made available on a global level.
Source code in mlpoppyns/simulator/stellar_dynamics/spiral_model.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |