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 corefinder3d

Note: The package name on PyPI is corefinder3d for compatibility reasons.

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.3.tar.gz (35.5 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.3-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: corefinder3d-0.5.3.tar.gz
  • Upload date:
  • Size: 35.5 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.3.tar.gz
Algorithm Hash digest
SHA256 9d337b74b2a559ed665410040a26ae04f4f3624bdf6c8164e14feb5917b48e76
MD5 713350944c7aa01c02a122cf636880aa
BLAKE2b-256 60f0fa222f8d189e8c07fdabc5a17cf652f7c0531baed2228b08116401e4d7ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: corefinder3d-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 31.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f786526d8d36eaef0c3c48c4f328d4473f1044d6352741b0b7dea1630d73f229
MD5 def2d72f4b15c01ec39719874288dec9
BLAKE2b-256 52470989be9f023b3cd294bf670e2c4f19c69cbb7b1e82ee457170cd3602784b

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