Skip to main content

A package for finding cores in 3D simulation data.

Project description

corefinder

corefinder is a Python package designed to identify and trace dense cores in 3D magnetohydrodynamics (MHD) astrophysical simulations, with a focus on Eulerian grid data and periodic boundary conditions. The package implements a moving isosurface method to robustly track the evolution of cores across simulation snapshots.

Features

  • Core Identification: Find dense cores in 3D simulation data using isosurface-based segmentation.
  • Periodic Boundary Support: Handles periodic boundary conditions, ideal for Eulerian grid simulations.
  • Core Evolution Tracking: Trace the evolution of individual cores across time steps.
  • Flexible Input: Works with standard NumPy arrays and supports common astrophysical data formats.
  • Extensible: Easily integrates with other analysis pipelines.

Installation

pip install corefinder

Note: I have not made the PyPI repo ready yet, please use pip install xxx.whl, where the xxx.whl can be obtained by python -m build --wheel.

Or, for development:

pip install -e .

Usage

import corefinder as cf
import pickle
import numpy as np


# Load the core
with open("./tests/core_snap042id001.pickle", "rb") as f:
    core: cf.CoreCube = pickle.load(f)


print(core)  # oneline summary

core.info()  # detailed summary

print(core.phyinfo)  # physical information

# example of the mass
core_array = core.data(-2, dataset_name="density", return_data_type="masked")
core_mass = core_array.sum() * core.phyinfo["pixel_size"] ** 3
print(f"Mass of the core: {core_mass:.2e} Msun")

# example of the vx
vx, roi, mask = core.data(-2, dataset_name="Vx", return_data_type="subcube_roi_mask")
# currently, ROI (region of interest) is not used, simply being np.ones_like(data)
print("The std of vx: ", np.std(vx[mask]))
print("The mean of vx: ", np.mean(vx[mask]))

See the documentation (in prep.) for more details and advanced usage.

Requirements

  • Python >= 3.9
  • numpy >= 2.0.0
  • scikit-image >= 0.24.0
  • connected-components-3d >= 3.18.0
  • h5py >= 3.10.0
  • scipy >= 1.14.0

License

MIT License

Citation

If you use corefinder in your research, please contact the author for citation information (because it is still in a developing status, though usable)

please cite:

Yuan, S. (2025). CoreFinder: A Python package for core identification in 3D MHD simulations (in perp.). GitHub repository.


For questions or contributions, please open an issue or pull request on GitHub.

Acknowledge

This package was developed within the vibrant research environment of CUHK-SFG. Its development draws heavily on the foundational codebase kindly shared by Dr. Cao, an inspiring collaborator whose expertise in astrophysics and AI has profoundly influenced the project's trajectory. Special thanks are also due to Mr. Chen and Mr. Sun for their substantial support in the technical development of this package, especially in debugging, data processing, and system optimization.

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

corefinder3d-0.5.2.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

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

corefinder3d-0.5.2-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file corefinder3d-0.5.2.tar.gz.

File metadata

  • Download URL: corefinder3d-0.5.2.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for corefinder3d-0.5.2.tar.gz
Algorithm Hash digest
SHA256 6030e405ee1c3b4ee3a6a65c4b8328f6c7f361969726e396ddaf6c30216f765e
MD5 3401e2e52d42fc75ef5574bff574700c
BLAKE2b-256 bbe5c3f5575cff0a57e5f411d45ebef0eeb26ddf265007f99f04dd778b86f193

See more details on using hashes here.

File details

Details for the file corefinder3d-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: corefinder3d-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for corefinder3d-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79a933ef1bbf025387f9aa426b533746c68fceaef3978df99c3178de8ef21864
MD5 86903f80f441a0c3d7891e7d6d4e2d8d
BLAKE2b-256 132f500e57e703fcbef440f57e8e6b0c1be4cf1bb72ab77b605436d1e76bc2f7

See more details on using hashes here.

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