Skip to main content

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

Project description

McFAST v0.1.9

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.9.tar.gz (56.6 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.9-cp313-cp313-win_amd64.whl (398.1 kB view details)

Uploaded CPython 3.13Windows x86-64

mcfast-0.1.9-cp313-cp313-manylinux_2_28_x86_64.whl (493.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

mcfast-0.1.9-cp313-cp313-macosx_11_0_arm64.whl (444.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mcfast-0.1.9-cp313-cp313-macosx_10_12_x86_64.whl (458.0 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

mcfast-0.1.9-cp312-cp312-win_amd64.whl (398.4 kB view details)

Uploaded CPython 3.12Windows x86-64

mcfast-0.1.9-cp312-cp312-manylinux_2_28_x86_64.whl (494.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mcfast-0.1.9-cp312-cp312-macosx_11_0_arm64.whl (445.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mcfast-0.1.9-cp312-cp312-macosx_10_12_x86_64.whl (457.9 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

mcfast-0.1.9-cp311-cp311-win_amd64.whl (401.4 kB view details)

Uploaded CPython 3.11Windows x86-64

mcfast-0.1.9-cp311-cp311-manylinux_2_28_x86_64.whl (495.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mcfast-0.1.9-cp311-cp311-macosx_11_0_arm64.whl (448.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mcfast-0.1.9-cp311-cp311-macosx_10_12_x86_64.whl (459.3 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

mcfast-0.1.9-cp310-cp310-win_amd64.whl (401.3 kB view details)

Uploaded CPython 3.10Windows x86-64

mcfast-0.1.9-cp310-cp310-manylinux_2_28_x86_64.whl (495.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

mcfast-0.1.9-cp310-cp310-macosx_11_0_arm64.whl (448.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mcfast-0.1.9-cp310-cp310-macosx_10_12_x86_64.whl (459.5 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: mcfast-0.1.9.tar.gz
  • Upload date:
  • Size: 56.6 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.9.tar.gz
Algorithm Hash digest
SHA256 21e11b219bd51e32427c45b817dd08f3eef9301dcd990d4d5bbc4703b8ab1134
MD5 f490cd9ee55cb9889048f61a741caf3c
BLAKE2b-256 110bf7176bb674e3d4e8f887d273e83e21ebf6f9da67ddb9b43460b8741ed0b6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.9-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 398.1 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.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 129e074478bbe1bf565b2515b18e8cd4ca27480a3ad9901bb4832b301dc368dd
MD5 c47d2ef0884ebc43e143338aecb6b2a4
BLAKE2b-256 a57d4f840d37bc55a0f707be30c22569a8b1500e52f718df9b1190114b7f0288

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a441f04919c3302c2ed1354d3a67647782f08b345eb2b77849ac1ea02f3ee040
MD5 cd6761b743eb93a1970ccf1d383fbfba
BLAKE2b-256 f87f27e1e0b56bf96fef0540410f90d9248464cf8cbfb3e0ef65f57f5de27559

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da21b9f1e6a44a5cec6db9bec7c7f98b2f1166ceb4b85bfb06c7ee7754050660
MD5 436563e3d42da1ccccf6aa594ec484e7
BLAKE2b-256 f77184911eef01eb2c74d89b93495adc602d406da03c2be5255b6d6230e2ac2f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a32f3e1368dd217534ebee57c60b64237e8562ad0d8e427533ef51fdb32867b9
MD5 64446516a87f66f7de7ed9e02dc661d8
BLAKE2b-256 871fbaf361c3e3ed31ba98e694a1bdb6a3c4185627879a833f51a62d4832df92

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.9-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 398.4 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.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fe5e629f4772d1a4025b24cca823abeba6b7cde016fb221f86aea8d89641e5e4
MD5 9801ac9ec2bb1a986d4e790943142f5a
BLAKE2b-256 5fe845c80d962c5c4dd1a4ce0b3098450c29773087cdad357bbe245a9c6cd64f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a0380417707eb7ec90810b61e512d76ef81d2a2f3d379c7ca37707d6c2df2f3
MD5 1eaf84fb44cd9f77ae61300cfb755436
BLAKE2b-256 dab76cfb81e924bb25a0c45ff9928986c68b8f61aff032dc8ab7098a5d2a284b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da7057d5f77b0f59e415ed240c4301692ca80a316cccda47fd20b9d078a9791d
MD5 b37427c29af19e18ca9d9e2e8515a872
BLAKE2b-256 63a5a9bcefe31d26c56e2c4aa8c6a2bec800f0e00d24ce0e078958014958f925

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8219db1562c1888cd08b2f8e94ed8c2ff5d782ae478528a8e7be728fc5503c80
MD5 d6e1dbdf9060be4ffe12eb0bc4ff4e28
BLAKE2b-256 4ab848a83a35e3c1c05a847c112336c37ed5a95912f930cef288d985fabb302e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.9-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 401.4 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.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c499dd5f46adabfe7a4fb74c8778f835445f76f978df8409295487ef16420521
MD5 638633e9d0fd85a18dc9604c70e1b932
BLAKE2b-256 ae61cef3449e745909ade73be28899f017baa09ddf502f07f055518ca8436901

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a562f994dd85c2ae761d826c8eafa20d6b6948a2f47bd93b31dc2b03314c24c
MD5 03f16ade47b562891a165a89723139e5
BLAKE2b-256 1caa2f9ebf30403d0e6152c85f49d6931e7c92d5266d7c43e0c34520ef499acf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55afeddddb267ed2ab5941315987507964c504caeb442ea903e60ef7c444d647
MD5 95b3de229373eb8642728e2500145ddf
BLAKE2b-256 a6a0e1f98cd77bfb02352dae34c0a053bfd3739c47645c80523ccb21761c8500

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 82d45037a5af6b0a12a253c499577f323db3a0fa3589a74759ae3d25921d9b5b
MD5 a89ab1a5e0ecde7bbb3312d2e6955b41
BLAKE2b-256 a4438b37890b5b405a42c455cfacf34e694f22bd8c572348c54f69160306faff

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcfast-0.1.9-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 401.3 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.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6cb09d37ebe2347fb3e062d8ddea3c4f9e359a5ffe201f2d86d60bded956b628
MD5 22db323c315136f7dda6649983b09425
BLAKE2b-256 d27fc7ce98a018817108b628b13cec93169fba5681b9413a0b5b1d1964f673fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7415ae7ae7aaf47f3532816a6937c697af2d9392abded1ae742be5df550f87b5
MD5 e474edd6cf3e86e5b4f266bbd6b817d7
BLAKE2b-256 26ca906c4a47824bd85c4fbb90bd5ecef76e5fc4997dfb95ff45b407a926828f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ed69600ac6b9f7ff4a98b24f6fe90c10e972dc5baa8aeb09b368eb35f364621
MD5 a9662442e6afe790b8fc6f97b02f0fdc
BLAKE2b-256 c2439090f199e956283f46ffc130eeb5a1b78c13da357b6e96ff677c4fe58552

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for mcfast-0.1.9-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3cb489bdcc2e69e9ff99f2f2d57c7bf6f2aff9684985a562ce920f2ad42e8a7d
MD5 a4c5962c5391f87e9dbe49d4715175f4
BLAKE2b-256 e4e3214d85a3e95ab141b174f0a2daebcd7f097c5433d009049ad88fa149deb7

See more details on using hashes here.

Provenance

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