Skip to main content

CompactObject

Logo CompactObject is an open-source package designed to perform Bayesian inference on neutron star equation of state (EOS) constraints. It offers a comprehensive workflow that integrates astrophysical observations and nuclear measurements to explore the interior composition of neutron stars. The package is built to be user-friendly, easily extendable, and thoroughly documented, making it an essential tool for researchers in nuclear astrophysics.

We have a detailed documentation please check here: CompactObject Package Website

Please star this repository if you find it is helpful!

Table of Contents

Core Functionality

CompactObject offers a range of functionalities essential for constraining the EOS of neutron stars:

  1. Equation of State (EOS) Generation

    • Utilizes multiple physics/meta models, including Relativistic Mean Field (RMF), strange star, quark star, polytrope, and speed of sound models, to generate neutron star EOS.
    • EOSgenerators Package
  2. Tolman-Oppenheimer-Volkoff (TOV) Solver

    • Solves the TOV equations for a spherically symmetric compact object based on a given neutron star EOS.
    • TOVsolver Package
  3. Bayesian Inference Workflow

    • Implements neutron star EOS inference using Nested Sampling.
    • Provide options for single machine users using MCMC sampling by emcee.
    • Integrates constraints from nuclear experiments, neutron star mass and/or radius observations (from X-ray timing and/or radio timing), and tidal measurements from gravitational wave detections.
    • InferenceWorkflow Package

Papers

Please consider cite the following papers if you use CompactObject in your research:

Package paper:

  1. Huang, C., Malik, T., Cartaxo, J., et al. (2024). CompactObject: An open-source Python package for full-scope neutron star equation of state inference arXiv:2411.14615

Other papers:

  1. Huang, C., Raaijmakers, G., Watts, A. L., Tolos, L., & Providência, C. (2024). Constraining fundamental nuclear physics parameters using neutron star mass-radius measurements I: Nucleonic models. Monthly Notices of the Royal Astronomical Society, 529. DOI:10.1093/mnras/stae844

  2. Huang, C., Tolos, L., Providência, C., & Watts, A. (2024). Constraining a relativistic mean field model using neutron star mass-radius measurements II: Hyperonic models. arXiv preprint arXiv:2410.14572. https://arxiv.org/abs/2410.14572

  3. Huang, C., & Zheng, X.-P. (2024). Bayesian Insights into post-Glitch Dynamics: Model comparison and parameter constraint from decades-long observation data of the Crab pulsar. arXiv preprint arXiv:2409.18432. https://arxiv.org/abs/2409.18432

Sample Citation

"The inference conducted here relies on the framework in the CompactObject \cite{CompactObject} package\footnote{https://chunhuangphy.github.io/CompactObject/}. This is an open-source, comprehensive package designed to implement Bayesian constraints on the neutron star EOS. Other works based on this package include ..."

Includes

CompactObject includes the following components to facilitate neutron star EOS inference analysis:

  1. EOS Output Validation Routine

    • Compute various type of EOS by different models
    • Checks the validity of EOS inputs.
  2. Mass, Radius, and Tidal Deformability Calculator

    • Returns mass, radius, tidal deformability, by solve TOV equation, and computes the corresponding speed of sound.
  3. Sample TOV Solver Notebook

  4. Sample EOS Generators Notebook

    • test_EOSgenerators.ipynb
    • Showcases all integrated EOS computations, including:
      • Polytrope
      • Speed of Sound Model
      • RMF Model
      • Strange Star Model
      • Quark Star Model
  5. Sample Analysis and Tutorial Notebook

    • test_Inference.ipynb
    • Demonstrates the entire pipeline of Bayesian inference using supported EOS models, constructing priors and likelihoods, and the types of likelihoods supported in this project. Also provide a MCMC based emcee example for people don't have access to High Performance Computer. This is specifically focus on the RMF EOS, However, please check this notebook before all other notebook, since here we showcase all the likelihood
    • Other Inference pipline that using different EOS are

Note: Please review these notebooks before starting your own project to familiarize yourself with the coding routines.

Installation

Below are the commands to install and update the CompactObject package, along with a link to PyPI.

PyPI - CompactObject-TOV

  1. Install the Package

    pip install CompactObject-TOV
    
  2. Update the Package

    pip install CompactObject-TOV --upgrade
    

Importing the Package

  • For EOS Computation:

    import EOSgenerators
    
  • For TOV Solver:

    import TOVsolver
    
  • For Bayesian Inference:

    import InferenceWorkflow
    

Physics Notations

  1. Units:

    • CGS Units are used throughout the package.
    • Pressure (P): erg/cm³
    • Energy Density (ρ): g/cm³
    • Default Unit system any input in this package is follow the cgs unit
  2. Unit Conventions:

    • Follow the unit system defined in the Unit Conversion notebook.
    • Basic Rules:
      1. If using a quantity with a unit, multiply by the unit during computations.
      2. If plotting or demonstrating values in a specific unit, divide accordingly.
    • Detailed guidelines can be found in the Unit Conversion documentation.

License

Distributed under the GNU GPL-3.0 license. See LICENSE.txt for more information.

(back to top)

Contact

Documentation Link: CompactObject Documentation

DOI

(back to top)

Acknowledgments

We would like to acknowledge the support of the Code/Astro workshop, which was instrumental in the development of this project. Special thanks to Professor Anna Watts, Dr. Geert Raaijmakers, and Jeannie Kuijper for their assistance with coding and providing foundational strategies to address the research challenges.

(back to top)

```

Release files for CompactObject-TOV 2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CompactObject-TOV 2.1
File Size Uploaded
compactobject_tov-2.1.tar.gz 70.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for CompactObject-TOV 2.1
File Interpreter ABI Platform
compactobject_tov-2.1-py3-none-any.whl Python 3 none any Details

Total release size: 147.9 kB

Release files / compactobject_tov-2.1.tar.gz

Download URL compactobject_tov-2.1.tar.gz
Size 70.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0ad4cb7b46cc3ade6f4557ad69203020c37f19351fb25d8f14a588fa70e968a7
BLAKE2b-256 checksum
How to use checksums
a28ed6919899bd003720fd5c22e99e3b09f66199b2ce9a56c03769823c4cbcf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / compactobject_tov-2.1-py3-none-any.whl

Download URL compactobject_tov-2.1-py3-none-any.whl
Size 77.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7e1584b6c274ef575d4dcdf3dd367c93704f809ced4e24d4930d222b208f0fd
BLAKE2b-256 checksum
How to use checksums
6359a893fdb41c75e771803c848491da3e6e403eb7287af07e169ce09f3472e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

2.1 This release

2 release files

2.0.0

2 release files

1.9.10

2 release files

1.9.9

2 release files

1.9.8

2 release files

1.9.7

2 release files

1.9.6

2 release files

1.9.5

2 release files

1.9.4

1 release file

1.9.3

1 release file

1.9.2

1 release file

1.9.1

2 release files

1.9.0

2 release files

1.8.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.3.1

2 release files

1.2.1

1 release file

1.2.0

2 release files

1.1.1

2 release files

1.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page