Skip to main content

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

Project description

McFAST v0.1.6

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

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.6.tar.gz (43.2 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.6-cp313-cp313-win_amd64.whl (354.9 kB view details)

Uploaded CPython 3.13Windows x86-64

mcfast-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl (449.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mcfast-0.1.6-cp313-cp313-macosx_11_0_arm64.whl (398.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mcfast-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl (416.3 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

mcfast-0.1.6-cp312-cp312-win_amd64.whl (355.5 kB view details)

Uploaded CPython 3.12Windows x86-64

mcfast-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl (450.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mcfast-0.1.6-cp312-cp312-macosx_11_0_arm64.whl (398.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mcfast-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl (416.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

mcfast-0.1.6-cp311-cp311-win_amd64.whl (357.0 kB view details)

Uploaded CPython 3.11Windows x86-64

mcfast-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl (452.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mcfast-0.1.6-cp311-cp311-macosx_11_0_arm64.whl (401.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mcfast-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl (417.5 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

mcfast-0.1.6-cp310-cp310-win_amd64.whl (356.8 kB view details)

Uploaded CPython 3.10Windows x86-64

mcfast-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl (452.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

mcfast-0.1.6-cp310-cp310-macosx_11_0_arm64.whl (401.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mcfast-0.1.6-cp310-cp310-macosx_10_12_x86_64.whl (418.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for mcfast-0.1.6.tar.gz
Algorithm Hash digest
SHA256 91c93e0c2db50c6cd4815af471da6fce4485786a88776e35b982827efc7b5742
MD5 59969d89a862cffab84fa6bdd59acd61
BLAKE2b-256 7a2a5b95baffff41a26a03e170c87d460b355c7c3945906a41ff84453c28a588

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6.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.6-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for mcfast-0.1.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 473377971fb321a0a85d1a8a23c0aea33f7b3ebdce7d70dbcaf3cf3efd386bdb
MD5 54d6c9a016b1455aab47b602189a332b
BLAKE2b-256 0e794c24167f8bdd7718e64cfe0fd0e5b851f699e1cca765730be4f4e71b0c09

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 75154dac68f83f99aabc8bae8dd6eeaa1f4d5ee8127dc4918470f127b9916376
MD5 7a5e63dc71d03afacdc6a2cbe151b2bb
BLAKE2b-256 4eb7d28ad2856681a85220454867aa870ef1dd8abe2c79cc8f40c0b3a32320c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9574e4c9a4fd483e51d2b5b6d0e5a6ffc59563c49211182b9b06cef37e6ecca
MD5 718ac5506eed086c5294a4165ded3338
BLAKE2b-256 4db69ec1614d69a51b7d1decc8d947a438081dca599cc867cf995d7bfa1cb1a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9c2ed737e85fa2e1fbb6fac66798eae9f78d4fd1bc018102242017f5185ef81a
MD5 62b5eb6c71b206300fdf7bfd9c7e1fa4
BLAKE2b-256 4ef79acc9fe2464f48c2690d093b2ecf7fe96faa793e40836ec3cf76d694d645

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for mcfast-0.1.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bbd67b8ef9c52bd7d6883dcc681bc325dcf5047147cab87e386418905d37a986
MD5 fafb4a315c692890a90cc6b5e1955a21
BLAKE2b-256 5f69d82ba4601d886af995d1ea91798cdddee7c59a155ceda9c1fed4ed0c29d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce2758b7a36430ce7d8847ade96aa53bcab077fce74839c2a68595f7f66d3947
MD5 87cf57c208ede9f86ffc27cc3b9d1488
BLAKE2b-256 1d61397c8ec1bb88abc11e128e752fd04dc49ca672c3a25b0ce4b8be52d8ba52

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ba813e4f90b7fad112bd1f18f15ab0dfbc2a010bbe1e0408f49e8b843644d6a
MD5 747b7d344095ffe531d254fb5da3b909
BLAKE2b-256 d231d4b4be9d063793d4c09e7622256edda3dbf510a44982dd6f2db8d0d67f91

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1deec5840370a84a3502d3dd25a672c9759668c29288d4dae18caa09da07f5da
MD5 e7de1826924f56a47e848317063631a0
BLAKE2b-256 f6e72a4cfee90af5d3432087902ae442d36fb6f08105814a4a9421c2380f4349

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for mcfast-0.1.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fcf46f6efcd7918e70d5e523aa07094238757c603ca4c0c5594ce183ded18921
MD5 02056897e4d2d0d42bf3fa11159de4d4
BLAKE2b-256 985c7f6965edb4fe43811eca5ce62db408d0ac5160fc56a621e105b68331fe36

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7d913695cf063969f56bf507defdfa7b5c6f053724e2b9e267d3356875bbc65a
MD5 19993b6b5d3d2fe5816957d3690b9543
BLAKE2b-256 af795b6a981b3ef5141fd3c9ad38a291829276b711b19453d7b54ce1ed4c216a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ef72472ab4b34e9780aa494eb498c26059388671f640e306b2cd262f65a67c5
MD5 d2d00e6d6cf7122058b5cde044b0e4bc
BLAKE2b-256 9db13095e8a781a6be1207a0df6ba316d1df268dbb46bbe7020506017e08b01e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 06c515ef00b10990f0300b3be35d673f019afba63227404cc5ddc9c76f923c22
MD5 f918f02729deb99b94d6153ff7a68443
BLAKE2b-256 7078296b7e7821bc513385a49992df902fa0e979906cdd8ae068fcd247c0016f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for mcfast-0.1.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 56939e33b47565fa4888977d141f6c7f2c08a079cf201936f7adafa262d66dbf
MD5 8f67afcc8aa2fe872cd690c94a0ca6da
BLAKE2b-256 9695d0eb2f25c64181baa1cc16cc87a8a8a58208b5203d43ecc71929d23398a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6a2bbf56c697924c8887086acdc7addaf0e3dd50bf121439c1c14f4949d71e82
MD5 922580b4c13d49af66f9b3fa6ebdf041
BLAKE2b-256 3bc2a860e954ad749432946c6b79788b0ccafd451561d20680e640a07b026954

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6980589076ad3a78560569ee4271a7e1b768a8f9006a2d0a490977418e6a058b
MD5 969f1e2104d41759da8f7b6adf5da449
BLAKE2b-256 cb7ef6c6d82e25cccc6ebf1f91e07465afa789ccdc3397dbd93cdd71be6464b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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.6-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mcfast-0.1.6-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d9f8809847906faaeb79e9bcb394b91d801ebcd96171ed3d919e73dcdb2733fb
MD5 1c6e694f73343698888de10f0d9b0abe
BLAKE2b-256 d2d6c483b1ff0f63ed1bcf26a81be1505b8543fc3a089f2912f2fd929bdc839a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcfast-0.1.6-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