Skip to main content

A set of utilities and Rust-accelerated functions for the McFACTS AGN disk simulation project

Project description

McFAST v0.1.8

Utilities and accelerated functions designed for use by the McFACTS team at CUNY.

Functions currently fully tested for integration:

  • tau_inc_dyn_helper
  • tau_ecc_dyn_helper
  • gw_strain_helper
  • analytical_kick_velocity_helper
  • merged_orb_ecc_helper
  • torque_mig_timescale_helper
  • generate_r
  • shock_luminosity_helper
  • jet_luminosity_helper
  • encounters_prograde_sweep_helper
  • si_from_r_g_helper
  • r_g_from_units_helper
  • r_schwarzschild_of_m_helper

Functions currently in testing for integration: star_wind_mass_loss_helper accrete_star_mass_helper

Example: Tau Incline/Eccentricity

In order to accelerate the tau_inc_dyn and tau_ecc_dyn functions in mcfacts/physics/disk_capture.py, we provide tau_inc_dyn_helper and tau_ecc_dyn_helper functions that perform the vectorized array calculations in an optimized Rust function. The example implementation for tau_inc_dyn_optimized follows: it has the same call signature, takes the same inputs, and provides the same output as tau_inc_dyn, but is 2-3x faster.

This function and its ecc variant can be further optimized by speeding up or eliminating the calls to si_from_r_g, which now make up the bulk of the runtime in each function (approximately 2/3rds).

In particular, the tau_semi_lat functionality in tau_ecc_dyn is sped up at least 120x, with tau_semi_lat initially being timed at 6 seconds, while the tau_ecc_dyn_helper functionality that subsumes it is timed at 0.05 seconds.

def tau_inc_dyn_optimized(smbh_mass, disk_bh_retro_orbs_a, disk_bh_retro_masses, omega, ecc, inc, disk_surf_density_func, r_g_in_meters):
    """Computes inclination damping timescale from actual variables; used only for scaling.
    Uses Rust-accelerated helper functions for the calculation: compare to tau_inc_dyn
    """
    # throw most things into SI units (that's right, ENGINEER UNITS!)
    #    or more locally convenient variable names
    SI_smbh_mass = smbh_mass * u.Msun.to("kg")  # kg
    SI_semi_maj_axis = si_from_r_g(smbh_mass, disk_bh_retro_orbs_a, r_g_defined=r_g_in_meters).to("m").value
    SI_orbiter_mass = disk_bh_retro_masses * u.Msun.to("kg")  # kg
    cos_omega = np.cos(omega)

    disk_surf_res = disk_surf_density_func(disk_bh_retro_orbs_a)

    tau_i_dyn = tau_inc_dyn_helper(SI_smbh_mass, SI_orbiter_mass, ecc, inc, cos_omega, disk_surf_res, SI_semi_maj_axis)

    assert np.isfinite(tau_i_dyn).all(), \
        "Finite check failure: tau_i_dyn"

    return tau_i_dyn

Merge Tree

For M. McCarthy's black hole merge tracking feature.

import mcfast
from mcfast import MergeForest

# creates a forest of all black holes
forest = MergeForest("./data/", "galaxy_state_*")

bh_uuid: str = "2b422064-0a84-4687-a542-395dcb61cd4f"

# get the immediate child of a given UUID, if the UUID is valid
descendant_uuid = forest.get_descendant(bh_uuid)

# get the immediate parents of a given UUID, if the UUID is valid
(parent1_uuid, parent2_uuid) = forest.get_parents(bh_uuid)

# get the full ancestry list of a given UUID (in DFS order), 
# assuming the UUID has ancestors
ancestor_list = forest.get_ancestors(bh_uuid)


# get the full list of black holes between the UUID and 
# the final product (root)
descent_path = forest.get_lineage_to_root(bh_uuid)

# get the generation of a given UUID, where an initialized BH is generation 0
# note: implementation doesn't fully line up with existing
# reference implementation, under review
generation = forest.get_generation(bh_uuid)

# get all 'root' black holes (products remaining at the final tick)
roots = forest.roots()

# get all 'leaf' black holes (initialized BHs with no ancestors)
leaves = forest.leaves()

# get all 'singleton' black holes (neither ancestors nor children)
singletons = forest.singletons()

if forest.contains(bh_uuid):
    print("It exists!")
else:
    print("It doesn't exist!")

# get total number of nodes in the 'forest'
total = len(forest)

# serialize and deserialize with pickle
import pickle
 
# Save now
with open("forest.pkl", "wb") as f:
    pickle.dump(forest, f)

# Load later
with open("forest.pkl", "rb") as f:
    restored = pickle.load(f)

# sample: 330-node forest serializes down to 16kb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcfast-0.1.8.tar.gz (52.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mcfast-0.1.8-cp313-cp313-win_amd64.whl (391.9 kB view details)

Uploaded CPython 3.13Windows x86-64

mcfast-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl (485.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mcfast-0.1.8-cp313-cp313-macosx_11_0_arm64.whl (437.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mcfast-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl (450.2 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

mcfast-0.1.8-cp312-cp312-win_amd64.whl (392.2 kB view details)

Uploaded CPython 3.12Windows x86-64

mcfast-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl (486.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mcfast-0.1.8-cp312-cp312-macosx_11_0_arm64.whl (437.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mcfast-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl (450.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

mcfast-0.1.8-cp311-cp311-win_amd64.whl (394.0 kB view details)

Uploaded CPython 3.11Windows x86-64

mcfast-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl (489.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mcfast-0.1.8-cp311-cp311-macosx_11_0_arm64.whl (442.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mcfast-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl (454.3 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

mcfast-0.1.8-cp310-cp310-win_amd64.whl (393.8 kB view details)

Uploaded CPython 3.10Windows x86-64

mcfast-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl (488.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

mcfast-0.1.8-cp310-cp310-macosx_11_0_arm64.whl (443.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mcfast-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl (454.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file mcfast-0.1.8.tar.gz.

File metadata

  • Download URL: mcfast-0.1.8.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcfast-0.1.8.tar.gz
Algorithm Hash digest
SHA256 9f2da91cfbf33d6ebe26266ebb78832f99d502afa3e760396f2127389ff83272
MD5 3317824101a7a6d1f3df70f9a219b5a5
BLAKE2b-256 eb9f48b845e7aa0080b1ff853de57d9b2119aed322e83c8bad03842047d3d0f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8.tar.gz:

Publisher: mac.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mcfast-0.1.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 391.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcfast-0.1.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e473140629719d757cce73ea81c4e8775da7352d04c0899bd00de5b4e6cc3160
MD5 2c6c1f2b7b3614445182dea2b343a389
BLAKE2b-256 832255ed28d1bea774f345d5850f83e7aac17b2ec0eb465550da0257e86077ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp313-cp313-win_amd64.whl:

Publisher: windows.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 138ca6012c874dd4cfd32743562c9c6b258fda7a42de7ca6f8521914187f7687
MD5 dc16e9dccb7680515bf07126966286d2
BLAKE2b-256 821213b8d831eeb0c6572be1a5f1f5b500747539fb0347a7be6bcd799f47ea6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: ubuntu.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 39bf6621ea372d512f3238357d76bb06ba641f75af6dd3d7aba06960f9018da7
MD5 cae921282a49b93d5fec48b4803e4cf5
BLAKE2b-256 26d08d70c490269a4169a7efc19de7739576d4f68babc176fd6486eccd825500

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: mac.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 83ade384310bc06f872cfbcae2089741bfd4800d4ea432f473ad26c51bde2409
MD5 f611a8608e9f0f2233fed29a19f7910c
BLAKE2b-256 8e67780f57dae6b1964536d2b42d7b797a7aa62f727f6e85e0fe131b7b52d9de

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: mac_x86.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mcfast-0.1.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 392.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcfast-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 79e4437c731797bf1395867dbe0dbfbcbb5064cceb6baf4a7eeaa8946879a259
MD5 956d44a9118248e7b823a4e22a3110d0
BLAKE2b-256 8db6b9d9427ec985e5f71aa3624aec0ec6bdef3cfa856c55d16085c1235b550a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp312-cp312-win_amd64.whl:

Publisher: windows.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e288aa6fe4b8fd43f8ab84ffeb07aaa13ecd875d827e4a89fdf4bf63d2819fad
MD5 df47373ecbfb1b9a0bcfd348273bfbb8
BLAKE2b-256 ffcde08fa84a5cd088968e9c816ea9eed21885f26b8b359c77ed155c432d8ab7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: ubuntu.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48e6531f9fdf841151a47f511bb2e04def677044016c6641e7940fccfb55b931
MD5 a2990652406ae9508579812ab7462771
BLAKE2b-256 e5da0e6443e4d70b386b20439a6d916b445f3f90d96dd5bcc401793297b4490a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: mac.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a2c094b09317188cdc6a3f918263fd73da02739341242d7f409ecd5fa9c8db74
MD5 bde1289a6a82e2e07489e8faa25a2c62
BLAKE2b-256 b052a05e44be4a485941b3c5d3f51fd6f6bfd47543d9b61e3dc4f7c9b242319c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: mac_x86.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mcfast-0.1.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 394.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcfast-0.1.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c743447350721381b904df5dcc2621eb2fd1bc26955700ee8e85074e02a79b51
MD5 47142427d392f46f7f9099f9e8ad28d9
BLAKE2b-256 94abc4c1431d33484c0e08bdf265e23ff42d7b7e9def0e4ff7af77a0075a782e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp311-cp311-win_amd64.whl:

Publisher: windows.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aeabd31d9fa47565ee2f8d32888c495a2ae2e717182dc6e181b2f992cca3545b
MD5 dc6a59d5601ac15c86a744e2b790fa52
BLAKE2b-256 d76aad4f87686e88b82816300438caf64e53a59b5a60cb3bb7a4c9c91e59f179

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: ubuntu.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ad76a1474e2ef6ee5e5a5edcd11b9323f4a3434f2fb8b1039cb616363978928
MD5 297835e4a219a2221d442230cb328a32
BLAKE2b-256 7d419f120e46bb83ead60afd41f68ef7e93b4bcc4b81132bfb62a3b3e09a06b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: mac.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4d3b33f2644de987bd47a16b21e426c5091dbae2f52e82ce5e57a3a72b18b8a3
MD5 7784277f75177e949b92a38e19e7445e
BLAKE2b-256 6df9525ee0f9b99ae089e443c25ba26adc37f52e1d77770427e8dc7bc169d2f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: mac_x86.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mcfast-0.1.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 393.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcfast-0.1.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 244b85c87e587ae8b32f27df427a59c602173cc1537dff57ab2eba59fead31de
MD5 5949cbbda4904b569bfcb95263577d60
BLAKE2b-256 a1c205a61b5a9c2192f87b5aa4825800cd5c45f988d63933d65d8bde19e5e2f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp310-cp310-win_amd64.whl:

Publisher: windows.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c7b0baf36d745074c079e81790c2746e687b324ddc3a31fa0ce5b47f0d77cc6
MD5 ee1e7ae049bb842e5100a27a558ada48
BLAKE2b-256 75368a863d9a5c974bd3881131192fbac50c27448865c58a13f0faab5fd9477c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: ubuntu.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 34d0b084056136c46edf8d958f2d785da39ec62c5c60d963057515fddc0e007b
MD5 e4667ed7cd4b149e7e090f353a6b48e4
BLAKE2b-256 60999216f7ad4ea22fafe3d67b9b76fda9ff952d4b6fc109cd0454e4c89a0876

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: mac.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcfast-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 82b359a44159fd47acecc8350ecec52080383f4a8fea4a0b5c92c33d747aca38
MD5 5710f5078f2321a0aa3eb6059edf9aa1
BLAKE2b-256 2c602a79993a0a59523bc6831ddd8b91e9f17eb325cbeff20f5c6361a3cd4b25

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: mac_x86.yml on McFACTS/mcfast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page