Skip to main content

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

Project description

McFAST v0.1.7

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

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.7.tar.gz (43.4 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.7-cp313-cp313-win_amd64.whl (365.7 kB view details)

Uploaded CPython 3.13Windows x86-64

mcfast-0.1.7-cp313-cp313-manylinux_2_28_x86_64.whl (461.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mcfast-0.1.7-cp313-cp313-macosx_11_0_arm64.whl (408.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mcfast-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl (425.4 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

mcfast-0.1.7-cp312-cp312-win_amd64.whl (365.7 kB view details)

Uploaded CPython 3.12Windows x86-64

mcfast-0.1.7-cp312-cp312-manylinux_2_28_x86_64.whl (461.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mcfast-0.1.7-cp312-cp312-macosx_11_0_arm64.whl (408.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mcfast-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl (425.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

mcfast-0.1.7-cp311-cp311-win_amd64.whl (368.0 kB view details)

Uploaded CPython 3.11Windows x86-64

mcfast-0.1.7-cp311-cp311-manylinux_2_28_x86_64.whl (464.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mcfast-0.1.7-cp311-cp311-macosx_11_0_arm64.whl (410.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mcfast-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl (428.0 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

mcfast-0.1.7-cp310-cp310-win_amd64.whl (367.8 kB view details)

Uploaded CPython 3.10Windows x86-64

mcfast-0.1.7-cp310-cp310-manylinux_2_28_x86_64.whl (464.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

mcfast-0.1.7-cp310-cp310-macosx_11_0_arm64.whl (411.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mcfast-0.1.7-cp310-cp310-macosx_10_12_x86_64.whl (427.9 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: mcfast-0.1.7.tar.gz
  • Upload date:
  • Size: 43.4 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.7.tar.gz
Algorithm Hash digest
SHA256 05bdf528e68e72e63521811df107b3b0e8d6a906b05031938a098db30e20dc33
MD5 a412ba9aea8dddbae7f911623a6a4e42
BLAKE2b-256 fa83e2ed5a187c18cfa5fb56889ae6b132a2adf0305d9339759bc6fd9af5c007

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 365.7 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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6257e4c8290093d3b96cfa7441111d3f9656aef75c3532404c49bf6b3ce4b7d8
MD5 32a16b6e466ab9b14be4bd3d58deb17d
BLAKE2b-256 4810de554eed53fe71415ccb4bafa6fc0a1f4eb8fd134e4ce012cc2886533b7a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76f794c12ab59cecfca1313db6e72db23cda60f309fbc16a07cb30cd2485f9e0
MD5 842ebb40219c7bb84a2c2466faa756af
BLAKE2b-256 5f2985cbd9a8a90e64a66cea31e14504786d6a42295435bc7fcfde670ae6b29f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d823a6fd8fef901c7d42b4e12ba944822c0cb431a3936b10bf83d001068fa030
MD5 e822f737615186515c2737911fcf9655
BLAKE2b-256 b93727ae61a7495398cdb91870f573095fb8c86b820a80eb1ea2435526743433

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bc6fc1f9f08f0416338692c5cf626cbdb861fbd3504c8aab09243ceb1d609ad4
MD5 34465d262693b10b4a3eaf0909f15501
BLAKE2b-256 c04d1df0704e715f8ecd5095d8ad3040133f96e233288b90ba33099a94ca8058

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 365.7 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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5560a95a369612406bd21541e1b4e343f171a2494a54a07e030d06159855916
MD5 3602f487c44925482ae3f05f1df68d48
BLAKE2b-256 3e95d0751971bafcb8217ad8b977825e2729729b547f51c0f5ac5926741384a4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 633c68d528d9fdb0b941e3e50067b8b1a5160bdc72c21939de836b6ab56883f6
MD5 e9982256787974432ec49fb5c992cc89
BLAKE2b-256 f2a16f5eb4b3430ebe29491abab1f0feb424139be68c08b6a97c29f98be505c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad93fc058f91e6d820837cc20647ef9c8b78ed11527f2c6681b5c2b459f30f41
MD5 442b1d795644d34d6a5873893c55bffa
BLAKE2b-256 be3c814ead2dd135c9821ac3ec73c58a9b192fccea9482c4b148835a2c31cc58

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f6f7f7bfce142ddf4ad503c9bd730702a4f04dfbb7e4e3a1a0cae9b9e4b062f4
MD5 94696b39b2e5978b20143ace79491f2b
BLAKE2b-256 65fc429fcaa332d23e34569de61126ec0cd6c03b20a3b4319b4d64b7265547e3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 368.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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 40f2675ed8609c476cb3ebd17cd459b07746ca70466f1c1f948a5aa4e2928748
MD5 aeeca16ae7608a01af4505f91f4a306a
BLAKE2b-256 84f82652e0acd0628fcc9d71d07d96b6ea74479961267644319d8aceea5b199d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0821d477ce3874384985c94818e3d2a8693fc5486ed8f2bc4a8f60673b2d6b92
MD5 6303005951a217221ff5a513371bfb65
BLAKE2b-256 cfabeeda6b91e99d7504f9cd403e5f5fc58e3027716b5e2fcb518d481601cd08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38f4abe5e9dedf7f2e3c171d121b8a1dce89bcbe1d6239ac4a93d8a7fdaf9ec1
MD5 e73d67aa7e68038ecc80dc2dcc80dc2e
BLAKE2b-256 40bc453210f867a5807c0749e59715653c0dd625ebf356b9c1360789634f2a34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 542f9d15f11727d8247ea58ba94a82fdc4d30792faef9303737158327988a1e8
MD5 4d5539a436fca0b8740cd51023a58e9a
BLAKE2b-256 d15d9bff536f92db2e7c13742c7574f1fb68f197514e76c23309b64cf3aa2a45

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 367.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.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 79473357c6463ef9dcc0245626fce8671510fc9ac675841fe38702706a1c59d9
MD5 52341357e186886caa45de62566ee2b9
BLAKE2b-256 c9e3cd67ba6aac0266a061de86ef056244f7ecb7b0799d2b9f8773214d4ac048

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8fcca4c72ea46b94f5847f31283c086d622dd5ceb48792757725ce582c6a0a12
MD5 efdd7e855483e1c5fef4a731bc9a6c25
BLAKE2b-256 07efdff1281bcfda0f3f752246207b97305438f26554491f536f791f2d9a9e0c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bfbea1eb205fe5fe78eb63f53c42d5ae362a6dcc092fd855b4b8829904ab4289
MD5 2be04fbf71ce1f8398ab87d254ed5051
BLAKE2b-256 fdc69b8c4dbe92e24a379a31b9c8b26aec8bbc522369c4119da4c5f076a667bd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.7-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23df834629cf4c72290c355c3e8015f4fde2b6770c907545800afbbecdb57690
MD5 58616e74463178bd814c9ccd10f6fd5e
BLAKE2b-256 803e92dca3cd320f705a8ba560a47b42c3f6e81972b23f7c043639dc7da79723

See more details on using hashes here.

Provenance

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