├── .dictionary.txt ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── compas-compile-ci.yml │ ├── dockerhub-ci.yml │ ├── pr_artifact_url_commenter.yml │ ├── precommit-checks.yml │ └── tag_creation.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── LICENSE ├── README.md ├── compas_matlab_utils └── ComparisonPlots.m ├── compas_python_utils ├── __init__.py ├── cosmic_integration │ ├── ClassCOMPAS.py │ ├── ClassCosmicIntegrator.py │ ├── ClassMSSFR.py │ ├── FastCosmicIntegration.py │ ├── SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5 │ ├── __init__.py │ ├── binned_cosmic_integrator │ │ ├── __init__.py │ │ ├── bin_2d_data.py │ │ ├── binary_population.py │ │ ├── conversions.py │ │ ├── cosmological_model.py │ │ ├── detection_matrix.py │ │ ├── detection_rate_computer.py │ │ ├── gpu_utils.py │ │ ├── io.py │ │ ├── plotting.py │ │ ├── snr_grid.py │ │ └── stellar_type.py │ ├── cosmology.py │ ├── generate_frame_file.py │ ├── selection_effects.py │ └── totalMassEvolvedPerZ.py ├── detailed_evolution_plotter │ ├── __init__.py │ ├── plot_detailed_evolution.py │ ├── plot_to_json.py │ └── van_den_heuvel_figures │ │ ├── 1.png │ │ ├── 10.png │ │ ├── 11.png │ │ ├── 12.png │ │ ├── 13.png │ │ ├── 14.png │ │ ├── 15.png │ │ ├── 16.png │ │ ├── 17.png │ │ ├── 18.png │ │ ├── 19.png │ │ ├── 2.png │ │ ├── 20.png │ │ ├── 21.png │ │ ├── 22.png │ │ ├── 23.png │ │ ├── 24.png │ │ ├── 25.png │ │ ├── 26.png │ │ ├── 27.png │ │ ├── 28.png │ │ ├── 29.png │ │ ├── 3.png │ │ ├── 30.png │ │ ├── 31.png │ │ ├── 32.png │ │ ├── 33.png │ │ ├── 34.png │ │ ├── 35.png │ │ ├── 36.png │ │ ├── 37.png │ │ ├── 38.png │ │ ├── 39.png │ │ ├── 4.png │ │ ├── 40.png │ │ ├── 41.png │ │ ├── 42.png │ │ ├── 43.png │ │ ├── 44.png │ │ ├── 45.png │ │ ├── 46.png │ │ ├── 47.png │ │ ├── 48.png │ │ ├── 49.png │ │ ├── 5.png │ │ ├── 50.png │ │ ├── 51.png │ │ ├── 52.png │ │ ├── 53.png │ │ ├── 54.png │ │ ├── 55.png │ │ ├── 56.png │ │ ├── 57.png │ │ ├── 58.png │ │ ├── 59.png │ │ ├── 6.png │ │ ├── 60.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ └── vanDenHeuvelPlot.eps ├── h5copy.py ├── h5sample.py ├── h5view.py └── preprocessing │ ├── BSE_Grid.txt │ ├── COMPAS_Output_Definitions.txt │ ├── SSE_Grid.txt │ ├── __init__.py │ ├── compasConfigDefault.yaml │ ├── runSubmit.py │ ├── sampleMoeDiStefano.py │ └── stroopwafelInterface.py ├── misc ├── COMPAS_logos │ ├── COMPAS_banner.png │ ├── COMPAS_icon.svg │ ├── COMPAS_logo.svg │ └── COMPAS_sticker_GW.pdf ├── README.md ├── cicd-scripts │ ├── centos-dependencies │ ├── linux-dependencies │ └── macos-dependencies ├── examples │ ├── Tutorials │ │ ├── DataAnalysis.py │ │ ├── Overview.py │ │ ├── README.txt │ │ ├── SFRD_cartoon.png │ │ ├── WorkingWithHDF5.py │ │ └── tutorial_grid.txt │ └── methods_paper_plots │ │ ├── README.md │ │ ├── detailed_evolution │ │ ├── Grid_demo.txt │ │ ├── example_bbh_compas_config.yaml │ │ ├── run.sh │ │ └── runSubmitDemo.py │ │ ├── fig_16_Chirpmass_distribution │ │ ├── COMPAS_Output_Definitions.txt │ │ ├── Fig16_pythonSubmit.py │ │ ├── README.md │ │ ├── make_fig_16.py │ │ └── stroopwafel_interface.py │ │ ├── fig_5_HR_diagram │ │ ├── README.md │ │ ├── create_fig_5_grid.py │ │ ├── grid.txt │ │ ├── make_fig_5.py │ │ └── pythonSubmit.py │ │ ├── fig_6_max_R │ │ ├── README.md │ │ ├── create_fig_6_grid.py │ │ ├── grid.txt │ │ ├── make_fig_6.py │ │ └── pythonSubmit.py │ │ ├── fig_7_MS_lifetime │ │ ├── README.md │ │ └── make_fig_7.py │ │ ├── fig_8_initial_core_final_mass_relations │ │ ├── MM20_grid.txt │ │ ├── README.md │ │ ├── create_fig_8_grids.py │ │ ├── grid.txt │ │ ├── logfile_defs.txt │ │ ├── make_fig_8.py │ │ ├── pythonSubmitDefaults.py │ │ ├── pythonSubmitFryerRapid.py │ │ ├── pythonSubmitMandelMueller.py │ │ └── rapid_grid.txt │ │ └── stellar_types.py └── unsupported_utils │ ├── README.md │ ├── compasUtils.py │ ├── h5rewrite.py │ └── magnitude_module.py ├── online-docs ├── COMPAS-2021methodsPaper.bib ├── Makefile ├── README.rst ├── _static │ └── css │ │ └── COMPAS.css ├── _templates │ └── breadcrumbs.html ├── conf.py ├── globals.rst ├── images │ ├── BSE-class-diagram-compressed.svg │ ├── BSE-flow-chart-compressed.svg │ ├── SSE-class-diagram-compressed.svg │ ├── SSE-flow-chart-compressed.svg │ └── example-plot-compressed.svg ├── index.rst ├── make.bat ├── pages │ ├── Developer guide │ │ ├── BSE │ │ │ ├── BSE-class-hierarchy.rst │ │ │ ├── BSE-evolution-model.rst │ │ │ └── BSE.rst │ │ ├── Developer build │ │ │ ├── COMPAS-local-build.rst │ │ │ ├── developer-building-compas.rst │ │ │ └── docker-developer.rst │ │ ├── Headers │ │ │ ├── constants-dot-h.rst │ │ │ ├── enumhash-dot-h.rst │ │ │ ├── errorcatalog-dot-h.rst │ │ │ ├── headers.rst │ │ │ ├── logtypedefs-dot-h.rst │ │ │ └── typedefs-dot-h.rst │ │ ├── Programming style │ │ │ ├── programming-style-oo-abstraction.rst │ │ │ ├── programming-style-oo-encapsulation.rst │ │ │ ├── programming-style-oo-inheritance.rst │ │ │ ├── programming-style-oo-polymorphism.rst │ │ │ ├── programming-style-oo.rst │ │ │ ├── programming-style-style-braces.rst │ │ │ ├── programming-style-style-comments.rst │ │ │ ├── programming-style-style-func-parms.rst │ │ │ ├── programming-style-style-indentation.rst │ │ │ ├── programming-style-style-naming.rst │ │ │ ├── programming-style-style-performance.rst │ │ │ ├── programming-style-style.rst │ │ │ └── programming-style.rst │ │ ├── SSE │ │ │ ├── SSE-class-hierarchy.rst │ │ │ ├── SSE-evolution-model.rst │ │ │ └── SSE.rst │ │ ├── Services │ │ │ ├── Logging and debugging │ │ │ │ ├── Base-level logging │ │ │ │ │ ├── services-base-level-logging-func-close.rst │ │ │ │ │ ├── services-base-level-logging-func-debug.rst │ │ │ │ │ ├── services-base-level-logging-func-debugWait.rst │ │ │ │ │ ├── services-base-level-logging-func-enabled.rst │ │ │ │ │ ├── services-base-level-logging-func-error.rst │ │ │ │ │ ├── services-base-level-logging-func-open.rst │ │ │ │ │ ├── services-base-level-logging-func-put.rst │ │ │ │ │ ├── services-base-level-logging-func-say.rst │ │ │ │ │ ├── services-base-level-logging-func-squawk.rst │ │ │ │ │ ├── services-base-level-logging-func-start.rst │ │ │ │ │ ├── services-base-level-logging-func-stop.rst │ │ │ │ │ ├── services-base-level-logging-func-write.rst │ │ │ │ │ └── services-base-level-logging.rst │ │ │ │ ├── Logging macros │ │ │ │ │ ├── services-logging-debugging-macros-log.rst │ │ │ │ │ ├── services-logging-debugging-macros-log_id.rst │ │ │ │ │ ├── services-logging-debugging-macros-log_id_if.rst │ │ │ │ │ ├── services-logging-debugging-macros-log_if.rst │ │ │ │ │ └── services-logging-debugging-macros-logging.rst │ │ │ │ ├── services-extended-logging.rst │ │ │ │ ├── services-logging-debugging-macros-debugging.rst │ │ │ │ └── services-logging-debugging.rst │ │ │ ├── Program options │ │ │ │ └── services-program-options.rst │ │ │ ├── Random numbers │ │ │ │ ├── services-random-numbers-defaultSeed.rst │ │ │ │ ├── services-random-numbers-free.rst │ │ │ │ ├── services-random-numbers-initialise.rst │ │ │ │ ├── services-random-numbers-random1.rst │ │ │ │ ├── services-random-numbers-random2.rst │ │ │ │ ├── services-random-numbers-randomGaussian.rst │ │ │ │ ├── services-random-numbers-randomInt1.rst │ │ │ │ ├── services-random-numbers-randomInt2.rst │ │ │ │ ├── services-random-numbers-seed.rst │ │ │ │ └── services-random-numbers.rst │ │ │ ├── services-error-handling.rst │ │ │ └── services.rst │ │ ├── changelog.rst │ │ ├── developer-guide.rst │ │ ├── floating-point-comparisons.rst │ │ ├── git-workflow.rst │ │ └── object-ids.rst │ ├── Getting started │ │ └── getting-started.rst │ ├── User guide │ │ ├── COMPAS output │ │ │ ├── output.rst │ │ │ ├── standard-logfiles-annotations.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-ce.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-dco.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-detailed-output.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-pulsars.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-rlof.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-supernovae.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-switchlog.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-sysparms.rst │ │ │ ├── standard-logfiles-default-record-specifications-BSE-system-snapshot.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-detailed-output.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-pulsars.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-supernovae.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-switchlog.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-sysparms.rst │ │ │ ├── standard-logfiles-default-record-specifications-SSE-system-snapshot.rst │ │ │ ├── standard-logfiles-default-record-specifications.rst │ │ │ ├── standard-logfiles-example-definitions-file.rst │ │ │ ├── standard-logfiles-format.rst │ │ │ ├── standard-logfiles-record-specification-binary.rst │ │ │ ├── standard-logfiles-record-specification-options.rst │ │ │ ├── standard-logfiles-record-specification-stellar.rst │ │ │ ├── standard-logfiles-record-specification.rst │ │ │ ├── standard-logfiles-record-specifiers.rst │ │ │ ├── standard-logfiles-record-types-bse-common-envelopes.rst │ │ │ ├── standard-logfiles-record-types-bse-detailed-output.rst │ │ │ ├── standard-logfiles-record-types-bse-double-compact-objects.rst │ │ │ ├── standard-logfiles-record-types-bse-pulsar-evolution.rst │ │ │ ├── standard-logfiles-record-types-bse-rlof.rst │ │ │ ├── standard-logfiles-record-types-bse-supernovae.rst │ │ │ ├── standard-logfiles-record-types-bse-system-parameters.rst │ │ │ ├── standard-logfiles-record-types-bse-system-snapshot.rst │ │ │ ├── standard-logfiles-record-types-sse-detailed-output.rst │ │ │ ├── standard-logfiles-record-types-sse-pulsar-evolution.rst │ │ │ ├── standard-logfiles-record-types-sse-supernovae.rst │ │ │ ├── standard-logfiles-record-types-sse-system-parameters.rst │ │ │ ├── standard-logfiles-record-types-sse-system-snapshot.rst │ │ │ ├── standard-logfiles-record-types.rst │ │ │ └── standard-logfiles.rst │ │ ├── Handling errors │ │ │ ├── error-table.rst │ │ │ ├── evolution-status-table.rst │ │ │ └── handling-errors.rst │ │ ├── Post-processing │ │ │ ├── CHE_paper_tutorial │ │ │ │ ├── CHE_evolution_demo.ipynb │ │ │ │ ├── CHE_evolution_demo_ANSWERS.ipynb │ │ │ │ ├── SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5 │ │ │ │ ├── old_ClassCOMPAS.py │ │ │ │ ├── old_FastCosmicIntegration.py │ │ │ │ ├── old_selection_effects.py │ │ │ │ └── old_totalMassEvolvedPerZ.py │ │ │ ├── hdf5 │ │ │ │ ├── WorkingWithHDF5.ipynb │ │ │ │ ├── post-processing-h5copy.rst │ │ │ │ ├── post-processing-h5sample.rst │ │ │ │ ├── post-processing-h5view.rst │ │ │ │ └── post-processing-hdf5-info.rst │ │ │ ├── notebooks │ │ │ │ ├── CosmicIntegration.py │ │ │ │ ├── DataAnalysis.ipynb │ │ │ │ └── spin_prescriptions │ │ │ │ │ ├── calculate_black_hole_spin_pop_synth.ipynb │ │ │ │ │ └── spin_class.py │ │ │ └── post-processing.rst │ │ ├── Program options │ │ │ ├── program-options-list-defaults.rst │ │ │ ├── program-options-mixing-ranges-sets.rst │ │ │ ├── program-options-ranges.rst │ │ │ ├── program-options-sets.rst │ │ │ ├── program-options-vector-options.rst │ │ │ └── program-options.rst │ │ ├── Running COMPAS │ │ │ ├── example │ │ │ │ ├── COMPAS_Output │ │ │ │ │ └── Run_Details │ │ │ │ └── grid_demo.txt │ │ │ ├── running-compas.rst │ │ │ ├── running-detailed-output.rst │ │ │ ├── running-grid.rst │ │ │ ├── running-via-cmdline.rst │ │ │ ├── running-via-docker-installation.rst │ │ │ ├── running-via-docker-running.rst │ │ │ ├── running-via-docker.rst │ │ │ └── running-via-python.rst │ │ ├── configuration.rst │ │ ├── docker.rst │ │ ├── pre-processing.rst │ │ ├── random-seed.rst │ │ ├── timestep-files.rst │ │ └── user-guide.rst │ ├── contact-us.rst │ ├── how-to-cite.rst │ ├── quick-links.rst │ ├── references.rst │ └── whats-new.rst └── refs.bib ├── paper.bib ├── paper.md ├── py_tests ├── conftest.py ├── test_binned_integrator.py ├── test_cosmology_setter.py ├── test_data │ ├── README.md │ └── run.sh ├── test_example_notebooks.py ├── test_fast_cosmic_integration.py ├── test_h5copy.py ├── test_h5sample.py ├── test_h5view.py ├── test_plot_detailed_evolution.py ├── test_plot_to_json.py ├── test_run_submit.py ├── test_sample_moe_di_stefano.py ├── test_stroopwafel_interface.py └── test_total_mass_evolved_per_z.py ├── setup.py ├── src ├── BH.cpp ├── BH.h ├── BaseBinaryStar.cpp ├── BaseBinaryStar.h ├── BaseStar.cpp ├── BaseStar.h ├── BinaryConstituentStar.cpp ├── BinaryConstituentStar.h ├── BinaryStar.cpp ├── BinaryStar.h ├── CH.cpp ├── CH.h ├── CHeB.cpp ├── CHeB.h ├── COWD.cpp ├── COWD.h ├── EAGB.cpp ├── EAGB.h ├── EnumHash.h ├── ErrorCatalog.h ├── Errors.cpp ├── Errors.h ├── ErrorsMacros.h ├── FGB.cpp ├── FGB.h ├── GiantBranch.cpp ├── GiantBranch.h ├── HG.cpp ├── HG.h ├── HeGB.cpp ├── HeGB.h ├── HeHG.cpp ├── HeHG.h ├── HeMS.cpp ├── HeMS.h ├── HeWD.cpp ├── HeWD.h ├── Log.cpp ├── Log.h ├── LogMacros.h ├── LogTypedefs.h ├── MR.cpp ├── MR.h ├── MS_gt_07.cpp ├── MS_gt_07.h ├── MS_lte_07.cpp ├── MS_lte_07.h ├── MainSequence.cpp ├── MainSequence.h ├── Makefile ├── Makefile.docker ├── NS.cpp ├── NS.h ├── ONeWD.cpp ├── ONeWD.h ├── Options.cpp ├── Options.h ├── Rand.cpp ├── Rand.h ├── Remnants.cpp ├── Remnants.h ├── Star.cpp ├── Star.h ├── TPAGB.cpp ├── TPAGB.h ├── WhiteDwarfs.cpp ├── WhiteDwarfs.h ├── changelog.h ├── constants.h ├── main.cpp ├── profiling.cpp ├── profiling.h ├── stellarUtils.h ├── typedefs.h ├── utils.cpp ├── utils.h ├── vector3d.cpp ├── vector3d.h ├── yaml.cpp └── yaml.h └── test_data └── sse_detailed_output_files ├── sse_m1.csv ├── sse_m10.csv ├── sse_m100.csv ├── sse_m15.csv ├── sse_m25.csv ├── sse_m3.csv ├── sse_m50.csv ├── sse_m8.csv └── sse_m80.csv /.dictionary.txt: -------------------------------------------------------------------------------- 1 | parms 2 | hist 3 | tHeI 4 | thei 5 | Hist 6 | vie 7 | mye 8 | NWO 9 | nd 10 | lamda 11 | bject 12 | accreting 13 | accrete 14 | accreted 15 | YHe 16 | yhe 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Label the issue** 14 | Please label the 'severity' and 'urgency' of this issue. You can choose: 15 | 16 | `urgency_high` - This is a very urgent issue and should be resolved as soon as possible 17 | 18 | `urgency_moderate` - This is a moderately urgent issue 19 | 20 | `urgency_low` - This issue is not urgent 21 | 22 | `severity_major` - This is a severe bug 23 | 24 | `severity_moderate` - This is a moderately severe bug 25 | 26 | `severity_minor` - This is a minor bug with minimal impact 27 | 28 | **To Reproduce** 29 | Steps to reproduce the behavior: 30 | 1. Go to '...' 31 | 2. Click on '....' 32 | 3. Scroll down to '....' 33 | 4. See error 34 | 35 | **Expected behavior** 36 | A clear and concise description of what you expected to happen. 37 | 38 | **Screenshots** 39 | If applicable, add screenshots to help explain your problem. 40 | 41 | **Versioning (please complete the following information):** 42 | - OS: [e.g. Ubuntu 18.04] 43 | - COMPAS [e.g. v02.09.02] 44 | 45 | **Additional context** 46 | Add any other context about the problem here. 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/dockerhub-ci.yml: -------------------------------------------------------------------------------- 1 | name: Dockerhub Image CI 2 | 3 | on: 4 | push: 5 | branches: [ dev ] 6 | workflow_dispatch: null 7 | 8 | # Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs. 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | release: 15 | name: Build Docker image and push to DockerHub 16 | runs-on: ubuntu-22.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | 20 | - name: Log in to Dockerhub 21 | uses: docker/login-action@v3 22 | with: 23 | username: ${{ secrets.DOCKER_USERNAME }} 24 | password: ${{ secrets.DOCKER_PASSWORD }} 25 | 26 | - name: Get release version 27 | run: echo "COMPAS_VERSION=$(sed -n '/const std::string VERSION_STRING/,/^$/p' ./src/changelog.h | sed 's/.*"\(.*\)"[^"]*$/\1/')" >> $GITHUB_ENV 28 | 29 | - name: Print version 30 | run: echo $COMPAS_VERSION 31 | 32 | - name: Set up Docker Buildx 33 | uses: docker/setup-buildx-action@v3 34 | 35 | - name: Build and push Docker image 36 | uses: docker/build-push-action@v5 37 | with: 38 | context: . 39 | push: true 40 | tags: | 41 | teamcompas/compas:${{ env.COMPAS_VERSION }} 42 | teamcompas/compas:latest 43 | cache-from: type=gha 44 | cache-to: type=gha,mode=max 45 | 46 | -------------------------------------------------------------------------------- /.github/workflows/precommit-checks.yml: -------------------------------------------------------------------------------- 1 | name: Pre-commit Checks 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | # Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs. 8 | concurrency: 9 | group: ${{ github.workflow }}-${{ github.ref }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | pre-commit: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.9' 20 | - uses: pre-commit/action@v3.0.0 21 | - uses: pre-commit-ci/lite-action@v1.0.1 22 | if: always() 23 | 24 | 25 | -------------------------------------------------------------------------------- /.github/workflows/tag_creation.yml: -------------------------------------------------------------------------------- 1 | name: Tag & Release on changelog.h Update 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | tag_release: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | with: 15 | fetch-depth: 0 # Ensures full git history is available 16 | 17 | - name: Check if src/changelog.h was changed 18 | id: file_check 19 | run: | 20 | # Compare the pushed commits to see if changelog.h was updated 21 | if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q "src/changelog.h"; then 22 | echo "src/changelog.h was changed" 23 | echo "changed=true" >> $GITHUB_OUTPUT 24 | else 25 | echo "src/changelog.h was NOT changed" 26 | echo "changed=false" >> $GITHUB_OUTPUT 27 | fi 28 | 29 | - name: Extract version string from src/changelog.h 30 | id: get_version 31 | if: steps.file_check.outputs.changed == 'true' 32 | run: | 33 | # Assumes a line like: const std::string VERSION_STRING = "03.13.01"; 34 | VERSION=$(grep 'const std::string VERSION_STRING' src/changelog.h | sed -E 's/.*"([^"]+)".*/\1/') 35 | echo "Extracted version: ${VERSION}" 36 | # Export the version to be used in subsequent steps 37 | echo "version=${VERSION}" >> $GITHUB_ENV 38 | 39 | - name: Create Git Tag 40 | if: steps.file_check.outputs.changed == 'true' 41 | run: | 42 | # Configure Git user 43 | git config --global user.name "github-actions" 44 | git config --global user.email "actions@github.com" 45 | TAG="v${{ env.version }}" 46 | echo "Creating tag: $TAG" 47 | git tag "$TAG" 48 | git push origin "$TAG" 49 | 50 | - name: Create GitHub Release 51 | if: steps.file_check.outputs.changed == 'true' 52 | uses: softprops/action-gh-release@v2 53 | with: 54 | tag_name: v${{ env.version }} 55 | name: Release v${{ env.version }} 56 | body: "Auto-generated release for version v${{ env.version }}" 57 | draft: false 58 | prerelease: false 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS generated files 2 | .DS_Store 3 | .DS_Store? 4 | ._* 5 | .Spotlight-V100 6 | .Trashes 7 | ehthumbs.db 8 | Thumbs.db 9 | 10 | 11 | # Compiled source 12 | *.egg-info/ 13 | *.com 14 | *.class 15 | *.dll 16 | *.exe 17 | *.o 18 | *.so 19 | *.pyc 20 | 21 | # Others 22 | .ipynb_checkpoints/ 23 | __pycache__/ 24 | COMPAS_Output*/ 25 | output*/ 26 | *.coverage 27 | test_artifacts/ 28 | 29 | COMPAS 30 | *.log 31 | *.aux 32 | *.toc 33 | *.bbl 34 | *.blg 35 | *.pdf 36 | *.eps 37 | *.png 38 | *.synctex 39 | *.synctex(busy) 40 | *.synctex.gz 41 | *.synctex.gz(busy) 42 | 43 | # docs html 44 | *_build 45 | *.vscode 46 | 47 | /utils/examples/*.ipynb 48 | /utils/examples/*.h5 49 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | default_language_version: 2 | python: python3 3 | repos: 4 | - repo: https://github.com/codespell-project/codespell 5 | rev: v2.2.4 6 | hooks: 7 | - id: codespell # Spellchecker 8 | args: [--ignore-words=.dictionary.txt, --skip, '*.eps,*.svg,*.ipynb,./misc/*,paper.md,./online-docs/index.rst'] 9 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the OS, Python version and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.11" 13 | 14 | # Build documentation in the online-docs/ directory with Sphinx 15 | sphinx: 16 | builder: html 17 | configuration: online-docs/conf.py 18 | 19 | # Build only html documentation (specificall, don't build PDF!) 20 | formats: [] 21 | 22 | # Set the version of Python and other tools you might need 23 | python: 24 | install: 25 | - method: pip 26 | path: . 27 | extra_requirements: 28 | - docs 29 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # COMPAS Code of Conduct 2 | 3 | Dear colleagues: 4 | 5 | I want to take this opportunity to remind all of us (myself included) 6 | how important it is to maintain the highest standards of respectful and tolerant 7 | behavior in our professional interactions. 8 | 9 | We are fortunate that Team COMPAS is a diverse group, and we want to benefit 10 | from that diversity and make sure that everyone in the team feels comfortable and welcome. 11 | 12 | There are numerous codes of conduct describing what is considered appropriate 13 | professional behaviour; since many of us are based in Australia and connected to OzGrav, 14 | let me point to these two in particular: 15 | 16 | ASA code of conduct: 17 | 18 | OzGrav code of conduct: 19 | 20 | Fundamentally, all of these codes are focused on one thing: 21 | maintaining a professional environment where everyone is treated with respect. 22 | 23 | 24 | If you notice that this is not happening, and are comfortable with doing so, please speak up or let me know offline*. We (myself included) should aim to be held accountable to each other, respect being challenged for our behavior, and remain willing to get advice on how we as individuals can help create a welcoming community where we can all thrive. Making mistakes is how we learn, both as individuals and as a community. I and others will be very grateful if you let us know about any suggestions and will endeavor to learn from them. 25 | 26 | But there may be situations where this can be very uncomfortable. 27 | With that in mind, I’ve asked Prof. Elena Maria Rossi from Leiden University in the 28 | Netherlands to act as the COMPAS Ombudsperson, and Elena kindly agreed to do so. 29 | In addition to being a brilliant astrophysicist, 30 | Elena has a wealth of experience in championing equality and inclusivity; 31 | for example, she is the founder and chair of the LISA consortium Diversity and Inclusion committee. 32 | If you are experiencing any issues in interactions with COMPAS colleagues and would 33 | like to discuss them confidentially with someone who is outside of any local structures, 34 | please contact Elena, her contact details can be found at 35 | 36 | Best wishes, 37 | Ilya 38 | 39 | * see for my contact information 40 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | WORKDIR /app/COMPAS 4 | 5 | RUN apt-get update && apt-get install -y \ 6 | g++ \ 7 | libhdf5-serial-dev \ 8 | libboost-all-dev \ 9 | libgsl-dev \ 10 | python3 \ 11 | python3-pip \ 12 | zip 13 | 14 | # RUN pip install numpy awscli 15 | RUN pip3 install numpy 16 | RUN pip3 install pyyaml 17 | 18 | # Copy only the source required to compile COMPAS 19 | COPY src/ src/ 20 | 21 | RUN mkdir obj bin logs 22 | 23 | ENV COMPAS_ROOT_DIR /app/COMPAS 24 | 25 | # Compile COMPAS 26 | RUN cd src && make -f Makefile.docker -j $(nproc) 27 | 28 | # Run COMPAS 29 | # CMD [ "python", "src/pythonSubmitDefault.py" ] 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 COMPAS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /compas_python_utils/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = [] 3 | 4 | __author__ = "Team COMPAS" 5 | __email__ = "compas email" 6 | __uri__ = "https://github.com/TeamCOMPAS/COMPAS" 7 | __license__ = "MIT" 8 | __description__ = "COMPAS" 9 | __copyright__ = "Copyright 2022 COMPAS developers" 10 | __contributors__ = "https://github.com/TeamCOMPAS/COMPAS/graphs/contributors" 11 | __version__ = "0.0.1" -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/cosmic_integration/SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5 -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/cosmic_integration/__init__.py -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/__init__.py: -------------------------------------------------------------------------------- 1 | from .detection_matrix import DetectionMatrix -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/bin_2d_data.py: -------------------------------------------------------------------------------- 1 | from .gpu_utils import xp 2 | 3 | 4 | def bin_2d_data(data2d: xp, data1d: xp, bins: xp, axis=0): 5 | """Bin data2d and data1d along the given axis using the given 1d bins""" 6 | 7 | num_bins = len(bins) 8 | bin_data1d_falls_in = xp.digitize(data1d, bins, right=True) 9 | 10 | assert num_bins <= data2d.shape[axis], "More bins than data-rows!" 11 | assert len(bin_data1d_falls_in) == len(data1d), "Something went wrong with binning" 12 | assert data2d.shape[axis] == len(data1d), "Data2d and bins do not match" 13 | 14 | # bin data 15 | binned_data_shape = list(data2d.shape) 16 | binned_data_shape[axis] = num_bins 17 | binned_data = xp.zeros(binned_data_shape) 18 | 19 | for i in range(num_bins): 20 | if axis == 0: 21 | binned_data[i, :] = xp.sum(data2d[bin_data1d_falls_in == i, :], axis=axis) 22 | else: 23 | binned_data[:, i] = xp.sum(data2d[:, bin_data1d_falls_in == i], axis=axis) 24 | return binned_data 25 | -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/conversions.py: -------------------------------------------------------------------------------- 1 | from .gpu_utils import xp 2 | 3 | 4 | def m1_m2_to_chirp_mass(m1, m2): 5 | return (m1 * m2) ** (3 / 5) / (m1 + m2) ** (1 / 5) 6 | 7 | 8 | def m1_m2_to_eta(m1, m2): 9 | return m1 * m2 / (m1 + m2) ** 2 10 | 11 | 12 | def m1_m2_to_eta_chirp_mass(m1, m2): 13 | return m1_m2_to_eta(m1, m2), m1_m2_to_chirp_mass(m1, m2) 14 | 15 | 16 | def chirp_mass_eta_to_total_mass(chirp_mass, eta): 17 | return chirp_mass / eta ** (3 / 5) 18 | 19 | 20 | def total_mass_eta_to_m1_m2(total_mass, eta): 21 | m1 = total_mass * 0.5 * (1. + xp.sqrt(1. - 4 * eta)) 22 | m2 = total_mass - m1 23 | return m1, m2 24 | 25 | 26 | def chirp_mass_eta_to_m1_m2(chirp_mass, eta): 27 | total_mass = chirp_mass_eta_to_total_mass(chirp_mass, eta) 28 | return total_mass_eta_to_m1_m2(total_mass, eta) 29 | -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/gpu_utils.py: -------------------------------------------------------------------------------- 1 | try: 2 | import cupy as cp 3 | gpu_available = True 4 | 5 | except (ModuleNotFoundError, ImportError): 6 | import numpy as np 7 | gpu_available = False 8 | 9 | if gpu_available: 10 | xp = cp 11 | 12 | else: 13 | xp = np -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/snr_grid.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from .conversions import chirp_mass_eta_to_m1_m2, m1_m2_to_eta_chirp_mass 3 | from .gpu_utils import xp 4 | from ..selection_effects import SNRinterpolator, detection_probability_from_snr 5 | from .plotting import plot_snr_grid 6 | 7 | MC_MAX = 300.0 8 | MC_STEP = 0.1 9 | 10 | ETA_MAX = 0.25 11 | ETA_STEP = 0.01 12 | 13 | SNR_THRESHOLD = 8.0 14 | SNR_MAX = 1000.0 15 | SNR_STEP = 0.1 16 | 17 | 18 | class SNRGrid: 19 | def __init__( 20 | self, 21 | sensitivity="O1", 22 | ): 23 | self.sensitivity = sensitivity 24 | self.snr_threshold = SNR_THRESHOLD 25 | self.chirp_mass = xp.arange(MC_STEP, MC_MAX + MC_STEP, MC_STEP) 26 | self.eta = xp.arange(ETA_STEP, ETA_MAX + ETA_STEP, ETA_STEP) 27 | self.m1, self.m2 = chirp_mass_eta_to_m1_m2(*xp.meshgrid(self.chirp_mass, self.eta)) 28 | # TODO: SNRInterpolator can be GPU-ized 29 | self.snr_grid_at_1Mpc = SNRinterpolator(sensitivity)(self.m1, self.m2) 30 | self.snr = xp.arange(SNR_STEP, SNR_MAX + SNR_STEP, SNR_STEP) 31 | self.pdetection = detection_probability_from_snr(self.snr, SNR_THRESHOLD) 32 | 33 | self.Mc_step = MC_STEP 34 | self.eta_step = ETA_STEP 35 | self.snr_step = SNR_STEP 36 | 37 | def plot(self): 38 | return plot_snr_grid( 39 | snr_grid_at_1Mpc=self.snr_grid_at_1Mpc, 40 | m1=self.m1, m2=self.m2, 41 | snr=self.snr, pdetection=self.pdetection, 42 | snr_threshold=SNR_THRESHOLD, 43 | ) 44 | 45 | @property 46 | def label(self): 47 | return f"snr_{self.sensitivity}" 48 | -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/binned_cosmic_integrator/stellar_type.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, auto 2 | 3 | 4 | class STELLAR_TYPE(Enum): 5 | MS_LTE_07 = 0 6 | MS_GT_07 = auto() 7 | HERTZSPRUNG_GAP = auto() 8 | FIRST_GIANT_BRANCH = auto() 9 | CORE_HELIUM_BURNING = auto() 10 | EARLY_ASYMPTOTIC_GIANT_BRANCH = auto() 11 | THERMALLY_PULSING_ASYMPTOTIC_GIANT_BRANCH = auto() 12 | NAKED_HELIUM_STAR_MS = auto() 13 | NAKED_HELIUM_STAR_HERTZSPRUNG_GAP = auto() 14 | NAKED_HELIUM_STAR_GIANT_BRANCH = auto() 15 | HELIUM_WHITE_DWARF = auto() 16 | CARBON_OXYGEN_WHITE_DWARF = auto() 17 | OXYGEN_NEON_WHITE_DWARF = auto() 18 | NEUTRON_STAR = auto() 19 | BLACK_HOLE = auto() 20 | MASSLESS_REMNANT = auto() 21 | CHEMICALLY_HOMOGENEOUS = auto() 22 | STAR = auto() 23 | BINARY_STAR = auto() 24 | NONE = auto() 25 | 26 | BH = [STELLAR_TYPE.BLACK_HOLE] 27 | NS = [STELLAR_TYPE.NEUTRON_STAR] 28 | WD = [STELLAR_TYPE.HELIUM_WHITE_DWARF, 29 | STELLAR_TYPE.CARBON_OXYGEN_WHITE_DWARF, 30 | STELLAR_TYPE.HELIUM_WHITE_DWARF, 31 | STELLAR_TYPE.OXYGEN_NEON_WHITE_DWARF] 32 | 33 | -------------------------------------------------------------------------------- /compas_python_utils/cosmic_integration/cosmology.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | from astropy import cosmology as cosmo 3 | 4 | DEFAULT_COSMOLOGY = cosmo.Planck18 5 | COSMOLOGY = [ 6 | DEFAULT_COSMOLOGY, 7 | DEFAULT_COSMOLOGY.name 8 | ] 9 | COSMO_TYPE = Union[cosmo.FLRW, str, dict] 10 | 11 | def get_cosmology(cosmology: COSMO_TYPE = None) -> cosmo.FLRW: 12 | """ 13 | Get an instance of a astropy.cosmology.FLRW subclass. 14 | 15 | Eg: 16 | cosmology.get_cosmology() 17 | cosmology.get_cosmology(astropy.cosmology.WMAP9) 18 | cosmology.get_cosmology("WMAP9") 19 | cosmology.get_cosmology(dict(H0=67.7, Om0=0.3, Ode0=0.7, w0=-1.0) --> wCDM 20 | cosmology.get_cosmology(dict(H0=67.7, Om0=0.3, Ode0=0.7) --> LambdaCDM 21 | 22 | 23 | 24 | Parameters 25 | ========== 26 | cosmology: astropy.cosmology.FLRW, str, dict 27 | Description of cosmology, one of: 28 | None - Use DEFAULT_COSMOLOGY 29 | Instance of astropy.cosmology.FLRW subclass 30 | String with name of known Astropy cosmology, e.g., "Planck18" 31 | Dictionary with arguments required to instantiate the cosmology 32 | class. 33 | """ 34 | global COSMOLOGY 35 | 36 | 37 | if cosmology is None: 38 | cosmology = DEFAULT_COSMOLOGY 39 | 40 | # if already a 'astropy.cosmology' object 41 | elif isinstance(cosmology, cosmo.FLRW): 42 | cosmology = cosmology 43 | 44 | elif isinstance(cosmology, str): 45 | cosmology = getattr(cosmo, cosmology) 46 | 47 | elif isinstance(cosmology, dict): 48 | if 'Ode0' in cosmology.keys(): 49 | if 'w0' in cosmology.keys(): 50 | cosmology = cosmo.wCDM(**cosmology) 51 | else: 52 | cosmology = cosmo.LambdaCDM(**cosmology) 53 | else: 54 | cosmology = cosmo.FlatLambdaCDM(**cosmology) 55 | 56 | # cache the cosmology 57 | COSMOLOGY[0] = cosmology 58 | COSMOLOGY[1] = repr(cosmology) if not cosmology.name else cosmology.name 59 | 60 | return cosmology 61 | 62 | 63 | def set_cosmology(cosmology: COSMO_TYPE = None): 64 | """ 65 | 66 | """ 67 | _set_default_cosmology() 68 | if cosmology is None: 69 | cosmology = DEFAULT_COSMOLOGY 70 | 71 | -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/__init__.py -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/1.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/10.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/11.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/12.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/13.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/14.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/15.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/16.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/17.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/18.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/19.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/2.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/20.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/21.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/22.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/23.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/24.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/25.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/26.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/27.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/28.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/29.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/3.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/30.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/31.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/32.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/33.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/34.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/35.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/36.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/37.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/38.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/39.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/4.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/40.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/41.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/42.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/43.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/44.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/45.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/46.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/47.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/48.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/49.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/5.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/50.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/51.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/52.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/53.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/54.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/55.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/56.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/57.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/58.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/59.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/6.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/60.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/7.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/8.png -------------------------------------------------------------------------------- /compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/detailed_evolution_plotter/van_den_heuvel_figures/9.png -------------------------------------------------------------------------------- /compas_python_utils/preprocessing/SSE_Grid.txt: -------------------------------------------------------------------------------- 1 | --initial-mass 36.32588335986214 --kick-magnitude-random 0.22624909470693577 --metallicity 0.0142 2 | --initial-mass 5.606575612328568 --kick-magnitude-random 0.3689824639824618 --metallicity 0.0142 3 | --initial-mass 11.20691874884929 --kick-magnitude-random 0.3792907803464646 --metallicity 0.0142 4 | --initial-mass 5.059278281829125 --kick-magnitude-random 0.6770037129805918 --metallicity 0.0142 5 | --initial-mass 6.990165346854218 --kick-magnitude-random 0.486502081144464 --metallicity 0.0142 6 | --initial-mass 20.112545900751257 --kick-magnitude-random 0.17673562339298687 --metallicity 0.0142 7 | --initial-mass 16.554960129185865 --kick-magnitude-random 0.12963901371350428 --metallicity 0.0142 8 | --initial-mass 19.16010622218186 --kick-magnitude-random 0.8774916458475752 --metallicity 0.0142 9 | --initial-mass 7.212376129897965 --kick-magnitude-random 0.5009827094374167 --metallicity 0.0142 10 | --initial-mass 17.67092839103423 --kick-magnitude-random 0.4027250560739488 --metallicity 0.0142 11 | -------------------------------------------------------------------------------- /compas_python_utils/preprocessing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/compas_python_utils/preprocessing/__init__.py -------------------------------------------------------------------------------- /misc/COMPAS_logos/COMPAS_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/misc/COMPAS_logos/COMPAS_banner.png -------------------------------------------------------------------------------- /misc/COMPAS_logos/COMPAS_sticker_GW.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/misc/COMPAS_logos/COMPAS_sticker_GW.pdf -------------------------------------------------------------------------------- /misc/README.md: -------------------------------------------------------------------------------- 1 | [//]: ## (Outline features) 2 | The *COMPAS/utils* directory contains scripts and codes related to COMPAS that are not part of the core COMPAS C++ code in *COMPAS/src*. 3 | 4 | Examples include code to process, edit, plot, and/or analyze COMPAS data. These scripts have been developed by COMPAS users and are shared to make it easier for users to work with their data. 5 | 6 | This folder contains the following folders: 7 | 8 | - Tutorial 9 | - CHE_demo 10 | - untracked_scripts 11 | - examples 12 | - methods_paper_plots 13 | - fig_8_initial_core_final_mass_relations 14 | - detailed_evolution 15 | - fig_6_max_R 16 | - fig_7_MS_lifetime 17 | - fig_5_HR_diagram 18 | - fig_16_Chirpmass_distribution 19 | - preProcessing 20 | - COMPAS-logo 21 | - CosmicIntegration 22 | - media 23 | - vanDenHeuvel_figures 24 | -------------------------------------------------------------------------------- /misc/cicd-scripts/centos-dependencies: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | yum clean all 4 | rm -rf /var/cache/yum/* 5 | yum makecache 6 | yum update -y 7 | yum -y install epel-release 8 | yum -y install boost boost-thread boost-devel 9 | yum -y install gsl 10 | yum -y install gsl-devel 11 | yum -y install hdf5 12 | yum -y group install "Development Tools" -------------------------------------------------------------------------------- /misc/cicd-scripts/linux-dependencies: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | 4 | sudo apt-get install -y \ 5 | texlive-latex-recommended \ 6 | texlive-latex-extra \ 7 | texlive-fonts-recommended \ 8 | texlive-fonts-extra \ 9 | texlive-xetex \ 10 | latexmk \ 11 | xindy \ 12 | dvipng \ 13 | cm-super 14 | sudo apt install texlive-latex-extra --fix-missing 15 | sudo apt update && sudo apt install g++ libboost-all-dev libgsl-dev libhdf5-serial-dev 16 | sudo apt-get install gcc libpq-dev -y 17 | sudo apt-get install python3-dev python3-pip python3-venv python3-wheel -y -------------------------------------------------------------------------------- /misc/cicd-scripts/macos-dependencies: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 4 | export PATH="/usr/local/opt/python/libexec/bin:$PATH" 5 | brew --version 6 | brew install gsl 7 | brew install boost 8 | brew install hdf5 9 | brew install mactex 10 | eval "$(/usr/libexec/path_helper)" 11 | export PATH="/usr/local/texlive:/Library/TeX/texbin:$PATH" 12 | pdflatex --version 13 | 14 | brew install basictex 15 | eval "$(/usr/libexec/path_helper)" 16 | export PATH="/usr/local/texlive:/Library/TeX/texbin:$PATH" 17 | sudo tlmgr update --self 18 | sudo tlmgr install dvipng 19 | sudo tlmgr install texliveonfly 20 | sudo tlmgr install environ 21 | sudo tlmgr install adjustbox 22 | sudo tlmgr install tcolorbox 23 | sudo tlmgr install collectbox 24 | sudo tlmgr install ucs 25 | sudo tlmgr install trimspaces 26 | sudo tlmgr install titling 27 | sudo tlmgr install enumitem 28 | sudo tlmgr install rsfs 29 | eval "$(/usr/libexec/path_helper)" 30 | -------------------------------------------------------------------------------- /misc/examples/Tutorials/Overview.py: -------------------------------------------------------------------------------- 1 | # --- 2 | # jupyter: 3 | # jupytext: 4 | # text_representation: 5 | # extension: .py 6 | # format_name: light 7 | # format_version: '1.5' 8 | # jupytext_version: 1.14.1 9 | # kernelspec: 10 | # display_name: Python 3 11 | # language: python 12 | # name: python3 13 | # --- 14 | 15 | # 16 | # 17 | 18 | # # [COMPAS](http://compas.science) 19 | 20 | # ## Introduction 21 | # 22 | # Welcome to the post-processing documentation of the COMPAS code. In here, you will find scripts used to manipulate the data and calculate rates/weights/samples to place the results of the simulation into a scientific context. 23 | # 24 | # We provide a series of jupyter/ipython notebooks and 'raw' python scripts. The notebooks show how to call the python scripts and the involved syntax. All notebooks are made into html pages for easy reading and indexing of available material. 25 | # 26 | # You may also find the online [Documentation](https://compas.readthedocs.io/en/latest/index.html) helpful. 27 | # 28 | # 29 | # ## How to reference 30 | # 31 | # To acknowledge COMPAS source code or data, please see [Acknowledgements.](https://github.com/TeamCOMPAS/COMPAS/tree/master/README.md#Acknowledgements) To cite the specific pipelines used in these Jupyter Notebooks, please cite the relevant paper: 32 | # 33 | # - [Cosmic Integration](https://arxiv.org/abs/1906.08136) 34 | # 35 | # - [Selection effects](https://arxiv.org/pdf/1711.06287) 36 | # 37 | 38 | # ## Material 39 | # 40 | # ### [Working with HDF5 files:](WorkingWithHDF5.ipynb) 41 | # Compiling, reading, rewriting 42 | # 43 | # 44 | # ### [Basic Data Analysis in Python:](DataAnalysis.ipynb) 45 | # Slicing, binning, plotting 46 | # 47 | # 48 | # ### [Implementing Cosmic Integration:](CosmicIntegration.ipynb) 49 | # Merger rates, redshift, MSSFR 50 | -------------------------------------------------------------------------------- /misc/examples/Tutorials/README.txt: -------------------------------------------------------------------------------- 1 | ############################################### 2 | # # 3 | # COMPAS post-processing Documentation # 4 | # # 5 | ############################################### 6 | 7 | 8 | Started 19th July 2019 9 | 10 | 11 | 12 | This folder contains a series of scripts and notebooks 13 | to help/guide a user in handling of the data from a 14 | COMPAS simulation. This is a collaborative effort and 15 | no single person should claim authorship. 16 | 17 | 18 | The post-processing is done with a combination of 19 | python scripts and ipython notebooks. Numpy 20 | will drop support for python 2.X. Hence the python scripts 21 | and the notebooks will be in python 3.X. 22 | 23 | Notes etc are in ipython notebook, they are mirrored 24 | by their htmls allowing for linked pages in a web environment. 25 | The plain python scripts are also in the respective folders. 26 | I.e. the scripts related to h5 files are in the h5 folder 27 | 28 | You can either read through the htmls made with an example data-set 29 | starting by opening the overview.html 30 | Alternatively you can navigate to this directory and type: 31 | 32 | $ ipython notebook 33 | 34 | Open the notebook of interest and set the path to your personal COMPASOutput.h5 35 | and run the notebooks on your own data. 36 | 37 | 38 | Good luck.... 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /misc/examples/Tutorials/SFRD_cartoon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/misc/examples/Tutorials/SFRD_cartoon.png -------------------------------------------------------------------------------- /misc/examples/Tutorials/tutorial_grid.txt: -------------------------------------------------------------------------------- 1 | # CEEs - no CO 2 | --random-seed 1636090318 --initial-mass-1 12.703562 --initial-mass-2 2.403020 --semi-major-axis 4.709733 3 | # BHNS 4 | --random-seed 1636090389 --initial-mass-1 76.555207 --initial-mass-2 39.541749 --semi-major-axis 0.855167 5 | # BHBH 6 | --random-seed 1636091116 --initial-mass-1 113.445902 --initial-mass-2 81.697634 --semi-major-axis 1.013902 7 | # NSNS 8 | --random-seed 101048 --initial-mass-1 24.94177 --initial-mass-2 15.42647 --semi-major-axis 0.5196680 9 | --random-seed 102660 --initial-mass-1 26.74675 --initial-mass-2 16.57629 --semi-major-axis 0.8079884 10 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/README.md: -------------------------------------------------------------------------------- 1 | [//]: ## (grip -b README.md) 2 | 3 | This directory contains scripts to reproduce the plots in the COMPAS Methods paper (TeamCompas, Riley, J., et al. 2021). 4 | 5 | These are not kept up to date with newer COMPAS versions, and we do not guarantee they will work with newer data. 6 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/detailed_evolution/Grid_demo.txt: -------------------------------------------------------------------------------- 1 | --initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.5 --kick-magnitude-1 0 --kick-magnitude-2 0 2 | --initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.6 --kick-magnitude-1 0 --kick-magnitude-2 0 3 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/detailed_evolution/run.sh: -------------------------------------------------------------------------------- 1 | echo "Run example COMPAS job using the config example_bbh_compas_config.yaml" 2 | compas_run_submit example_bbh_compas_config.yaml > example_bbh.log 3 | cat example_bbh.log 4 | echo "Generating detailed evolution plot" 5 | compas_plot_detailed_evolution "./COMPAS_Output/Detailed_Output/BSE_Detailed_Output_0.h5" --dont-show >> example_bbh.log 6 | echo "Out files:" 7 | ls -l 8 | 9 | 10 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_16_Chirpmass_distribution/COMPAS_Output_Definitions.txt: -------------------------------------------------------------------------------- 1 | 2 | # sample standard log file specifications file 3 | 4 | # the '#' character and anything following it on a single line is considered a comment 5 | # (so, lines starting with '#' are comment lines) 6 | 7 | # case is not significant 8 | # specifications can span several lines 9 | # specifications for the same log file are cumulative 10 | # if a log file is not specified in this file, the default specification is used 11 | 12 | 13 | # BSE System Parameters 14 | # start with the default BSE System Parameters specification and add: 15 | bse_sysparms_rec += { # set the BSE System Parameters specification to: 16 | BINARY_PROPERTY::OPTIMISTIC_COMMON_ENVELOPE, # Optimistic CE flag 17 | BINARY_PROPERTY::IMMEDIATE_RLOF_POST_COMMON_ENVELOPE, # Flag to indicate if either star overflows its Roche lobe immediately following common envelope event. 18 | BINARY_PROPERTY::COMMON_ENVELOPE_EVENT_COUNT, 19 | BINARY_PROPERTY::SYSTEMIC_SPEED, 20 | } 21 | 22 | 23 | # BSE Double Compas Objects 24 | # start with the default Double Compas Objects specification and add: 25 | BSE_DCO_Rec += { 26 | BINARY_PROPERTY::OPTIMISTIC_COMMON_ENVELOPE, 27 | BINARY_PROPERTY::IMMEDIATE_RLOF_POST_COMMON_ENVELOPE, 28 | BINARY_PROPERTY::COMMON_ENVELOPE_EVENT_COUNT, 29 | STAR_1_PROPERTY::METALLICITY, 30 | STAR_1_PROPERTY::MASS_TRANSFER_DONOR_HISTORY, 31 | STAR_2_PROPERTY::MASS_TRANSFER_DONOR_HISTORY, 32 | } 33 | 34 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_16_Chirpmass_distribution/README.md: -------------------------------------------------------------------------------- 1 | # How to recreate/edit the BBH chirp mass distribution from the COMPAS methods paper 2 | 3 | This folder contains everything you need to reproduce the BBH chirpmass distribution from the COMPAS methods paper (_arXiv_: https://arxiv.org/abs/2109.10352; Team COMPAS et al. 2021). 4 | 5 | 6 | The data used for this figure is publicly available at: https://zenodo.org/record/5655483 7 | 8 | This data set contains the output of 10,000,000 binaries evolved using COMPAS 02.21.00, using adaptive importance sampling (STROOPWAFEL, Broekgaarden et al. 2019), sampling from a metallicity uniform in $\log(Z) \in [10^{-4},0.03]$. More details can be found in `Run_Details.txt`. 9 | 10 | ### Data reporduction 11 | The data can be reproduced by running version `02.21.00` of COMPAS, 12 | 13 | 1. Run `stroopwafel_interface.py`, that reads in the `Fig16_pythonSubmit.py.py` (both contained in this folder). 14 | 2. Calculate the rates by running ```FastCosmicIntegration.py``` from COMPAS's post-processing tools, with the following flags altered from their default values: 15 | 16 | 17 | ```:::bash 18 | python FastCosmicIntegration.py --mu0 0.035 --muz -0.23 --sigma0 0.39 --sigmaz 0.0 --alpha 0.0 --weight mixture_weight --zstep 0.01 --sens O3 --m1min 10. --aSF 0.01 --bSF 2.77 --cSF 2.9 --dSF 4.7 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_5_HR_diagram/README.md: -------------------------------------------------------------------------------- 1 | # How to recreate/edit the HR diagram from the COMPAS methods paper 2 | 3 | This folder contains everything you need to reproduce (or edit!) the HRD from the methods paper. You'll need to do the following: 4 | 5 | 1. Run `python create_fig_5_grid.py` to create a grid of stars for the plot (you can change this to a custom range of masses or metallicities if you like) 6 | 2. Run `python pythonSubmit.py` to run COMPAS for this grid 7 | 3. Open `make_fig_5.ipynb` in Jupyter Lab/notebook and run the whole thing to create the figure (and learn how to change it) 8 | 9 | For reference, the changes from the *default* pythonSubmit.py are just: 10 | 11 | - use detailed output 12 | - use smaller time steps (to get smoother lines for the plot) -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_5_HR_diagram/create_fig_5_grid.py: -------------------------------------------------------------------------------- 1 | """ This file creates a grid of stars for the HRD plot """ 2 | 3 | # use solar and low metallicity 4 | metallicities = [0.0142, 0.001] 5 | 6 | # circular binaries with a separation so wide that they are effectively single 7 | eccentricity = 0.0 8 | a = 1e20 9 | 10 | with open("grid.txt", "w") as f: 11 | # mass range: basically logspace from 0.5 to 50 but with cleaner numbers 12 | masses = [0.5, 0.65, 0.80, 1.0, 1.3, 1.6, 2.0, 2.5, 3.2, 4.0, 5.2, 6.5, 8.2, 10.3, 13.0, 16.5, 21, 26, 33, 45, 65, 90, 115, 150] 13 | 14 | grid_lines = ["--initial-mass-1 {} --initial-mass-2 {} --metallicity {} --eccentricity {} --semi-major-axis {} \n".format(masses[i], 0.1, metallicities[j], eccentricity, a) for j in range(len(metallicities)) for i in range(len(masses))] 15 | f.writelines(grid_lines) 16 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_6_max_R/README.md: -------------------------------------------------------------------------------- 1 | # How to recreate/edit the maximum radius plot from the COMPAS methods paper 2 | 3 | This folder contains everything you need to reproduce (or edit!) the maximum radius plot from the methods paper. You'll need to do the following: 4 | 5 | 1. Run `python create_fig_6_grid.py` to create a grid of stars for the plot (you can change this to a custom range of masses or metallicities if you like) 6 | 2. Run `python pythonSubmit.py` to run COMPAS for this grid (note this is probably going to take about 10 minutes!) 7 | 3. Open `make_fig_6.ipynb` in Jupyter Lab/notebook and run the whole thing to create the figure (and learn how to change it) 8 | 9 | For reference, the changes from the *default* pythonSubmit.py are just: 10 | 11 | - use detailed output 12 | - use smaller time steps (to get smoother lines for the plot) -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_6_max_R/create_fig_6_grid.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | """ This file creates a grid of stars for the HRD plot """ 4 | 5 | # use solar and low metallicity 6 | metallicities = [0.0142, 0.001] 7 | 8 | # circular binaries with a separation so wide that they are effectively single 9 | eccentricity = 0.0 10 | a = 1e20 11 | 12 | with open("grid.txt", "w") as f: 13 | masses = np.round(np.logspace(np.log10(0.5), np.log10(150.0), 500), 3) 14 | 15 | grid_lines = ["--initial-mass-1 {} --initial-mass-2 {} --metallicity {} --eccentricity {} --semi-major-axis {} \n".format(masses[i], 0.1, metallicities[j], eccentricity, a) for j in range(len(metallicities)) for i in range(len(masses))] 16 | f.writelines(grid_lines) 17 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_7_MS_lifetime/README.md: -------------------------------------------------------------------------------- 1 | # How to recreate/edit the main sequence lifetime plot from the COMPAS methods paper 2 | 3 | This folder contains everything you need to reproduce (or edit!) the main sequence plot from the methods paper. This one is a little simpler than some of the other plots as it comes directly from the fitting formulae in Hurley+00 and hence can be created without running COMPAS. 4 | 5 | Therefore all you need to do is open `make_fig_7.ipynb` in Jupyter Lab/notebook and run the whole thing to create the figure (and learn how to change it). -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_8_initial_core_final_mass_relations/README.md: -------------------------------------------------------------------------------- 1 | # How to recreate/edit the initial-core-final mass relation plot from the COMPAS methods paper 2 | 3 | This folder contains everything you need to reproduce (or edit!) the initial-core-final mass relation plot from the methods paper. You'll need to do the following: 4 | 5 | 1. Run `python create_fig_8_grids.py` to create a grid of stars for the plot 6 | 2. Run three different python submit files: `python pythonSubmitDefaults.py`,`python pythonSubmitRapid.py` and `python pythonSubmitMandelMueller.py` to run COMPAS for these three grids(note this is probably going to take quite a few minutes!) 7 | 3. Open `make_fig_8.ipynb` in Jupyter Lab/notebook and run the whole thing to create the figure (and learn how to change it) 8 | 9 | For reference, the changes from the *default* pythonSubmit.py are just: 10 | 11 | - change the output file name (to distinguish the 3 grids) 12 | - change the logfiles definitions so that only the variables needed are included 13 | - change grid name 14 | - (for some) change the remnant mass prescription -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_8_initial_core_final_mass_relations/create_fig_8_grids.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | """ This file creates a grid of stars for the HRD plot """ 4 | 5 | metallicities = [0.0001, 0.001, 0.01, 0.01416] 6 | 7 | # make a small grid for all metallicities 8 | with open("grid.txt", "w") as f: 9 | masses = np.round(np.logspace(np.log10(0.1), np.log10(150.0), 500), 3) 10 | 11 | grid_lines = ["--initial-mass {} --metallicity {} \n".format(masses[i], metallicities[j]) for j in range(len(metallicities)) for i in range(len(masses))] 12 | f.writelines(grid_lines) 13 | 14 | # make a small grid just for solar 15 | with open("rapid_grid.txt", "w") as f: 16 | masses = np.round(np.logspace(np.log10(0.1), np.log10(150.0), 500), 3) 17 | 18 | grid_lines = ["--initial-mass {} --metallicity {} \n".format(masses[i], 0.0001) for i in range(len(masses))] 19 | f.writelines(grid_lines) 20 | 21 | # make a dense grid of solar (mostly dense for NSs and low mass BHs) 22 | with open("MM20_grid.txt", "w") as f: 23 | low_masses = np.round(np.logspace(np.log10(0.1), np.log10(8.0), 200), 4) 24 | med_masses = np.round(np.logspace(np.log10(8.0), np.log10(50.0), 4600), 4) 25 | high_masses = np.round(np.logspace(np.log10(50.0), np.log10(150.0), 200), 4) 26 | masses = np.concatenate((low_masses, med_masses, high_masses)) 27 | 28 | grid_lines = ["--initial-mass {} --metallicity {} \n".format(masses[i], 0.01416) for i in range(len(masses))] 29 | f.writelines(grid_lines) 30 | -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/fig_8_initial_core_final_mass_relations/logfile_defs.txt: -------------------------------------------------------------------------------- 1 | sse_sysparms_rec = { 2 | STAR_PROPERTY::RANDOM_SEED, 3 | STAR_PROPERTY::MASS, 4 | STAR_PROPERTY::MZAMS, 5 | STAR_PROPERTY::CORE_MASS, 6 | STAR_PROPERTY::CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 7 | STAR_PROPERTY::CO_CORE_MASS, 8 | STAR_PROPERTY::CO_CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 9 | STAR_PROPERTY::HE_CORE_MASS, 10 | STAR_PROPERTY::STELLAR_TYPE, 11 | STAR_PROPERTY::METALLICITY, 12 | PROGRAM_OPTION::REMNANT_MASS_PRESCRIPTION, 13 | PROGRAM_OPTION::FRYER_SUPERNOVA_ENGINE 14 | } -------------------------------------------------------------------------------- /misc/examples/methods_paper_plots/stellar_types.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | 3 | """ Define an array of objects containing labels and colours for each stellar type """ 4 | 5 | stellar_types = [ 6 | None, 7 | {"long": "Main Sequence", "short": "MS", "colour": None}, 8 | {"long": "Hertzsprung Gap", "short": "HG", "colour": None}, 9 | {"long": "First Giant Branch", "short": "FGB", "colour": None}, 10 | {"long": "Core Helium Burning", "short": "CHeB", "colour": None}, 11 | {"long": "Early Asymptotic Giant Branch", "short": "EAGB", "colour": None}, 12 | {"long": "Thermally Pulsing Asymptotic Giant Branch", "short": "TPAGB", "colour": None}, 13 | {"long": "Helium Main Sequence", "short": "HeMS", "colour": None}, 14 | {"long": "Helium Hertsprung Gap", "short": "HeHG", "colour": None}, 15 | {"long": "Helium Giant Branch", "short": "HeGB", "colour": None}, 16 | {"long": "Helium White Dwarf", "short": "HeWD", "colour": None}, 17 | {"long": "Carbon/Oxygen White Dwarf", "short": "COWD", "colour": None}, 18 | {"long": "Oxygen/Neon White Dwarf", "short": "ONeWD", "colour": None}, 19 | {"long": "Neutron Star", "short": "NS", "colour": "grey"}, 20 | {"long": "Black Hole", "short": "BH", "colour": "black"}, 21 | {"long": "Massless Remnant", "short": "MR", "colour": "yellow"}, 22 | {"long": "Chemically Homogeneous", "short": "CHE", "colour": "brown"} 23 | ] 24 | 25 | for i in [1, 2]: 26 | stellar_types[i]["colour"] = plt.get_cmap("YlOrBr")(0.3 * i) 27 | 28 | for i in [3, 4]: 29 | stellar_types[i]["colour"] = plt.get_cmap("Blues")(0.3 * (i - 2)) 30 | 31 | for i in [5, 6]: 32 | stellar_types[i]["colour"] = plt.get_cmap("Greens")(0.3 * (3 - (i - 4))) 33 | 34 | for i in [7, 8, 9]: 35 | stellar_types[i]["colour"] = plt.get_cmap("plasma")(0.1 + 0.2 * (i - 7)) 36 | 37 | for i in [10, 11, 12]: 38 | stellar_types[i]["colour"] = plt.get_cmap("copper")(0.1 + 0.2 * (i - 9)) 39 | -------------------------------------------------------------------------------- /misc/unsupported_utils/README.md: -------------------------------------------------------------------------------- 1 | [//]: ## (Outline features) 2 | 3 | This directory contains untracked python scripts, meaning that some users may find them useful, but we do not guarantee that these will work for a given version. 4 | 5 | At some point, we hope to integrate these back into the tracked scripts. 6 | -------------------------------------------------------------------------------- /online-docs/COMPAS-2021methodsPaper.bib: -------------------------------------------------------------------------------- 1 | @ This formats the citation for the COMPAS Methods Paper in our preferred style 2 | @ The following PREAMBLE entry must appear at the top of the bibtex file 3 | 4 | @PREAMBLE{ {\providecommand{\noopsort}[1]{}} } 5 | 6 | @ARTICLE{2022ApJS..258...34R, 7 | author = {{Riley}, Jeff and {Agrawal}, Poojan and {Barrett}, Jim W. and {Boyett}, Kristan N.~K. and {Broekgaarden}, Floor S. and {Chattopadhyay}, Debatri and {Gaebel}, Sebastian M. and {Gittins}, Fabian and {Hirai}, Ryosuke and {Howitt}, George and {Justham}, Stephen and {Khandelwal}, Lokesh and {Kummer}, Floris and {Lau}, Mike Y.~M. and {Mandel}, Ilya and {de Mink}, Selma E. and {Neijssel}, Coenraad and {Riley}, Tim and {van Son}, Lieke and {Stevenson}, Simon and {Vigna-G{\'o}mez}, Alejandro and {Vinciguerra}, Serena and {Wagg}, Tom and {Willcox}, Reinhold and {Team Compas}}, 8 | title = "{Rapid Stellar and Binary Population Synthesis with COMPAS}", 9 | journal = {\apjs}, 10 | keywords = {1622, 154, 1108, 162, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - High Energy Astrophysical Phenomena, Astrophysics - Solar and Stellar Astrophysics}, 11 | year = 2022, 12 | month = feb, 13 | volume = {258}, 14 | number = {2}, 15 | eid = {34}, 16 | pages = {34}, 17 | doi = {10.3847/1538-4365/ac416c}, 18 | archivePrefix = {arXiv}, 19 | eprint = {2109.10352}, 20 | primaryClass = {astro-ph.IM}, 21 | adsurl = {https://ui.adsabs.harvard.edu/abs/2022ApJS..258...34R}, 22 | adsnote = {Provided by the SAO/NASA Astrophysics Data System} 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /online-docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | 5 | # You can set these variables from the command line. 6 | SPHINXOPTS = 7 | SPHINXBUILD = sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Copy the notebook files over from the correct directory 12 | # Put it first so that "make" without argument is like "make help". 13 | help: 14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 15 | 16 | .PHONY: help Makefile 17 | 18 | linkcheck: 19 | @$(SPHINXBUILD) -M linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | 21 | 22 | # Catch-all target: route all unknown targets to Sphinx using the new 23 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 24 | %: Makefile 25 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 26 | -------------------------------------------------------------------------------- /online-docs/README.rst: -------------------------------------------------------------------------------- 1 | COMPAS online documentation 2 | =========================== 3 | 4 | - COMPAS homepage: https://compas.science/docs 5 | - Code documentation: https://compas.readthedocs.io/ 6 | - COMPAS Github: https://github.com/TeamCOMPAS/COMPAS 7 | 8 | 9 | Tools 10 | ----- 11 | 12 | - ReadTheDocs: https://readthedocs.org/ 13 | - Sphinx: https://www.sphinx-doc.org/en/master/index.html 14 | 15 | Updating the documentation 16 | -------------------------- 17 | 18 | 1. Edit .rst files in 'docs/online-docs' 19 | 2. Follow existing structure for new files 20 | 3. Link new files to an index (toctree) 21 | 22 | 23 | Building the documentation locally 24 | ---------------------------------- 25 | 26 | In the repository root directory: 27 | 28 | .. code-block:: bash 29 | 30 | pip install -e '.[dev]' 31 | cd online-docs 32 | make clean 33 | make html 34 | 35 | 36 | 37 | 38 | View results in 'docs/online-docs/_build/html/index.html' 39 | 40 | Make sure there aren't any broken links! See the build logs: 41 | 42 | .. (pages/User guide/docker: line 22) ok https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container 43 | .. (pages/Developer guide/Developer build/docker-developer: line 23) ok https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment 44 | .. (pages/User guide/Running COMPAS/running-via-docker: line 41) broken https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container#:~:text=An%20instance%20of%20an%20image,of%20layers%20as%20you%20describe.&text=You%20can%20see%20all%20your,an%20image%20is%20a%20container - Anchor '%3A~%3Atext%3DAn%20instance%20of%20an%20image%2Cof%20layers%20as%20you%20describe.%26text%3DYou%20can%20see%20all%20your%2Can%20image%20is%20a%20container' not found 45 | .. (pages/User guide/docker: line 49) ok https://www.docker.com/ 46 | 47 | 48 | Pushing the changes online 49 | -------------------------- 50 | 51 | 1. Push updated (.rst) source files to COMPAS repo (not the _build dir) 52 | 2. ReadTheDocs automatically rebuilds (takes up to 15 minutes) 53 | 3. For manual rebuild: 54 | - Log in to https://readthedocs.org/projects/compas/ 55 | - Go to 'Overview' page 56 | - Click 'Build' button 57 | 58 | Note: If build fails with "environment" error, wait and retry. 59 | 60 | Logon details can be found on the COMPAS slack workspace (devel\_compas\_documentation channel). 61 | -------------------------------------------------------------------------------- /online-docs/_static/css/COMPAS.css: -------------------------------------------------------------------------------- 1 | /* This is here because the :class: attribute doesn't seem to work with flat-table - it does with list-table */ 2 | /* flat-table allows spanning of columns - list-table doesn't... */ 3 | /* unfortunately this takes borders of ALL rst tables */ 4 | .rst-content table.docutils, .wy-table-bordered-all, table, thead, tbody, tr, td, th { 5 | border: 0 solid transparent !important; 6 | background-color: transparent !important; 7 | background-image: none !important; 8 | font-size: 1em !important; 9 | padding: 0 !important; 10 | white-space: normal !important; 11 | vertical-align: text-top !important; 12 | } 13 | 14 | /* This takes all borders off tables with class 'aligned-text' - at least it does for list-table, but doesn't seem to work for flat-table */ 15 | .rst-content table.docutils.aligned-text, .wy-table-bordered-all.aligned-text, .aligned-text table, thead, tbody, tr, td, th { 16 | border: 0 solid transparent !important; 17 | background-color: transparent !important; 18 | background-image: none !important; 19 | font-size: 1em !important; 20 | padding: 0 !important; 21 | white-space: normal !important; 22 | vertical-align: text-top !important; 23 | } 24 | 25 | /* This takes puts borders on tables with class 'bordered' - at least it does for list-table, but doesn't seem to work for flat-table */ 26 | .rst-content table.docutils.bordered, .wy-table-bordered-all.bordered, .bordered table, .bordered thead, .bordered tbody, .bordered tr, .bordered td, .bordered th { 27 | border-width: 1px !important; 28 | border-style: solid !important; 29 | border-color: black !important; 30 | padding: 5px !important; 31 | } 32 | 33 | .boldtext { 34 | font-weight: bold !important; 35 | } 36 | 37 | .italictext { 38 | font-style: italic !important; 39 | } 40 | 41 | .bolditalictext { 42 | font-weight: bold !important; 43 | font-style: italic !important; 44 | } 45 | 46 | .toms-nav-container .box, .toms-nav-box { 47 | background-color: #333; 48 | padding: 20px; 49 | border-radius: 10px; 50 | color: #fff; 51 | display: flex; 52 | align-items: center; 53 | justify-content: center; 54 | font-size: 23px; 55 | text-align: center; 56 | transition: 0.2s; 57 | cursor: pointer; 58 | } 59 | -------------------------------------------------------------------------------- /online-docs/_templates/breadcrumbs.html: -------------------------------------------------------------------------------- 1 | {%- extends "sphinx_rtd_theme/breadcrumbs.html" %} 2 | 3 | {% block breadcrumbs_aside %} 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /online-docs/globals.rst: -------------------------------------------------------------------------------- 1 | .. things that are needed globally ... JR 2 | 3 | 4 | .. newline - inserts '
' in the html 5 | 6 | .. |br| raw:: html 7 | 8 |
9 | 10 | 11 | .. nbsp - insertt a non-breaking space in the html 12 | 13 | .. |_| unicode:: 0xA0 14 | :trim: 15 | 16 | 17 | .. rst doesn't seem to support nesting decorations (e.g. can't do '**text**' to get 'text' in bold inside quote marks 18 | .. this implements bold text and italic text via CSS (along with the corresponding entry in the CSS file) which can then 19 | .. be wrapped in quote marks (or whatever else you want to wrap it in) e.g. some text ':boldtext:`bold_text`' 20 | .. (I wanted to just use role :bold: and :italic:, but I think at least :bold: is defined elsewhere in readthedocs... 21 | .. so I made :bolditalictext: consistent) 22 | 23 | .. role:: boldtext 24 | :class: boldtext 25 | 26 | .. role:: italictext 27 | :class: italictext 28 | 29 | 30 | .. rst doesn't support bold italics - this implements it via CSS (along with the corresponding entry in the CSS file) 31 | 32 | .. role:: bolditalictext 33 | :class: bolditalictext 34 | 35 | -------------------------------------------------------------------------------- /online-docs/index.rst: -------------------------------------------------------------------------------- 1 | .. COMPAS documentation master file, created by 2 | sphinx-quickstart on Thu Sep 2 08:36:56 2021. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 7 | 8 | 9 | 10 | COMPAS 11 | ====== 12 | 13 | **C**\ ompact **O**\ bject **M**\ ergers: **P**\ opulation **A**\ strophysics and **S**\ tatistics 14 | is a publicly available rapid stellar / binary population synthesis code designed so that evolution prescriptions and model parameters are 15 | easily adjustable. COMPAS draws properties for a binary star system from a set of initial distributions, and evolves it from 16 | zero-age main sequence to the end of its life as two compact remnants. It has been used for inference from observations of 17 | gravitational-wave mergers, Galactic neutron stars, X-ray binaries, and luminous red novae. 18 | 19 | `... by` `TeamCOMPAS `_ 20 | 21 | 22 | 23 | Contents 24 | -------- 25 | 26 | .. toctree:: 27 | :maxdepth: 4 28 | 29 | ./pages/Getting started/getting-started 30 | 31 | Code repository 32 | Request an enhancement 33 | Report a problem 34 | 35 | ./pages/references 36 | ./pages/contact-us 37 | ./pages/whats-new 38 | 39 | .. toctree:: 40 | :maxdepth: 2 41 | 42 | ./pages/quick-links 43 | 44 | .. toctree:: 45 | :maxdepth: 3 46 | 47 | ./pages/User guide/user-guide 48 | 49 | 50 | .. toctree:: 51 | :maxdepth: 3 52 | 53 | ./pages/Developer guide/developer-guide 54 | 55 | 56 | 57 | If you use COMPAS in the preparation of a publication, please :doc:`cite COMPAS <./pages/how-to-cite>`. 58 | 59 | Licence 60 | ------- 61 | 62 | COMPAS is available under the `MIT `_ licence. 63 | 64 | 65 | -------------------------------------------------------------------------------- /online-docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/BSE/BSE-evolution-model.rst: -------------------------------------------------------------------------------- 1 | BSE evolution model 2 | ------------------- 3 | 4 | The high-level binary evolution model is shown in :ref:`Figure 4 `. 5 | 6 | .. _fig-4: 7 | 8 | .. figure:: ../../../images/BSE-flow-chart-compressed.svg 9 | :width: 650px 10 | :height: 1574px 11 | :align: center 12 | :figclass: align-center 13 | :alt: BSE flow chart 14 | 15 | Figure 4 High-level BSE evolution. 16 | 17 | 18 | The binary evolution model is driven by the ``Evolve()`` function in the ``BaseBinaryStar`` class, which evolves the star through its entire 19 | lifetime by doing the following:: 20 | 21 | if touching 22 | STOP = true 23 | else 24 | calculate initial time step 25 | STOP = false 26 | 27 | DO WHILE NOT STOP AND NOT max iterations: 28 | 29 | evolve a single time step 30 | evolve each constituent star a single time step (see the :ref:`SSE evolution model`) 31 | 32 | if error OR unbound OR touching OR Massless Remnant 33 | STOP = true 34 | else 35 | evaluate the binary 36 | calculate mass transfer 37 | calculate winds mass loss 38 | 39 | if common envelope 40 | resolve common envelope 41 | else if supernova 42 | resolve supernova 43 | else 44 | resolve mass changes 45 | 46 | evaluate supernovae 47 | calculate total energy and angular momentum 48 | update magnetic field and spin: both constituent stars 49 | 50 | if unbound OR touching OR merger 51 | STOP = true 52 | else 53 | if NS+BH 54 | resolve coalescence 55 | STOP = true 56 | else 57 | if WD+WD OR max time 58 | STOP = true 59 | else 60 | if NOT max iterations 61 | calculate new time step 62 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/BSE/BSE.rst: -------------------------------------------------------------------------------- 1 | Binary star evolution 2 | ===================== 3 | 4 | The Binary Star Evolution (``BSE``) architecture implements is based on the classification of individual stars, with each stellar classification 5 | being described by a separate ``C++`` class. 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | BSE-class-hierarchy 12 | BSE-evolution-model 13 | 14 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Developer build/developer-building-compas.rst: -------------------------------------------------------------------------------- 1 | COMPAS build methods 2 | ==================== 3 | 4 | We provide two methods to build the COMPAS executable: a method to build COMPAS locally, and a method to create a ``Docker`` image. 5 | 6 | Note that each method has a separate, and different, makefile: if functionality is added, modified, or removed from either of the 7 | provided makefiles (``Makefile`` locally, ``Makefile.docker`` for the docker image), the corresponding changes should also be made 8 | to the other makefile. 9 | 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | ./COMPAS-local-build 15 | ./docker-developer 16 | 17 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Headers/constants-dot-h.rst: -------------------------------------------------------------------------------- 1 | Constant declarations (constants.h) 2 | =================================== 3 | 4 | ``constants.h`` is the COMPAS ``C++`` constants header file. 5 | 6 | ``constants.h`` is where constants used throughout the COMPAS code base are declared. The constants declared here are basic data 7 | types (such as ``double``, ``int``, ``bool``, etc.) as well as more complex data types (such as vectors, ``COMPASUnorderedMaps``, etc.). 8 | Any new constants being added to COMPAS should be added here. 9 | 10 | Refer to ``EnumHash.h`` for the definition of the type alias ``COMPASUnorderedMap``. 11 | 12 | ``constants.h`` also contains the global declaration for the global object identifier ``globalObjectId``, and a few ``typedef`` declarations 13 | (at the head of the file) that are commonly used type definitions that we make glbally available by declaring them in ``constants.h`` (which 14 | is included in all other source files). 15 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Headers/enumhash-dot-h.rst: -------------------------------------------------------------------------------- 1 | Enum hash class definition (EnumHash.h) 2 | ======================================= 3 | 4 | ``EnumHash.h`` is where the enum hash class and the type alias ``COMPASUnorderedMap`` are defined. The enum hash class allows the use 5 | of enum hashes for maps - this feature was not present in C++11 (though see the comment in ``EnumHash.h``). 6 | 7 | The hash class and type alias for ``COMPASUnorderedMap`` encapsulated in a single file so it can be included as necessary. 8 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Headers/errorcatalog-dot-h.rst: -------------------------------------------------------------------------------- 1 | Error catalog (ErrorCatalog.h) 2 | ============================== 3 | 4 | ``ErrorCatalog.h`` is the COMPAS error catalogue. The error catalogue defines symbolic names for all COMPAS errors, and 5 | corresponding error strings for those errors. 6 | 7 | To add a new error, add the symbolic name to the ``ERROR`` enum class, and the corresponding error string to the ``ERROR_CATALOG`` map. 8 | 9 | The key to the ``ERROR_CATALOG`` map is the symbolic name in the ``ERROR`` enum class. The map entry is a tuple containing the 10 | ``ERROR_SCOPE`` associated with the error (see below), and the error string. 11 | 12 | The ``ERROR_SCOPE`` enum class provides a mechanism to allow developers to specify when, if at all, a particular error/warning 13 | should be displayed by the ``SHOW_WARN*`` and ``SHOW_ERROR*`` macros (see :doc:`../../Developer guide/Services/services-error-handling`). 14 | 15 | The values for ``ERROR_SCOPE`` and their meanings are: 16 | 17 | :: 18 | 19 | NEVER : the error/warning should never be displayed 20 | ALWAYS : the error/warning should always be displayed 21 | FIRST : the error/warning should only be displayed the first time it is encountered 22 | FIRST_IN_FUNCTION : the error/warning should only be displayed the first time it is encountered for a function 23 | FIRST_IN_STELLAR_TYPE: the error/warning should only be displayed the first time it is encountered for a stellar type (see enum class STELLAR_TYPE in typedefs.h) 24 | FIRST_IN_OBJECT_TYPE : the error/warning should only be displayed the first time it is encountered for an object type (see enum class OBJECT_TYPE in typedefs.h) 25 | FIRST_IN_OBJECT_ID : the error/warning should only be displayed the first time it is encountered for an object id (each object is assigned a unique object id - e.g. a star or binary, each constituent star of a binary) 26 | 27 | The ``THROW_ERROR*`` macros (see :doc:`../../Developer guide/Services/services-error-handling`) are not affected by ``ERROR_SCOPE``. 28 | 29 | A convenience function for retrieving the error text is #defined here: 30 | 31 | #define ERR_MSG(x) std::get<1>(ERROR_CATALOG.at(x)) 32 | 33 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Headers/headers.rst: -------------------------------------------------------------------------------- 1 | Useful headers 2 | ============== 3 | 4 | A number of header files in the code base contain declarations and definitions that are used across the entire code base. 5 | 6 | The contents and use of these headers files are described here: 7 | 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | ./constants-dot-h 13 | ./typedefs-dot-h 14 | ./logtypedefs-dot-h 15 | ./enumhash-dot-h 16 | ./errorcatalog-dot-h 17 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Headers/logtypedefs-dot-h.rst: -------------------------------------------------------------------------------- 1 | Logging type definitions (LogTypedefs.h) 2 | ======================================== 3 | 4 | ``LogTypedefs.h`` is the COMPAS ``C++`` logging type definitions header file. 5 | 6 | ``LogTypedefs.h`` is where developer-defined types that pertain directly to the COMPAS logging functionality (including the 7 | definitions of the default record composition for the various log files) are defined. Non-logging tyedefs are listed in 8 | ``typedefs.h``. 9 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-oo-abstraction.rst: -------------------------------------------------------------------------------- 1 | Abstraction 2 | =========== 3 | 4 | For any entity, product, or service, the goal of abstraction is to handle the complexity of the implementation by hiding details that 5 | don’t need to be known in order to use, or consume, the entity, product, or service. In the OOP paradigm, hiding details in this way 6 | enables the consumer to implement more complex logic on top of the provided abstraction without needing to understand the hidden 7 | implementation details and complexity. (There is no suggestion that consumers shouldn’t understand the implementation details, but they 8 | shouldn’t need to in order to consume the entity, product, or service). 9 | 10 | Abstraction in ``C++`` is achieved via the use of objects – an object is an instance of a class, and typically corresponds to a 11 | real-world object or entity (in COMPAS, usually a star or binary star). An object maintains the state of an object (via class member 12 | variables), and provides all necessary means of changing the state of the object (by exposing public class member functions (methods)). 13 | A class may expose public functions to allow consumers to determine the value of class member variables (“getters”), and to set the value 14 | of class member variables (“setters”). 15 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-oo-encapsulation.rst: -------------------------------------------------------------------------------- 1 | Encapsulation 2 | ============= 3 | 4 | Encapsulation binds together the data and functions that manipulate the data in an attempt to keep both safe from outside interference and 5 | accidental misuse. An encapsulation paradigm that does not allow calling code to access internal object data and permits access through 6 | functions only is a strong form of abstraction. ``C++`` allows developers to enforce access restrictions explicitly by defining class member 7 | variables and functions as private, protected, or public. These keywords are used throughout COMPAS to enforce encapsulation. 8 | 9 | There are very few circumstances in which a consumer should change the value of a class member variable directly (via the use of a setter 10 | function) – almost always consumers should present new situational information to an object (via a public member function), and allow the 11 | object to respond to the new information. For example, in COMPAS, there should be almost no reason for a consumer of a star object to 12 | directly change (say) the radius of the star – the consumer should inform the star object of new circumstances or events, and allow the star 13 | object to respond to those events (perhaps changing the value of the radius of the star). Changing a single class member variable directly 14 | introduces the possibility that related class member variables (e.g. other attributes of stars) will not be changed accordingly. Moreover, 15 | developers changing the code in the future should, in almost all cases, expect that the state of an object is maintained consistently by the 16 | object, and that there should be no unexpected side-effects caused by calling non class-member functions. 17 | 18 | In short, changing the state of an object outside the object is potentially unsafe and should be avoided where possible. 19 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-oo-inheritance.rst: -------------------------------------------------------------------------------- 1 | Inheritance 2 | =========== 3 | 4 | Inheritance allows classes to be arranged in a hierarchy that represents is-a-type-of relationships. All nonprivate class member variables and 5 | functions of the parent (base) class are available to the child (derived) class (and, therefore, child classes of the child class). This allows 6 | easy re-use of the same procedures and data definitions, in addition to describing real-world relationships in an intuitive way. ``C++`` allows 7 | multiple inheritance – a class may inherit from multiple parent classes. 8 | 9 | Derived classes can define additional class member variables (using the private, protected, and public access restrictions), which will be 10 | available to any descendent classes (subject to inheritance rules), but will only be available to ancestor classes via the normal access methods 11 | (getters and setters). 12 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-oo-polymorphism.rst: -------------------------------------------------------------------------------- 1 | Polymorphism 2 | ============ 3 | 4 | Polymorphism means having many forms. In OOP, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance. 5 | 6 | Following the discussion earlier regarding inheritance, in the OOP paradigm, and ``C++`` specifically, derived classes can override methods 7 | defined by ancestor classes, allowing a derived class to implement functions specific to its circumstances. This means that a call to a class 8 | member function will cause a different function to be executed depending on the type of object that invokes the function. Descendent classes 9 | of a class that has overridden a base class member function inherit the overridden function (but can override it themselves). 10 | 11 | COMPAS makes heavy use of inheritance and polymorphism, especially for the implementation of the different stellar types. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-oo.rst: -------------------------------------------------------------------------------- 1 | Object-oriented programming 2 | =========================== 3 | 4 | COMPAS is written in ``C++``, an object-oriented programming (OOP) language, and OOP concepts and conventions should apply throughout 5 | the code. There are many texts and web pages devoted to understanding ``C++`` and OOP – following is a brief description of the key OOP 6 | concepts: 7 | 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | programming-style-oo-abstraction 13 | programming-style-oo-encapsulation 14 | programming-style-oo-inheritance 15 | programming-style-oo-polymorphism 16 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-braces.rst: -------------------------------------------------------------------------------- 1 | Braces 2 | ====== 3 | 4 | The placement of braces in ``C++`` code (actually, any code that uses braces to enclose scope) is a contentious issue, with many developers having 5 | long-held, often dogmatic preferences. COMPAS (so far) uses the K&R style (”the one true brace style”) - the style used in the original Unix kernel 6 | and Kernighan and Ritchie’s book :doc:`The C Programming Language <../../references>`. 7 | 8 | The K&R style puts the opening brace on the same line as the control statement: 9 | 10 | :: 11 | 12 | while (x == y) { 13 | call_something(); 14 | var1 = var2 15 | call_somethingelse(); 16 | } 17 | 18 | Note also the space between the keyword while and the opening parenthesis, surrounding the ``==`` operator, and between the closing parenthesis 19 | and the opening brace. Spaces in those places help with code readability. Surrounding all arithmetic operators with spaces is preferred. 20 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-comments.rst: -------------------------------------------------------------------------------- 1 | Comments 2 | ======== 3 | 4 | An old, but good, rule-of-thumb is that any file that contains computer code should be about one-third code, one-third comments, and one-third 5 | white space. Adhering to this rule-of-thumb just makes the code a bit easier on the eye, and provides some description (at least of the intention) 6 | of the implementation. 7 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-func-parms.rst: -------------------------------------------------------------------------------- 1 | Function parameters 2 | =================== 3 | 4 | In most cases, function parameters should be input only – meaning that the values of function parameters should not be changed by the function. 5 | Anything that needs to be changed and returned to the caller should be returned as a functional return. There are a few exceptions to this in COMPAS – 6 | all were done for performance reasons, and are documented in the code. 7 | 8 | To avoid unexpected side-effects, developers should expect (in most cases) that any variables they pass to a function will remain unchanged – all 9 | changes should be returned as a functional return. 10 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-indentation.rst: -------------------------------------------------------------------------------- 1 | Indentation 2 | =========== 3 | 4 | There is ongoing debate in the programming community as to whether indentation should be achieved using spaces or tabs (strange, but true...). 5 | The use of spaces is more common. Unfortunately a mix of spaces and tabs doesn’t work well with some editors - we should settle on one method and 6 | try to stick to it. COMPAS (so far) has a mix of both – no matter which convention we choose, once there are instances of both in the code it's 7 | hard to recover. So while using tabs is probably preferred, use whatever is convenient (pragmatism is your friend...). 8 | 9 | COMPAS (mostly) uses an indentation size of 4 spaces - again we should settle on a size and stick to it. 10 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-naming.rst: -------------------------------------------------------------------------------- 1 | Naming conventions 2 | ------------------ 3 | 4 | COMPAS (so far) uses the following naming conventions: 5 | 6 | - All variable names should be in camelCase – don’t use underscore to separate words. 7 | - Function names should be in camelCase, beginning with an uppercase letter. Function names should be descriptive. 8 | - Class member variable names are prefixed with 'm\_', and the character immediately following the prefix should be uppercase (in most cases – sometimes, for well-known names or words that are always written in lowercase, lowercase might be used). 9 | - Local variable names are just camelCase, beginning with a lowercase letter (again, with the caveat that sometimes, for well-known names or words that are always written in uppercase, uppercase might be used). 10 | - Function parameter names are prefixed with 'p\_', and the character immediately following the prefix should be uppercase (again, with the caveat that sometimes, for well-known names or words that are always written in lowercase, lowercase might be used). 11 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style-performance.rst: -------------------------------------------------------------------------------- 1 | Performance & optimisation 2 | ========================== 3 | 4 | In general, COMPAS developers should code for performance – within reason. Bear in mind that many functions will be called many, many thousands of 5 | times (in some cases, millions) in one execution of the program. 6 | 7 | - Avoid calculating values inside loops that could be calculated once outside the loop. 8 | - Try to use constants where possible. 9 | - Use multiplication in preference to functions such as pow() and sqrt() (note that pow() is very expensive computationally; sqrt() is expensive, but much less expensive than pow()). 10 | - Don’t optimise to the point that readability and maintainability is compromised. Bear in mind that most compilers are good at optimising, and are very forgiving of less-than-optimally-written code (though they are not miracle workers...). 11 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style-style.rst: -------------------------------------------------------------------------------- 1 | Programming style & conventions 2 | =============================== 3 | 4 | The goal of coding to a suggested style is readability and maintainability – if many developers implement code in COMPAS with their own coding 5 | style, readability and maintainability will be more difficult than if a consistent style is used throughout the code. Strict adherence isn’t 6 | really necessary, but it will make it easier on all COMPAS developers if the coding style is consistent throughout. 7 | 8 | Some elements of programming style: 9 | 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | programming-style-style-comments 15 | programming-style-style-braces 16 | programming-style-style-indentation 17 | programming-style-style-func-parms 18 | programming-style-style-performance 19 | programming-style-style-naming 20 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Programming style/programming-style.rst: -------------------------------------------------------------------------------- 1 | Programming style 2 | ================= 3 | 4 | Everyone has their own preferences and style, and the nature of a project such as COMPAS will reflect that. However, there is a need 5 | to suggest some guidelines for programming style, naming conventions etc. Following is a description of some of the elements of 6 | programming style and naming conventions used to develop COMPAS v2. These may evolve over time. 7 | 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | programming-style-oo 13 | programming-style-style 14 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/SSE/SSE.rst: -------------------------------------------------------------------------------- 1 | Single star evolution 2 | ===================== 3 | 4 | The Single Star Evolution (``SSE``) architecture is based on the classification of individual stars, with each stellar classification 5 | being described by a separate ``C++`` class. 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | SSE-class-hierarchy 12 | SSE-evolution-model 13 | 14 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-close.rst: -------------------------------------------------------------------------------- 1 | Log::Close(p_LogfileId) 2 | ======================= 3 | 4 | :: 5 | 6 | BOOL Log::Close( 7 | INT p_LogfileId // the identifier of the log file to be closed (as returned by Log::Open()). 8 | ) 9 | 10 | Closes the log file specified by the ``p_LogfileId`` parameter. If the log file specified by the logFileId parameter is open, it is flushed 11 | to disk and closed. 12 | 13 | Returns a boolean indicating whether the file was closed successfully. 14 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-debug.rst: -------------------------------------------------------------------------------- 1 | Log::Debug(...) 2 | =============== 3 | 4 | :: 5 | 6 | BOOL Log::Debug( 7 | STRING p_DbgClass, // the log class of the record to be written. An empty string (””) satisfies 8 | // all checks against enabled classes. 9 | INT p_DbgLevel, // the log level of the record to be written. A value of 0 satisfies all 10 | // checks against enabled levels. 11 | STRING p_DbgStr // the string to be written to stdout (and optionally to file). 12 | ) 13 | 14 | Writes ``p_DbgStr`` to stdout and, if logging is active and so configured (via program option ``--debug-to-file``), writes ``p_DbgStr`` 15 | to the debug log file. 16 | 17 | Returns a boolean indicating whether the record was written successfully. If an error occurred writing to the debug log file, 18 | the log file will be disabled. 19 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-debugWait.rst: -------------------------------------------------------------------------------- 1 | Log::DebugWait(...) 2 | =================== 3 | 4 | :: 5 | 6 | BOOL Log::DebugWait( 7 | STRING p_DbgClass, // the log class of the record to be written. An empty string (””) satisfies 8 | // all checks against enabled classes. 9 | INT p_DbgLevel, // the log level of the record to be written. A value of 0 satisfies all 10 | // checks against enabled levels. 11 | STRING p_DbgStr // the string to be written to stdout (and optionally to file). 12 | ) 13 | 14 | Writes ``p_DbgStr`` to stdout and, if logging is active and so configured (via program option ``--debug-to-file``), writes ``p_DbgStr`` 15 | to the debug log file, then waits for user input. 16 | 17 | Returns a boolean indicating whether the record was written successfully. If an error occurred writing to the debug log file, 18 | the log file will be disabled. 19 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-enabled.rst: -------------------------------------------------------------------------------- 1 | Log::Enabled() 2 | ============== 3 | 4 | :: 5 | 6 | BOOL Log::Enabled() 7 | 8 | Returns a boolean indicating whether the Log service is enabled – TRUE indicates the Log service is enabled and available; 9 | FALSE indicates the Log service is not enabled and so not available. 10 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-error.rst: -------------------------------------------------------------------------------- 1 | Log::Error(p_ErrStr) 2 | ==================== 3 | 4 | :: 5 | 6 | BOOL Log::Error( 7 | STRING p_ErrStr // the string to be written to stdout (and optionally to file). 8 | ) 9 | 10 | Writes ``p_ErrStr`` to stdout and, if logging is active and so configured (via program option ``--errors-to-file``), writes ``p_ErrStr`` 11 | to the error log file. 12 | 13 | Returns a boolean indicating whether the record was written successfully. If an error occurred writing to the error log file, 14 | the log file will be disabled. 15 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-put.rst: -------------------------------------------------------------------------------- 1 | Log::Put(...) 2 | ============= 3 | 4 | :: 5 | 6 | BOOL Log::Put( 7 | INT p_LogfileId, // the identifier of the log file to be written. 8 | STRING p_LogClass, // the log class of the record to be written. An empty string (””) satisfies 9 | // all checks against enabled classes. 10 | INT p_LogLevel, // the log level of the record to be written. A value of 0 satisfies all 11 | // checks against enabled levels. 12 | STRING p_LogStr // the string to be written to the log file. 13 | ) 14 | 15 | Writes a minimally formatted record to the specified log file. If the Log service is enabled, the specified log file is active, and the log 16 | record ``class`` and ``level`` passed are enabled, the string is written to the file. See :doc:`./services-base-level-logging` for details 17 | regarding log record ``class`` and ``level``. 18 | 19 | If labels are enabled for the log file, a label will be prepended to the record. The label text will be the ``p_LogClass`` parameter. 20 | 21 | If timestamps are enabled for the log file, a formatted timestamp is prepended to the record. The timestamp format is **yyyymmdd hh:mm:ss**. 22 | 23 | Returns a boolean indicating whether the record was written successfully. If an error occurred the log file will be disabled. 24 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-say.rst: -------------------------------------------------------------------------------- 1 | Log::Say(...) 2 | ============= 3 | 4 | :: 5 | 6 | VOID Log::Say( 7 | STRING p_SayClass, // the log class of the record to be written. An empty string (””) satisfies 8 | // all checks against enabled classes. 9 | INT p_SayLevel, // the log level of the record to be written. A value of 0 satisfies all 10 | // checks against enabled levels. 11 | STRING p_SayStr // the string to be written to stdout. 12 | ) 13 | 14 | Writes ``p_SayStr`` to stdout. 15 | 16 | This function does not return a value. 17 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-squawk.rst: -------------------------------------------------------------------------------- 1 | Log::Squawk(p_SquawkStr) 2 | ======================== 3 | 4 | :: 5 | 6 | VOID Log::Squawk( 7 | STRING p_SquawkStr // the string to be written to stderr. 8 | ) 9 | 10 | Writes ``p_SquawkStr`` to stderr. 11 | 12 | This function does not return a value. 13 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-stop.rst: -------------------------------------------------------------------------------- 1 | Log::Stop(p_ObjectStats) 2 | ======================== 3 | 4 | :: 5 | 6 | VOID Log::Stop( 7 | TUPLE p_ObjectStats // number of stars or binaries requested, count created. 8 | ) 9 | 10 | Stops the logging and debugging service. All open log files are flushed to disk and closed (including any Standard Log Files 11 | open - see description of Standard Log Files in :doc:`../services-extended-logging`. The ``Run_Details`` file is populated and closed. 12 | 13 | This function does not return a value. 14 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Base-level logging/services-base-level-logging-func-write.rst: -------------------------------------------------------------------------------- 1 | Log::Write(...) 2 | =============== 3 | 4 | :: 5 | 6 | BOOL Log::Write( 7 | INT p_LogfileId, // the identifier of the log file to be written. 8 | STRING p_LogClass, // the log class of the record to be written. An empty string (””) satisfies 9 | // all checks against enabled classes. 10 | INT p_LogLevel, // the log level of the record to be written. A value of 0 satisfies all 11 | // checks against enabled levels. 12 | STRING p_LogStr // the string to be written to the log file. 13 | ) 14 | 15 | Writes an unformatted record to the specified log file. If the Log service is enabled, the specified log file is active, and the log 16 | record ``class`` and ``level`` passed are enabled, the string is written to the file. See :doc:`./services-base-level-logging` for details 17 | regarding log record ``class`` and ``level``. 18 | 19 | Returns a boolean indicating whether the record was written successfully. If an error occurred the log file will be disabled. 20 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Logging macros/services-logging-debugging-macros-log.rst: -------------------------------------------------------------------------------- 1 | LOG() macro 2 | =========== 3 | 4 | :: 5 | 6 | LOG(id, ...) 7 | 8 | Writes a log record to the log file specified by ``id``. Usage:: 9 | 10 | LOG(id, string) // writes 'string' to the log file 11 | 12 | LOG(id, level, string) // writes 'string' to the log file if 'level' <= 'p_LogLevel' in 13 | // Log::Start() 14 | 15 | LOG(id, class, level, string) // writes 'string to the log file if 'class' is in 'p_LogClasses' in 16 | // Log::Start(), and 'level' <= 'p_LogLevel' in Log::Start() 17 | 18 | Default class is ””; default level is 0. 19 | 20 | Examples:: 21 | 22 | LOG(SSEfileId, ”This is a log record”); 23 | LOG(OutputFile2Id, ”The value of x is ” << x << ” km”); 24 | LOG(MyLogfileId, 2, ”Log string”); 25 | LOG(SSEfileId, ”CHeB”, 4, ”This is a CHeB only log record”); -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Logging macros/services-logging-debugging-macros-log_id.rst: -------------------------------------------------------------------------------- 1 | LOG_ID() macro 2 | ============== 3 | 4 | :: 5 | 6 | LOG_ID(id, ...) 7 | 8 | Writes a log record prepended with calling function name to the log file specified by ``id``. Usage:: 9 | 10 | LOG_ID(id) // writes the name of calling function to the log file 11 | 12 | LOG_ID(id, string) // writes 'string' prepended with name of calling function to the 13 | // log file 14 | 15 | LOG_ID(id, level, string) // writes 'string' prepended with name of calling function to the 16 | // log file if 'level' <= 'p_LogLevel' in Log::Start() 17 | 18 | LOG_ID(id, class, level, string) // writes 'string' prepended with name of calling function to the 19 | // log file if 'class' is in 'p_LogClasses' in Log::Start(), and 20 | // 'level' <= 'p_LogLevel' in Log::Start(). 21 | 22 | Default class is ””; default level is 0. 23 | 24 | Examples:: 25 | 26 | LOG_ID(Outf1Id); 27 | LOG_ID(Outf2Id, ”This is a log record”); 28 | LOG_ID(MyLogfileId, ”The value of x is ” << x << ” km”); 29 | LOG_ID(OutputFile2Id, 2, ”Log string”); 30 | LOG_ID(CHeBfileId, ”CHeB”, 4, ”This is a CHeB only log record”); 31 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Logging macros/services-logging-debugging-macros-log_id_if.rst: -------------------------------------------------------------------------------- 1 | LOG_ID_IF() macro 2 | ================= 3 | 4 | :: 5 | 6 | LOG_ID_IF(id, cond, ...) 7 | 8 | Writes a log record prepended with calling function name to the log file specified by ``id`` if the condition given by ``cond`` 9 | is met. 10 | 11 | Usage: see :doc:`LOG_ID() ` and :doc:`LOG_IF() `. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Logging macros/services-logging-debugging-macros-log_if.rst: -------------------------------------------------------------------------------- 1 | LOG_IF() macro 2 | ============== 3 | 4 | :: 5 | 6 | LOG_IF(id, cond, ...) 7 | 8 | Writes a log record to the log file specified by ``id`` if the condition given by ``cond`` is met. Usage:: 9 | 10 | LOG_IF(id, cond, string) // writes 'string' to the log file if 'cond' is TRUE. 11 | 12 | LOG_IF(id, cond, level, string) // writes 'string' to the log file if 'cond' is TRUE and 13 | // 'level' <= 'p_LogLevel' in Log::Start(). 14 | 15 | LOG_IF(id, cond, class, level, string) // writes 'string' to the log file if 'cond' is TRUE, 16 | // 'class' is in 'p_LogClasses' in Log::Start(), and 17 | // 'level' <= 'p_LogLevel' in Log::Start(). 18 | 19 | Default class is ””; default level is 0. 20 | 21 | Examples:: 22 | 23 | LOG_IF(MyLogfileId, a > 1.0, ”This is a log record”); 24 | LOG_IF(SSEfileId, (b == c && a > x), ”The value of x is ” << x << ” km”); 25 | LOG_IF(CHeBfileId, flag, 2, ”Log string”); 26 | LOG_IF(SSEfileId, (x >= y), ”CHeB”, 4, ”This is a CHeB only log record”); 27 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/Logging macros/services-logging-debugging-macros-logging.rst: -------------------------------------------------------------------------------- 1 | Logging macros 2 | ============== 3 | 4 | The logging macros provided by the :doc:`logging service <../services-logging-debugging>` are: 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | ./services-logging-debugging-macros-log 11 | ./services-logging-debugging-macros-log_id 12 | ./services-logging-debugging-macros-log_if 13 | ./services-logging-debugging-macros-log_id_if 14 | 15 | |br| 16 | The logging macros described above are also provided in a verbose variant. The verbose macros function the same way as their non-verbose 17 | counterparts, with the added functionality that the log records written to the log file will also be written to stdout. The verbose 18 | logging macros are:: 19 | 20 | LOGV(id, ...) 21 | LOGV_ID(id, ...) 22 | LOGV_IF(id, cond, ...) 23 | LOGV_ID_IF(id, cond, ...) 24 | 25 | 26 | |br| 27 | A further four macros are provided that allow writing directly to stdout rather than a log file. These are:: 28 | 29 | SAY( ...) 30 | SAY_ID( ...) 31 | SAY_IF(cond, ...) 32 | SAY_ID IF(cond, ...) 33 | 34 | The ``SAY`` macros function the same way as their ``LOG`` counterparts, but write directly to stdout instead of a log file. The ``SAY`` 35 | macros honour the logging classes and level. 36 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Logging and debugging/services-logging-debugging.rst: -------------------------------------------------------------------------------- 1 | Logging & debugging service 2 | =========================== 3 | 4 | A logging and debugging service is provided encapsulated in a singleton object (an instantiation of the ``Log`` class). 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | ./Base-level logging/services-base-level-logging 11 | ./services-extended-logging 12 | ./Logging macros/services-logging-debugging-macros-logging 13 | ./services-logging-debugging-macros-debugging 14 | 15 | 16 | :bolditalictext:`Historical note:` 17 | 18 | The logging functionality was first implemented when the Single Star Evolution code was refactored, and the base-level of logging 19 | was sufficient for the needs of the ``SSE`` code. Refactoring the Binary Star Evolution code highlighted the need for expanded logging 20 | functionality. To provide for the logging needs of the ``BSE`` code, new functionality was added almost as a wrapper around the original, 21 | base-level logging functionality. Some of the original base-level logging functionality has almost been rendered redundant by the new 22 | functionality implemented for ``BSE`` code, but it remains (almost) in its entirety because it may still be useful in some circumstances. 23 | 24 | When the base-level logging functionality was created, debugging functionality was also provided, as well as a set of macros to make 25 | debugging and the issuing of warning messages easier. A set of logging macros was also provided to make logging easier. The debug 26 | macros are still useful, and their use is encouraged (rather than inserting print statements using ``std::cout`` or ``std::cerr``). 27 | 28 | When the ``BSE`` code was refactored, some rudimentary error handling functionality was also provided in the form of the 29 | :doc:`Errors service <../services-error-handling>` an attempt at making error handling easier. Some of the functionality provided by the 30 | :doc:`Errors service <../services-error-handling>` supersedes the ``DBG_WARN*`` macros provided as part of the Log class, but the ``DBG_WARN*`` 31 | macros are still useful in some circumstances (and in fact are still used in various places in the code). The ``LOG*`` macros are somewhat less 32 | useful, but remain in case the original base-level logging functionality (that which underlies the expanded logging functionality) is used in 33 | the future (as mentioned above, it could still be useful in some circumstances). 34 | 35 | The expanded logging functionality introduces Standard Log Files - described in :doc:`services-extended-logging`. 36 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-defaultSeed.rst: -------------------------------------------------------------------------------- 1 | Rand::DefaultSeed() 2 | =================== 3 | 4 | :: 5 | 6 | UNSIGNED LONG INT Rand::DefaultSeed() 7 | 8 | Returns the ``gsl`` default seed ``gsl_rng_default_seed``. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-free.rst: -------------------------------------------------------------------------------- 1 | Rand::Free() 2 | ============ 3 | 4 | :: 5 | 6 | VOID Rand::Free() 7 | 8 | Frees any dynamically allocated memory. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-initialise.rst: -------------------------------------------------------------------------------- 1 | Rand::Initialise() 2 | ================== 3 | 4 | :: 5 | 6 | VOID Rand::Initialise() 7 | 8 | Initialises the ``gsl`` random number generator. If the environment variable ``GSL_RNG_SEED`` exists, the ``gsl`` random number generator 9 | is seeded with the value of the environment variable, otherwise it is seeded with the current time. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-random1.rst: -------------------------------------------------------------------------------- 1 | Rand:Random() 2 | ============= 3 | 4 | :: 5 | 6 | DOUBLE Rand::Random() 7 | 8 | Returns a random floating point number uniformly distributed in the range [0.0, 1.0). -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-random2.rst: -------------------------------------------------------------------------------- 1 | Rand::Random(p_Lower, p_Upper) 2 | ============================== 3 | 4 | :: 5 | 6 | DOUBLE Rand::Random(const DOUBLE p_Lower, const DOUBLE p_Upper) 7 | 8 | Returns a random floating point number uniformly distributed in the range [``p_Lower``, ``p_Upper``), where ``p_Lower`` 9 | :math:`\small \leq` ``p_Upper``. 10 | 11 | (``p_Lower`` and ``p_Upper`` will be swapped if ``p_Lower`` :math:`\small \gt` ``p_Upper`` as passed) -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-randomGaussian.rst: -------------------------------------------------------------------------------- 1 | Rand::RandomGaussian(p_Sigma) 2 | ============================= 3 | 4 | :: 5 | 6 | DOUBLE Rand::RandomGaussian(const DOUBLE p_Sigma) 7 | 8 | Returns a Gaussian random variate, with mean 0.0 and standard deviation ``p_Sigma``. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-randomInt1.rst: -------------------------------------------------------------------------------- 1 | Rand::RandomInt(p_Lower, p_Upper) 2 | ================================= 3 | 4 | :: 5 | 6 | INT Rand::RandomInt(const INT p_Lower, const INT p_Upper) 7 | 8 | Returns a random integer number uniformly distributed in the range [``p_Lower``, ``p_Upper``), where ``p_Lower`` 9 | :math:`\small \leq` ``p_Upper``. 10 | 11 | (``p_Lower`` and ``p_Upper`` will be swapped if ``p_Lower`` :math:`\small \gt` ``p_Upper`` as passed) -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-randomInt2.rst: -------------------------------------------------------------------------------- 1 | Rand::RandomInt(p_Upper) 2 | ======================== 3 | 4 | :: 5 | 6 | INT Rand::RandomInt(const INT p_Upper) 7 | 8 | Returns a random integer number uniformly distributed in the range [0, ``p_Upper``), where 0 :math:`\small \leq` ``p_Upper``. 9 | 10 | Returns 0 if ``p_Upper`` :math:`\small \lt` 0. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers-seed.rst: -------------------------------------------------------------------------------- 1 | Rand::Seed(p_Seed) 2 | ================== 3 | 4 | :: 5 | 6 | UNSIGNED LONG INT Rand::Seed(const UNSIGNED LONG p_Seed) 7 | 8 | Sets the seed for the ``gsl`` random number generator to ``p_Seed``. The return value is the seed. -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/Random numbers/services-random-numbers.rst: -------------------------------------------------------------------------------- 1 | Random numbers service 2 | ====================== 3 | 4 | A Random Number service is provided, with the ``gsl`` Random Number Generator encapsulated in a singleton object (an instantiation of 5 | the ``Rand`` class). 6 | 7 | The ``Rand`` class member variables are private, and public functions have been created for random number functionality required by 8 | the code. 9 | 10 | The Rand service can be accessed by referring to the ``Rand::Instance()`` object. For example, to generate a uniform random floating 11 | point number in the range [0, 1), call the ``Rand::Random()`` function:: 12 | 13 | double u = Rand::Instance()→Random(); 14 | 15 | Since that could become unwieldy, there is a convenience macro to access the Rand service. The macro just defines "RAND" as 16 | "Rand::Instance()", so calling the ``Rand::Random()`` function can be written as:: 17 | 18 | double u = RAND→Random(); 19 | 20 | The Rand service must be initialised before use. Initialise the Rand service by calling the ``Rand::Initialise()`` function:: 21 | 22 | RAND→Initialise(); 23 | 24 | Dynamically allocated memory associated with the ``gsl`` random number generator should be returned to the system by calling the 25 | ``Rand::Free()`` function:: 26 | 27 | RAND→Free(); 28 | 29 | before exiting the program. 30 | 31 | The Rand service provides the following public member functions: 32 | 33 | 34 | .. toctree:: 35 | :maxdepth: 1 36 | 37 | ./services-random-numbers-initialise 38 | ./services-random-numbers-free 39 | ./services-random-numbers-seed 40 | ./services-random-numbers-defaultSeed 41 | ./services-random-numbers-random1 42 | ./services-random-numbers-random2 43 | ./services-random-numbers-randomGaussian 44 | ./services-random-numbers-randomInt1 45 | ./services-random-numbers-randomInt2 46 | 47 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/Services/services.rst: -------------------------------------------------------------------------------- 1 | Services 2 | ======== 3 | 4 | A number of services have been provided to help simplify the code. The code for each service is encapsulated in a singleton object 5 | (an instantiation of the relevant class). The singleton design pattern allows the definition of a class that can only be instantiated 6 | once, and that instance effectively exists as a global object available to all the code without having to be passed around as a 7 | parameter. Singletons are a little anti-OO, but provided they are used judiciously are not necessarily a bad thing, and can be very 8 | useful in certain circumstances. 9 | 10 | Services provided are: 11 | 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | 16 | ./Program options/services-program-options 17 | ./Random numbers/services-random-numbers 18 | ./Logging and debugging/services-logging-debugging 19 | ./services-error-handling 20 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/developer-guide.rst: -------------------------------------------------------------------------------- 1 | Developer guide 2 | =============== 3 | 4 | TeamCOMPAS welcomes the active involvement of colleagues and others interested in the ongoing development and improvement of 5 | the COMPAS software. We hope this Developer Guide helps anyone interested in contributing to the COMPAS software. We expect 6 | this guide to be a living document and improve along with the improvements made to the software. 7 | 8 | This guide covers the C++ COMPAS population synthesis code. 9 | 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | ./SSE/SSE 15 | ./BSE/BSE 16 | ./object-ids 17 | ./Services/services 18 | ./floating-point-comparisons 19 | ./Headers/headers 20 | ./changelog 21 | ./Programming style/programming-style 22 | ./Developer build/developer-building-compas 23 | ./git-workflow.rst 24 | -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/git-workflow.rst: -------------------------------------------------------------------------------- 1 | Git Workflow 2 | ============ 3 | 4 | If you are not familiar with ``git``, please refer to a tutorial such as `this one `_. 5 | 6 | In ``COMPAS`` we work in the ``dev`` branch, and use the ``master`` branch for the major version changes. The main workflow is as follows: 7 | 8 | 1. Create a git-issue describing the tasks you want to work on (this is optional, but recommended). 9 | 2. Create a new branch from ``dev`` with a descriptive name (e.g. ``feature/issue-123``), and make a draft pull request to ``dev``. This will allow you to work on the code collaboratively and get feedback from the team. 10 | 3. Make your changes, commit them, and push them to the remote repository. Every commit will trigger the continuous integration (CI) tests. 11 | 4. Once you are happy with your changes, check that CI tests are passing, and switch the PR to ``ready for review``. This will make it clear to the team that your changes are ready for review. 12 | 13 | The team will review your changes, and may ask you to make some modifications. You can make these changes in the same branch, and push them to the remote repository. Once the changes are approved, the PR will be merged into ``dev``. 14 | 15 | CI Tests 16 | -------- 17 | 18 | There are a few tests that are run automatically when you push your changes to the remote repository. These tests are: 19 | 20 | 1. `spell-checking `_ 21 | This ensures that docstrings and comments are correctly spelled. 22 | 2. `COMPAS compile test `_ 23 | This ensures that COMPAS C++ and python utilities can be correctly compiled (and COMPAS can run on a fiducial binary system). 24 | 3. `COMPAS py-utils unit tests `_ 25 | This ensures that some of the python utilities are working as expected. 26 | 27 | 28 | The tests will fail if the fiducial binary system does not lead to a binary black hole merger. 29 | 30 | .. literalinclude:: ../../../py_tests/test_data/run.sh 31 | :linenos: 32 | :language: bash -------------------------------------------------------------------------------- /online-docs/pages/Developer guide/object-ids.rst: -------------------------------------------------------------------------------- 1 | Object identifiers 2 | ================== 3 | 4 | All objects (instantiations of a class) are assigned unique object identifiers of type ``OBJECT_ID`` (unsigned long int - see 5 | ``constants.h`` for the typedef). The purpose of the unique object id is to aid in object tracking and debugging. 6 | 7 | **Note that the object id is not the same as, nor it superseded by, the RANDOM_SEED value assigned to each single or binary star**. 8 | 9 | The RANDOM_SEED is used to seed the random number generator, and can be used to uniquely identify a single or binary star. The object 10 | id is more granular the the RANDOM_SEED. For example, each binary star is comprised of multiple objects: the ``BinaryStar`` object, 11 | which contains two ``BaseBinaryStar`` objects (the object undergoing evolution, and a saved copy); each ``BaseBinaryStar`` object 12 | contains two ``BinaryConstituentStar`` objects (one for each of the constituent stars), and each ``BinaryConstituentStar`` object 13 | inherits from the ``Star`` class, which contains two ``BaseStar`` objects (the underlying star and a saved copy). Whereas the RANDOM_SEED 14 | uniquely identifies (for example) a binary star, and so identifies the collection of objects that comprise the binary star, the object ids 15 | uniquely identify the constituent objects of the binary star. Object tracking at this lower level cannot be achieved using the RANDOM_SEED, 16 | hence the need for object ids when debugging. 17 | 18 | As well as unique object ids, all objects are assigned an object type (of type ``OBJECT_TYPE`` – see ``constants.h`` for the enum class 19 | declaring ``OBJECT_TYPE``), and a stellar type where applicable (of type ``STELLAR_TYPE`` – see ``constants.h`` for the enum class declaring 20 | ``STELLAR_TYPE``). 21 | 22 | Objects should expose the following functions:: 23 | 24 | OBJECT_ID ObjectId() const { return m ObjectId; } 25 | OBJECT_TYPE ObjectType() const { return m ObjectType; } 26 | STELLAR_TYPE StellarType() const { return m StellarType; } 27 | 28 | If any of the functions are not applicable to the object, then they must return "\*::NONE" (all objects should implement ``ObjectId()`` 29 | correctly). 30 | 31 | Any object that uses the Errors service (i.e. the ``ERRORS`` and ``WARNINGS`` macros) must expose these functions: the functions are 32 | called by the ``ERRORS`` and ``WARNINGS`` macros (:doc:`./Services/services-error-handling`). -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/output.rst: -------------------------------------------------------------------------------- 1 | COMPAS output 2 | ============= 3 | 4 | Summary and status information during the evolution of stars is written to stdout; how much is written depends upon the value of the 5 | ``--quiet`` program option. 6 | 7 | Detailed information is written to log files (described below). All COMPAS output files are created inside a container directory, specified 8 | by the ``--output-container`` program option. 9 | 10 | If detailed output log files are created (see the ``--detailed-output`` program option), they will be created inside a containing directory 11 | named ``Detailed_Output`` within the COMPAS output container directory. 12 | 13 | Also created in the COMPAS container directory is a file named ``Run_Details`` in which COMPAS records some details of the run (COMPAS 14 | version, start time, command line program option values etc.). Note that the option values recorded in the Run details file are the values 15 | specified on the command line, not the values specified in a ``grid`` file (if used). 16 | 17 | 18 | .. toctree:: 19 | :maxdepth: 1 20 | 21 | standard-logfiles 22 | standard-logfiles-record-specifiers 23 | standard-logfiles-record-specification 24 | standard-logfiles-format 25 | standard-logfiles-record-types 26 | standard-logfiles-annotations 27 | standard-logfiles-example-definitions-file 28 | standard-logfiles-default-record-specifications 29 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-dco.rst: -------------------------------------------------------------------------------- 1 | BSE double compact objects 2 | ========================== 3 | 4 | Default record definition for the BSE Double Compact Objects log file:: 5 | 6 | const ANY_PROPERTY_VECTOR BSE_DOUBLE_COMPACT_OBJECTS_REC = { 7 | BINARY_PROPERTY::RANDOM_SEED, 8 | BINARY_PROPERTY::SEMI_MAJOR_AXIS_AT_DCO_FORMATION, 9 | BINARY_PROPERTY::ECCENTRICITY_AT_DCO_FORMATION, 10 | STAR_1_PROPERTY::MASS, 11 | STAR_1_PROPERTY::STELLAR_TYPE, 12 | STAR_2_PROPERTY::MASS, 13 | STAR_2_PROPERTY::STELLAR_TYPE, 14 | BINARY_PROPERTY::TIME_TO_COALESCENCE, 15 | BINARY_PROPERTY::TIME, 16 | BINARY_PROPERTY::MERGES_IN_HUBBLE_TIME, 17 | STAR_1_PROPERTY::RECYCLED_NEUTRON_STAR, 18 | STAR_2_PROPERTY::RECYCLED_NEUTRON_STAR 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-pulsars.rst: -------------------------------------------------------------------------------- 1 | BSE pulsar evolution 2 | ==================== 3 | 4 | Default record definition for the BSE Pulsar Evolution log file:: 5 | 6 | const ANY_PROPERTY_VECTOR BSE_PULSAR_EVOLUTION_REC = { 7 | BINARY_PROPERTY::RANDOM_SEED, 8 | STAR_1_PROPERTY::MASS, 9 | STAR_2_PROPERTY::MASS, 10 | STAR_1_PROPERTY::STELLAR_TYPE, 11 | STAR_2_PROPERTY::STELLAR_TYPE, 12 | BINARY_PROPERTY::SEMI_MAJOR_AXIS_RSOL, 13 | BINARY_PROPERTY::MASS_TRANSFER_TRACKER_HISTORY, 14 | STAR_1_PROPERTY::PULSAR_MAGNETIC_FIELD, 15 | STAR_2_PROPERTY::PULSAR_MAGNETIC_FIELD, 16 | STAR_1_PROPERTY::PULSAR_SPIN_PERIOD, 17 | STAR_2_PROPERTY::PULSAR_SPIN_PERIOD, 18 | STAR_1_PROPERTY::PULSAR_SPIN_DOWN_RATE, 19 | STAR_2_PROPERTY::PULSAR_SPIN_DOWN_RATE, 20 | STAR_1_PROPERTY::PULSAR_BIRTH_PERIOD, 21 | STAR_2_PROPERTY::PULSAR_BIRTH_PERIOD, 22 | STAR_1_PROPERTY::PULSAR_BIRTH_SPIN_DOWN_RATE, 23 | STAR_2_PROPERTY::PULSAR_BIRTH_SPIN_DOWN_RATE, 24 | BINARY_PROPERTY::TIME, 25 | BINARY_PROPERTY::DT 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-rlof.rst: -------------------------------------------------------------------------------- 1 | BSE RLOF parameters 2 | =================== 3 | 4 | Default record definition for the BSE RLOF Parameters log file:: 5 | 6 | const ANY_PROPERTY_VECTOR BSE_RLOF_PARAMETERS_REC = { 7 | BINARY_PROPERTY::RANDOM_SEED, 8 | BINARY_PROPERTY::RLOF_TIME_POST_MT, 9 | BINARY_PROPERTY::RLOF_TIME_PRE_MT, 10 | BINARY_PROPERTY::RLOF_POST_MT_STAR1_MASS, 11 | BINARY_PROPERTY::RLOF_POST_MT_STAR2_MASS, 12 | BINARY_PROPERTY::RLOF_POST_MT_STAR1_RADIUS, 13 | BINARY_PROPERTY::RLOF_POST_MT_STAR2_RADIUS, 14 | BINARY_PROPERTY::RLOF_POST_MT_STAR1_STELLAR_TYPE, 15 | BINARY_PROPERTY::RLOF_POST_MT_STAR2_STELLAR_TYPE, 16 | BINARY_PROPERTY::RLOF_POST_MT_SEMI_MAJOR_AXIS, 17 | BINARY_PROPERTY::RLOF_POST_MT_ECCENTRICITY, 18 | BINARY_PROPERTY::RLOF_POST_MT_EVENT_COUNTER, 19 | BINARY_PROPERTY::RLOF_POST_MT_STAR1_RLOF, 20 | BINARY_PROPERTY::RLOF_POST_MT_STAR2_RLOF, 21 | BINARY_PROPERTY::STELLAR_MERGER, 22 | BINARY_PROPERTY::RLOF_POST_MT_COMMON_ENVELOPE, 23 | BINARY_PROPERTY::RLOF_POST_STEP_STAR_TO_ROCHE_LOBE_RADIUS_RATIO_1, 24 | BINARY_PROPERTY::RLOF_POST_STEP_STAR_TO_ROCHE_LOBE_RADIUS_RATIO_2, 25 | BINARY_PROPERTY::RLOF_PRE_MT_STAR1_MASS, 26 | BINARY_PROPERTY::RLOF_PRE_MT_STAR2_MASS, 27 | BINARY_PROPERTY::RLOF_PRE_MT_STAR1_RADIUS, 28 | BINARY_PROPERTY::RLOF_PRE_MT_STAR2_RADIUS, 29 | BINARY_PROPERTY::RLOF_PRE_MT_STAR1_STELLAR_TYPE, 30 | BINARY_PROPERTY::RLOF_PRE_MT_STAR2_STELLAR_TYPE, 31 | BINARY_PROPERTY::RLOF_PRE_MT_SEMI_MAJOR_AXIS, 32 | BINARY_PROPERTY::RLOF_PRE_MT_ECCENTRICITY, 33 | BINARY_PROPERTY::RLOF_PRE_MT_STAR1_RLOF, 34 | BINARY_PROPERTY::RLOF_PRE_MT_STAR2_RLOF, 35 | BINARY_PROPERTY::RLOF_PRE_STEP_STAR_TO_ROCHE_LOBE_RADIUS_RATIO_1, 36 | BINARY_PROPERTY::RLOF_PRE_STEP_STAR_TO_ROCHE_LOBE_RADIUS_RATIO_2, 37 | STAR_1_PROPERTY::ZETA_SOBERMAN, 38 | STAR_1_PROPERTY::ZETA_SOBERMAN_HE, 39 | STAR_1_PROPERTY::ZETA_HURLEY, 40 | STAR_1_PROPERTY::ZETA_HURLEY_HE, 41 | STAR_2_PROPERTY::ZETA_SOBERMAN, 42 | STAR_2_PROPERTY::ZETA_SOBERMAN_HE, 43 | STAR_2_PROPERTY::ZETA_HURLEY, 44 | STAR_2_PROPERTY::ZETA_HURLEY_HE 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-supernovae.rst: -------------------------------------------------------------------------------- 1 | BSE supernovae 2 | ============== 3 | 4 | Default record definition for the BSE Supernovae log file:: 5 | 6 | const ANY_PROPERTY_VECTOR BSE_SUPERNOVAE_REC = { 7 | BINARY_PROPERTY::RANDOM_SEED, 8 | SUPERNOVA_PROPERTY::DRAWN_KICK_MAGNITUDE, 9 | SUPERNOVA_PROPERTY::KICK_MAGNITUDE, 10 | SUPERNOVA_PROPERTY::FALLBACK_FRACTION, 11 | BINARY_PROPERTY::ORBITAL_VELOCITY_PRE_SUPERNOVA, 12 | BINARY_PROPERTY::DIMENSIONLESS_KICK_MAGNITUDE, 13 | SUPERNOVA_PROPERTY::MEAN_ANOMALY, 14 | SUPERNOVA_PROPERTY::SUPERNOVA_THETA, 15 | SUPERNOVA_PROPERTY::SUPERNOVA_PHI, 16 | SUPERNOVA_PROPERTY::SN_TYPE, 17 | BINARY_PROPERTY::ECCENTRICITY_PRE_SUPERNOVA, 18 | BINARY_PROPERTY::ECCENTRICITY, 19 | BINARY_PROPERTY::SEMI_MAJOR_AXIS_PRE_SUPERNOVA_RSOL, 20 | BINARY_PROPERTY::SEMI_MAJOR_AXIS_RSOL, 21 | BINARY_PROPERTY::TIME, 22 | BINARY_PROPERTY::SUPERNOVA_STATE, 23 | BINARY_PROPERTY::UNBOUND, 24 | COMPANION_PROPERTY::STELLAR_TYPE, 25 | SUPERNOVA_PROPERTY::STELLAR_TYPE, 26 | SUPERNOVA_PROPERTY::STELLAR_TYPE_PREV, 27 | COMPANION_PROPERTY::MASS, 28 | SUPERNOVA_PROPERTY::TOTAL_MASS_AT_COMPACT_OBJECT_FORMATION, 29 | SUPERNOVA_PROPERTY::TOTAL_RADIUS_AT_COMPACT_OBJECT_FORMATION, 30 | SUPERNOVA_PROPERTY::CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 31 | SUPERNOVA_PROPERTY::CO_CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 32 | SUPERNOVA_PROPERTY::HE_CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 33 | SUPERNOVA_PROPERTY::CORE_RADIUS_AT_COMPACT_OBJECT_FORMATION, 34 | SUPERNOVA_PROPERTY::MASS, 35 | SUPERNOVA_PROPERTY::EXPERIENCED_RLOF, 36 | SUPERNOVA_PROPERTY::MASS_TRANSFER_DONOR_HISTORY, 37 | SUPERNOVA_PROPERTY::SPEED, 38 | COMPANION_PROPERTY::SPEED, 39 | BINARY_PROPERTY::SYSTEMIC_SPEED, 40 | SUPERNOVA_PROPERTY::IS_HYDROGEN_POOR, 41 | BINARY_PROPERTY::SUPERNOVA_ORBIT_INCLINATION_ANGLE, 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-sysparms.rst: -------------------------------------------------------------------------------- 1 | BSE system parameters 2 | ===================== 3 | 4 | Default record definition for the BSE System Parameters log file:: 5 | 6 | const ANY_PROPERTY_VECTOR BSE_SYSTEM_PARAMETERS_REC = { 7 | BINARY_PROPERTY::RANDOM_SEED, 8 | STAR_1_PROPERTY::MZAMS, 9 | STAR_2_PROPERTY::MZAMS, 10 | BINARY_PROPERTY::SEMI_MAJOR_AXIS_INITIAL, 11 | BINARY_PROPERTY::ECCENTRICITY_INITIAL, 12 | STAR_1_PROPERTY::SUPERNOVA_KICK_MAGNITUDE_RANDOM_NUMBER, 13 | STAR_2_PROPERTY::SUPERNOVA_KICK_MAGNITUDE_RANDOM_NUMBER, 14 | STAR_1_PROPERTY::OMEGA_ZAMS, 15 | STAR_2_PROPERTY::OMEGA_ZAMS, 16 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_CCSN_NS, 17 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_CCSN_BH, 18 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_FOR_ECSN, 19 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_FOR_USSN, 20 | PROGRAM_OPTION::LBV_FACTOR, 21 | PROGRAM_OPTION::WR_FACTOR, 22 | PROGRAM_OPTION::COMMON_ENVELOPE_ALPHA, 23 | STAR_1_PROPERTY::METALLICITY, 24 | STAR_2_PROPERTY::METALLICITY, 25 | BINARY_PROPERTY::UNBOUND, 26 | BINARY_PROPERTY::STELLAR_MERGER, 27 | BINARY_PROPERTY::STELLAR_MERGER_AT_BIRTH, 28 | BINARY_PROPERTY::MASSES_EQUILIBRATED_AT_BIRTH, 29 | STAR_1_PROPERTY::INITIAL_STELLAR_TYPE, 30 | STAR_1_PROPERTY::STELLAR_TYPE, 31 | STAR_2_PROPERTY::INITIAL_STELLAR_TYPE, 32 | STAR_2_PROPERTY::STELLAR_TYPE, 33 | STAR_1_PROPERTY::CHEMICALLY_HOMOGENEOUS_MAIN_SEQUENCE, 34 | STAR_2_PROPERTY::CHEMICALLY_HOMOGENEOUS_MAIN_SEQUENCE, 35 | BINARY_PROPERTY::EVOL_STATUS, 36 | BINARY_PROPERTY::ERROR, 37 | PROGRAM_OPTION::NOTES 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-detailed-output.rst: -------------------------------------------------------------------------------- 1 | SSE detailed output 2 | =================== 3 | 4 | Default record definition for the SSE Detailed Output log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_DETAILED_OUTPUT_REC = { 7 | STAR_PROPERTY::AGE, 8 | STAR_PROPERTY::DT, 9 | STAR_PROPERTY::TIME, 10 | STAR_PROPERTY::STELLAR_TYPE, 11 | STAR_PROPERTY::METALLICITY, 12 | STAR_PROPERTY::MASS_0, 13 | STAR_PROPERTY::MASS, 14 | STAR_PROPERTY::RADIUS, 15 | STAR_PROPERTY::RZAMS, 16 | STAR_PROPERTY::LUMINOSITY, 17 | STAR_PROPERTY::TEMPERATURE, 18 | STAR_PROPERTY::CORE_MASS, 19 | STAR_PROPERTY::CO_CORE_MASS, 20 | STAR_PROPERTY::HE_CORE_MASS, 21 | STAR_PROPERTY::MDOT, 22 | STAR_PROPERTY::DOMINANT_MASS_LOSS_RATE, 23 | STAR_PROPERTY::TIMESCALE_MS 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-pulsars.rst: -------------------------------------------------------------------------------- 1 | SSE pulsar evolution 2 | ==================== 3 | 4 | Default record definition for the SSE Pulsar Evolution log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_PULSAR_EVOLUTION_REC = { 7 | STAR_PROPERTY::RANDOM_SEED, 8 | STAR_PROPERTY::MASS, 9 | STAR_PROPERTY::STELLAR_TYPE, 10 | STAR_PROPERTY::PULSAR_MAGNETIC_FIELD, 11 | STAR_PROPERTY::PULSAR_SPIN_PERIOD, 12 | STAR_PROPERTY::PULSAR_SPIN_DOWN_RATE, 13 | STAR_PROPERTY::PULSAR_BIRTH_PERIOD, 14 | STAR_PROPERTY::PULSAR_BIRTH_SPIN_DOWN_RATE, 15 | STAR_PROPERTY::TIME, 16 | STAR_PROPERTY::DT 17 | }; 18 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-supernovae.rst: -------------------------------------------------------------------------------- 1 | SSE supernovae 2 | ============== 3 | 4 | Default record definition for the SSE Supernovae log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_SUPERNOVAE_REC = { 7 | STAR_PROPERTY::RANDOM_SEED, 8 | STAR_PROPERTY::DRAWN_KICK_MAGNITUDE, 9 | STAR_PROPERTY::KICK_MAGNITUDE, 10 | STAR_PROPERTY::FALLBACK_FRACTION, 11 | STAR_PROPERTY::MEAN_ANOMALY, 12 | STAR_PROPERTY::SN_TYPE, 13 | STAR_PROPERTY::TOTAL_MASS_AT_COMPACT_OBJECT_FORMATION, 14 | STAR_PROPERTY::TOTAL_RADIUS_AT_COMPACT_OBJECT_FORMATION, 15 | STAR_PROPERTY::CO_CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 16 | STAR_PROPERTY::MASS, 17 | STAR_PROPERTY::STELLAR_TYPE, 18 | STAR_PROPERTY::STELLAR_TYPE_PREV, 19 | STAR_PROPERTY::CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 20 | STAR_PROPERTY::HE_CORE_MASS_AT_COMPACT_OBJECT_FORMATION, 21 | STAR_PROPERTY::CORE_RADIUS_AT_COMPACT_OBJECT_FORMATION, 22 | STAR_PROPERTY::TIME, 23 | STAR_PROPERTY::IS_HYDROGEN_POOR 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-switchlog.rst: -------------------------------------------------------------------------------- 1 | SSE switchlog 2 | ============= 3 | 4 | Default record definition for the SSE SwitchLog log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_SWITCH_LOG_REC = { 7 | STAR_PROPERTY::RANDOM_SEED, 8 | STAR_PROPERTY::TIME, 9 | STAR_PROPERTY::MASS, 10 | STAR_PROPERTY::STELLAR_TYPE, 11 | STAR_PROPERTY::RADIUS 12 | }; 13 | 14 | 15 | The default record specification can be modified at runtime via a logfile record specifications file (program option ``--logfile-definitions``). 16 | See :doc:`standard-logfiles-record-specification` for details. 17 | 18 | Note that the SSE SwitchLog file has the following columns automatically appended to each record: 19 | 20 | - The stellar type from which the star is switching. 21 | - The stellar type to which the star is switching. 22 | 23 | |br| 24 | **SWITCHING_FROM** 25 | 26 | .. list-table:: 27 | :widths: 20 80 28 | :header-rows: 0 29 | :class: aligned-text 30 | 31 | * - Data type: 32 | - INT 33 | * - COMPAS variable: 34 | - `derived from` ``BaseStar::m_StellarType`` 35 | * - Description: 36 | - The stellar type of the star immediately prior to the switch. 37 | * - Header String: 38 | - "SWITCHING_FROM" 39 | 40 | **SWITCHING_TO** 41 | 42 | .. list-table:: 43 | :widths: 20 80 44 | :header-rows: 0 45 | :class: aligned-text 46 | 47 | * - Data type: 48 | - INT 49 | * - COMPAS variable: 50 | - Not applicable 51 | * - Description: 52 | - The stellar type to which the star will switch (i.e. the stellar type immediately following the switch). 53 | * - Header String: 54 | - "SWITCHING_TO" 55 | 56 | These columns will always be automatically appended to each SSE Switch Log record: they cannot be removed via the log file record 57 | specifications file. 58 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-sysparms.rst: -------------------------------------------------------------------------------- 1 | SSE system parameters 2 | ===================== 3 | 4 | Default record definition for the SSE System Parameters log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_SYSTEM_PARAMETERS_REC = { 7 | STAR_PROPERTY::RANDOM_SEED, 8 | STAR_PROPERTY::MZAMS, 9 | STAR_PROPERTY::RZAMS, 10 | STAR_PROPERTY::METALLICITY, 11 | STAR_PROPERTY::OMEGA_ZAMS, 12 | STAR_PROPERTY::INITIAL_STELLAR_TYPE, 13 | STAR_PROPERTY::STELLAR_TYPE, 14 | STAR_PROPERTY::SUPERNOVA_KICK_MAGNITUDE_RANDOM_NUMBER, 15 | STAR_PROPERTY::MASS, 16 | STAR_PROPERTY::CHEMICALLY_HOMOGENEOUS_MAIN_SEQUENCE, 17 | STAR_PROPERTY::EVOL_STATUS, 18 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_CCSN_NS, 19 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_CCSN_BH, 20 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_FOR_ECSN, 21 | PROGRAM_OPTION::KICK_MAGNITUDE_DISTRIBUTION_SIGMA_FOR_USSN, 22 | PROGRAM_OPTION::LBV_FACTOR, 23 | PROGRAM_OPTION::WR_FACTOR, 24 | PROGRAM_OPTION::NOTES 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-SSE-system-snapshot.rst: -------------------------------------------------------------------------------- 1 | SSE system snapshot 2 | =================== 3 | 4 | Default record definition for the SSE System Snapshot log file:: 5 | 6 | const ANY_PROPERTY_VECTOR SSE_SYSTEM_SNAPSHOT_LOG_REC = { 7 | STAR_PROPERTY::AGE, 8 | STAR_PROPERTY::DT, 9 | STAR_PROPERTY::TIME, 10 | STAR_PROPERTY::STELLAR_TYPE, 11 | STAR_PROPERTY::METALLICITY, 12 | STAR_PROPERTY::MASS_0, 13 | STAR_PROPERTY::MASS, 14 | STAR_PROPERTY::RADIUS, 15 | STAR_PROPERTY::RZAMS, 16 | STAR_PROPERTY::LUMINOSITY, 17 | STAR_PROPERTY::TEMPERATURE, 18 | STAR_PROPERTY::CORE_MASS, 19 | STAR_PROPERTY::CO_CORE_MASS, 20 | STAR_PROPERTY::HE_CORE_MASS, 21 | STAR_PROPERTY::MDOT, 22 | STAR_PROPERTY::DOMINANT_MASS_LOSS_RATE, 23 | STAR_PROPERTY::TIMESCALE_MS 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications.rst: -------------------------------------------------------------------------------- 1 | Default log file record specifications 2 | ====================================== 3 | 4 | Following are the default log file record specifications for each of the standard log files. These specifications 5 | can be overridden by the use of a log file specifications file via the ``logfile-definitions`` program option. 6 | 7 | For Single Star Evolution (SSE): 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | standard-logfiles-default-record-specifications-SSE-system-snapshot 13 | standard-logfiles-default-record-specifications-SSE-sysparms 14 | standard-logfiles-default-record-specifications-SSE-detailed-output 15 | standard-logfiles-default-record-specifications-SSE-supernovae 16 | standard-logfiles-default-record-specifications-SSE-pulsars 17 | standard-logfiles-default-record-specifications-SSE-switchlog 18 | 19 | For Binary Star Evolution (BSE): 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | standard-logfiles-default-record-specifications-BSE-system-snapshot 25 | standard-logfiles-default-record-specifications-BSE-sysparms 26 | standard-logfiles-default-record-specifications-BSE-detailed-output 27 | standard-logfiles-default-record-specifications-BSE-supernovae 28 | standard-logfiles-default-record-specifications-BSE-dco 29 | standard-logfiles-default-record-specifications-BSE-ce 30 | standard-logfiles-default-record-specifications-BSE-pulsars 31 | standard-logfiles-default-record-specifications-BSE-rlof 32 | standard-logfiles-default-record-specifications-BSE-switchlog 33 | 34 | 35 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-specifiers.rst: -------------------------------------------------------------------------------- 1 | Standard log file record specifiers 2 | =================================== 3 | 4 | Each standard log file has an associated log file record specifier that defines what data are to be written to the log files. Each record 5 | specifier is a list of known properties that are to be written as the log record for the log file associated with the record specifier. 6 | Default record specifiers for each of the standard log files are shown in :doc:`standard-logfiles-default-record-specifications`. 7 | The standard log file record specifiers can be defined by the user at run-time (see :doc:`standard-logfiles-record-specification`). 8 | 9 | When specifying known properties, the property name must be prefixed with the property type. The current list of valid property types 10 | available for use is: 11 | 12 | - STAR_PROPERTY 13 | - STAR_1_PROPERTY 14 | - STAR_2_PROPERTY 15 | - SUPERNOVA_PROPERTY 16 | - COMPANION_PROPERTY 17 | - BINARY_PROPERTY 18 | - PROGRAM_OPTION 19 | 20 | The stellar property types (all types except BINARY_PROPERTY AND PROGRAM_OPTION) must be paired with properties from the stellar property list, 21 | the binary property type BINARY_PROPERTY with properties from the binary property list, and the program option type PROGRAM_OPTION with properties 22 | from the program option property list. 23 | 24 | All standard log files, except the switch log files, have a record type property (column). The record type property is an integer that can be used 25 | to identify and filter records within a standard log file. The record type property was introduced primarily to support different types of records 26 | in the detailed output files (BSE and SSE), and is currently unly used in those files, but could be useful for other log files. All record types for 27 | all standard log files are printed to the log files by default, but records of specific record types can be enabled and disabled using the 28 | appropriate program option (see e.g. ``--logfile-detailed-output-record-types`` in :doc:`../Program options/program-options-list-defaults` for the 29 | detailed output files). 30 | 31 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-common-envelopes.rst: -------------------------------------------------------------------------------- 1 | BSE common envelopes file record types 2 | ====================================== 3 | 4 | Following is a list of the BSE Common Envelopes file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_COMMON_ENVELOPES file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-detailed-output.rst: -------------------------------------------------------------------------------- 1 | BSE detailed output file record types 2 | ===================================== 3 | 4 | Following is a list of the BSE Detailed Output file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. INITIAL_STATE |br| 7 | Record describes the initial state of the binary 8 | #. POST_STELLAR_TIMESTEP |br| 9 | Record was logged immediately following stellar timestep (i.e. the evolution of the constituent stars for a single timestep) 10 | #. POST_BINARY_TIMESTEP |br| 11 | Record was logged immediately following binary timestep (i.e. the evolution of the binary system for a single timestep) 12 | #. TIMESTEP_COMPLETED |br| 13 | Record was logged immediately following the completion of the timestep (after all changes to the binary and components) 14 | #. FINAL_STATE |br| 15 | Record describes the final state of the binary 16 | #. STELLAR_TYPE_CHANGE_DURING_CEE |br| 17 | Record was logged immediately following a stellar type change during a common envelope event 18 | #. STELLAR_TYPE_CHANGE_DURING_MT |br| 19 | Record was logged immediately following a stellar type change during a mass transfer event 20 | #. STELLAR_TYPE_CHANGE_DURING_MASS_RESOLUTION |br| 21 | Record was logged immediately following a stellar type change during mass resolution 22 | #. STELLAR_TYPE_CHANGE_DURING_CHE_EQUILIBRATION |br| 23 | Record was logged immediately following a stellar type change during mass equilibration for CHE 24 | #. POST_MT |br| 25 | Record was logged immediately following a mass transfer event 26 | #. POST_WINDS |br| 27 | Record was logged immediately following winds mass loss 28 | #. POST_CEE |br| 29 | Record was logged immediately following a common envelope event 30 | #. POST_SN |br| 31 | Record was logged immediately following a supernova event 32 | #. POST_MASS_RESOLUTION |br| 33 | Record was logged immediately following mass resolution (i.e. after winds mass loss & mass transfer complete) 34 | #. POST_MASS_RESOLUTION_MERGER |br| 35 | Record was logged immediately following a merger after mass resolution 36 | #. PRE_STELLAR_TIMESTEP |br| 37 | Record was logged immediately prior to stellar timestep (i.e. the evolution of the constituent stars for a single timestep) 38 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-double-compact-objects.rst: -------------------------------------------------------------------------------- 1 | BSE double compact objects file record types 2 | ============================================ 3 | 4 | Following is a list of the BSE Double Compast Objects file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_DOUBLE_COMPACT_OBJECTS file record type 8 | 9 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-pulsar-evolution.rst: -------------------------------------------------------------------------------- 1 | BSE pulsar evolution file record types 2 | ====================================== 3 | 4 | Following is a list of the BSE Pulsar Evolution file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_PULSAR_EVOLUTION file record type 8 | #. POST_SN |BR| 9 | Record was logged immediately following a supernova event 10 | #. POST_BINARY_TIMESTEP |BR| 11 | Record was logged immediately following binary timestep (i.e. the evolution of the binary system for a single timestep) 12 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-rlof.rst: -------------------------------------------------------------------------------- 1 | BSE RLOF file record types 2 | ========================== 3 | 4 | Following is a list of the BSE RLOF Parameters file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_RLOF_PARAMETERS file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-supernovae.rst: -------------------------------------------------------------------------------- 1 | BSE supernovae file record types 2 | ================================ 3 | 4 | Following is a list of the BSE Supernovae file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_SUPERNOVAE file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-system-parameters.rst: -------------------------------------------------------------------------------- 1 | BSE system parameters file record types 2 | ======================================= 3 | 4 | Following is a list of the BSE System Parameters file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_SYSTEM_PARAMETERS file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-bse-system-snapshot.rst: -------------------------------------------------------------------------------- 1 | BSE system snapshot file record types 2 | ===================================== 3 | 4 | Following is a list of the BSE System Snapshot file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default BSE_SYSTEM_SNAPSHOT_LOG file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-sse-detailed-output.rst: -------------------------------------------------------------------------------- 1 | SSE detailed output file record types 2 | ===================================== 3 | 4 | Following is a list of the SSE Detailed Output file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. INITIAL_STATE |BR| 7 | Record describes the initial state of the star 8 | #. PRE_MASS_LOSS |BR| 9 | Record was logged after timestep taken, but before mass loss resolution 10 | #. POST_MASS_LOSS |BR| 11 | Record was logged after after mass loss resolution 12 | #. TIMESTEP_COMPLETED |BR| 13 | Record was logged immediately following the completion of the timestep (after all changes to the star) 14 | #. FINAL_STATE |BR| 15 | Record describes the final state of the star 16 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-sse-pulsar-evolution.rst: -------------------------------------------------------------------------------- 1 | SSE pulsar evolution file record types 2 | ====================================== 3 | 4 | Following is a list of the SSE Pulsar Evolution file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default SSE_PULSAR_EVOLUTION file record type 8 | #. POST_SN |BR| 9 | Record was logged immediately following a supernova event 10 | #. TIMESTEP_COMPLETED |BR| 11 | Record was logged immediately following the completion of the timestep (after all changes to the star) -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-sse-supernovae.rst: -------------------------------------------------------------------------------- 1 | SSE supernovae file record types 2 | ================================ 3 | 4 | Following is a list of the SSE Supernovae file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default SSE_SUPERNOVAE file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-sse-system-parameters.rst: -------------------------------------------------------------------------------- 1 | SSE system parameters file record types 2 | ======================================= 3 | 4 | Following is a list of the SSE System Parameters file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | #. DEFAULT |BR| 7 | Default SSE_SYSTEM_PARAMETERS file record type 8 | 9 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles-record-types-sse-system-snapshot.rst: -------------------------------------------------------------------------------- 1 | SSE system snapshot file record types 2 | ===================================== 3 | 4 | Following is a list of the SSE System Snapshot file record type numbers and corresponding symbolic names, and their meaning: 5 | 6 | 1. DEFAULT |BR| 7 | Default SSE_SYSTEM_SNAPSHOT_LOG file record type 8 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/COMPAS output/standard-logfiles.rst: -------------------------------------------------------------------------------- 1 | Standard log files 2 | ================== 3 | 4 | COMPAS defines several standard log files that may be produced depending upon the simulation mode (Single Star Evolution (SSE), 5 | or Binary Star Evolution (BSE), see the ``--mode`` program option), and the value of various program options. 6 | 7 | The standard log files are: 8 | 9 | .. list-table:: 10 | :widths: 32 68 11 | :header-rows: 0 12 | :class: aligned-text 13 | 14 | * - System Parameters 15 | - Records summary information for all stars, or binary stars, during evolution. 16 | * - 17 | - 18 | * - Supernovae 19 | - Records summary information for all stars that experience a SN event during evolution. 20 | * - 21 | - 22 | * - System Snapshot Log 23 | - Records detailed system information during evolution. 24 | * - 25 | - Enable with program option ``--system-snapshot-age-thresholds`` and/or ``--system-snapshot-time-thresholds``. 26 | * - 27 | - 28 | * - BSE/SSE Detailed Output 29 | - Records detailed information for a star, or binary star, during evolution. 30 | * - 31 | - Enable with program option ``--detailed-output``. 32 | * - 33 | - 34 | * - SwitchLog 35 | - Records detailed information for all stars, or binary stars, at the time of each stellar type switch during evolution. 36 | * - 37 | - Enable with program option ``--switch-log``. 38 | * - 39 | - 40 | * - Double Compact Objects 41 | - Records summary information for all binary systems that form DCOs during BSE. 42 | * - 43 | - 44 | * - Common Envelopes 45 | - Records summary information for all binary systems that experience CEEs during BSE. 46 | * - 47 | - 48 | * - Pulsar Evolution 49 | - Records detailed Pulsar evolution information during SSE/BSE. 50 | * - 51 | - Enable with program option ``--evolve-pulsars``. 52 | * - 53 | - 54 | * - RLOF 55 | - Records detailed information RLOF events during BSE. 56 | * - 57 | - Enable with program option ``--rlof-printing``. 58 | 59 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Handling errors/evolution-status-table.rst: -------------------------------------------------------------------------------- 1 | COMPAS evolution status 2 | ======================= 3 | 4 | Following is a list of COMPAS evolution status numbers, corresponding symbolic name, and meaning: 5 | 6 | 1. DONE |br| 7 | Simulation completed without error 8 | #. ERROR |br| 9 | Evolution stopped because an error occurred 10 | #. TIMES_UP |br| 11 | Evolution stopped because the allowed time was exhausted 12 | #. STEPS_UP |br| 13 | Evolution stopped because the allowed number of timesteps was exhausted 14 | #. NO_TIMESTEPS_READ |br| 15 | Evolution stopped because there was an error reading the user-provided timesteps 16 | #. TIMESTEPS_EXHAUSTED |br| 17 | The user-provided timesteps were exhausted before evolution was complete - default timesteps used 18 | #. TIMESTEPS_NOT_CONSUMED |br| 19 | Evolution completed before all user-provided timesteps were consumed 20 | #. SSE_ERROR |br| 21 | Evolution stopped because an error occurred while evolving one of the constituent stars of a binary star 22 | #. BINARY_ERROR |br| 23 | Evolution stopped because an error occurred while evolving a binary star 24 | #. DCO_MERGER_TIME |br| 25 | Evolution stopped because the the evolution time exceeded DCO merger (formation + coalescence) time 26 | #. STARS_TOUCHING |br| 27 | Evolution stopped because the constituent stars of a binary star are touching 28 | #. STELLAR_MERGER |br| 29 | Evolution stopped because the constituent stars of a binary star merged 30 | #. STELLAR_MERGER_AT_BIRTH |br| 31 | Evolution stopped because the constituent stars of a binary star merged at birth 32 | #. DCO |br| 33 | Evolution stopped because a double compact object formed 34 | #. WD_WD |br| 35 | Evolution stopped because a double white dwarf formed 36 | #. MASSLESS_REMNANT |br| 37 | Evolution stopped because a massless remnant formed 38 | #. UNBOUND |br| 39 | Evolution stopped because the binary star became unbound 40 | #. NOT_STARTED |br| 41 | Simulation not started - not complete 42 | #. STARTED |br| 43 | Simulation started - not complete 44 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Post-processing/CHE_paper_tutorial/SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeamCOMPAS/COMPAS/ececba8cd3f7be2ef187e6dfbcedb9b175cfa0ee/online-docs/pages/User guide/Post-processing/CHE_paper_tutorial/SNR_Grid_IMRPhenomPv2_FD_all_noise.hdf5 -------------------------------------------------------------------------------- /online-docs/pages/User guide/Post-processing/hdf5/post-processing-h5sample.rst: -------------------------------------------------------------------------------- 1 | h5sample 2 | ========= 3 | 4 | 5 | .. automodule:: compas_python_utils.h5sample 6 | 7 | 8 | Command line interface for h5sample 9 | ------------------------------------------ 10 | 11 | .. argparse:: 12 | :module: compas_python_utils.h5sample 13 | :func: create_parser 14 | :prog: compas_h5sample 15 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Post-processing/post-processing.rst: -------------------------------------------------------------------------------- 1 | Post-processing tools 2 | ===================== 3 | 4 | The COMPAS suite includes some useful post-processing tools that are located in the `postProcessing` directory. 5 | In here, you will find scripts used to parse COMPAS ``HDF5``\ [#f1]_ output and calculate rates/weights/samples 6 | to place the results of the simulation into a scientific context. 7 | 8 | 9 | HDF5 tools 10 | ---------- 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | HDF5 basics 16 | H5 Copying/concatenating 17 | H5 View 18 | H5 Sample 19 | Python Demo 20 | 21 | Post-processing Demos 22 | --------------------- 23 | 24 | .. toctree:: 25 | :maxdepth: 1 26 | 27 | Basic COMPAS Data Analysis 28 | Cosmic Integration 29 | Spin prescriptions 30 | CHE Tutorial 31 | CHE Tutorial (no answers) 32 | 33 | 34 | .. rubric:: Footnotes 35 | 36 | .. [#f1] https://www.hdfgroup.org/ 37 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Program options/program-options-mixing-ranges-sets.rst: -------------------------------------------------------------------------------- 1 | Mixing ranges and sets 2 | ====================== 3 | 4 | Ranges and sets can be specified together, and there is no limit to the number of ranges or sets that can be 5 | specified on the command line, or in the :doc:`grid file <../Running COMPAS/running-grid>`. 6 | 7 | Running COMPAS with the command:: 8 | 9 | ./COMPAS --metallicity r[0.0001,5,0.0013] --common-envelope-alpha s[0.1,0.2,0.6,0.9] 10 | 11 | would result in 20 binaries being evolved: 5 for the range of metallicities, times 4 for the set of CE alpha values. 12 | 13 | 14 | Consider the following grid file, named `gridfile.txt`:: 15 | 16 | --metallicity r[0.0001,5,0.0013] --common-envelope-alpha s[0.1,0.2,0.6,0.9] 17 | --fryer-supernova-engine s[rapid,delayed] --eccentricity r[0.0001,3,0.0003] 18 | 19 | Running COMPAS with the command:: 20 | 21 | ./COMPAS --grid gridfile.txt 22 | 23 | would result in 26 binaries being evolved: 24 | 25 | - 20 for the first grid line (5 for the range of metallicities, times 4 for the set of CE alpha values), and |br| 26 | - 6 for the second grid line (2 for the set of Fryer SN engine values, and 3 for the range of eccentricities) 27 | 28 | 29 | Running COMPAS with the command:: 30 | 31 | ./COMPAS --remnant-mass-prescription s[mullermandel,fryer2012,hurley2000,muller2016] --grid gridfile.txt 32 | 33 | would result in 104 binaries being evolved: the grid file would be ‘executed’ for each of the four remnant 34 | mass prescriptions specified on the command line. 35 | 36 | Multiple ranges and/or sets can be specified on the command line, and on each line of the grid file – so very 37 | large numbers of stars/binaries can be evolved with just a few range/set specifications. 38 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Program options/program-options-sets.rst: -------------------------------------------------------------------------------- 1 | Program option sets 2 | =================== 3 | 4 | A set of values can be specified for options of any data type that are not excluded from set specifications (see 5 | note above). 6 | 7 | Option value sets are specified by: 8 | 9 | --option-name set-specifier 10 | 11 | where `set-specifier` is defined as: 12 | 13 | set-identifier[value\ :sub:`1` ,value\ :sub:`2` ,value\ :sub:`3` , ... ,value\ :sub:`n`] 14 | 15 | and 16 | 17 | .. list-table:: 18 | :widths: 24 76 19 | :header-rows: 0 20 | :class: aligned-text 21 | 22 | * - `set-identifier` 23 | - is one of {’s’, ’set’} (case is not significant) 24 | * - `value`:sub:`i` 25 | - is a value for the option 26 | 27 | Note that: 28 | 29 | `set-identifier` is mandatory for `set-specifier`. |br| 30 | `value`:sub:`i` must be the same data type as `option-name`. 31 | 32 | There should be no spaces inside the brackets ([]). Spaces on the command line are interpreted as argument delimiters 33 | by the shell parser before passing the command-line arguments to the COMPAS executable, so if spaces are present inside 34 | the brackets the shell parser breaks the set specification into multiple command-line arguments. 35 | 36 | Valid values for boolean options are {1|0, TRUE|FALSE, YES|NO, ON|OFF}, and all set values must be of 37 | the same type (i.e. all 1|0, or all YES|NO etc.). 38 | 39 | There is no limit to the number of values specified for a set, values can be repeated, and neither order nor 40 | case is significant. 41 | 42 | To specify a set of values for the ``--eccentricity-distribution`` option, a user, if running COMPAS from the 43 | command line and with no grid file, would type any of the following:: 44 | 45 | ./COMPAS --eccentricity-distribution s[THERMALISED,FIXED,FLAT] 46 | 47 | ./COMPAS --eccentricity-distribution set[THERMALISED,FIXED,FLAT] 48 | 49 | In each of the examples above the user has specified, by the use of the `set-specifier`, that three binary stars 50 | should be evolved, using the eccentricity distributions ’THERMALISED’, ’FIXED’, and ’FLAT’. 51 | 52 | Note that when a set is, or sets are, specified on the command line, the ``--number-of-systems`` command-line option is ignored. 53 | This is to avoid multiple systems with identical initial values being evolved. Ranges and sets can be mixed with grid files, and 54 | in that case ranges and sets specified on the command line will be played out for each grid file line. 55 | 56 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Program options/program-options.rst: -------------------------------------------------------------------------------- 1 | Program options 2 | =============== 3 | 4 | COMPAS provides a rich set of configuration parameters via program options, allowing users to vary many 5 | parameters that affect the evolution of single and binary stars, and the composition of the population of 6 | stars being evolved. Furthermore, COMPAS allows some parameters to be specified as ranges, or sets, of 7 | values via the program options, allowing users to specify a grid of parameter values on the command line. 8 | 9 | Combining command-line program options ranges and sets with a :doc:`grid file <../Running COMPAS/running-grid>` allows users 10 | more flexibility and the ability to specify more complex combinations of parameter values. 11 | 12 | Not all program options can be specified as ranges or sets of values. Options for which mixing different 13 | values in a single execution of COMPAS would either not be meaningful, or might cause undesirable results, 14 | such as options that specify the mode of evolution (e.g. ``--mode``), or the name or path of output files 15 | (e.g. ``--output-path``, ``--logfile-detailed-output`` etc.), cannot be specified as a range or set of values. 16 | COMPAS will issue an error message if ranges or sets are specified for options for which they are not supported. 17 | 18 | .. toctree:: 19 | :maxdepth: 1 20 | 21 | program-options-ranges 22 | program-options-sets 23 | program-options-mixing-ranges-sets 24 | program-options-vector-options 25 | program-options-list-defaults 26 | 27 | See :doc:`./program-options-list-defaults` for a full list of available program options and their default valaues. 28 | 29 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Running COMPAS/example/grid_demo.txt: -------------------------------------------------------------------------------- 1 | --initial-mass-1 35 --initial-mass-2 31 -a 3.5 --metallicity 0.001 2 | --initial-mass-1 31 --initial-mass-2 31 -a 3.5 --metallicity 0.001 3 | --initial-mass-1 40 --initial-mass-2 31 -a 3.5 --metallicity 0.001 4 | --initial-mass-1 35 --initial-mass-2 25 -a 3.5 --metallicity 0.001 -------------------------------------------------------------------------------- /online-docs/pages/User guide/Running COMPAS/running-compas.rst: -------------------------------------------------------------------------------- 1 | Running COMPAS 2 | ============== 3 | 4 | There are several ways to run COMPAS: each method suiting different needs: 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | running-via-cmdline 11 | running-via-python 12 | running-via-docker 13 | running-detailed-output 14 | running-grid 15 | 16 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Running COMPAS/running-detailed-output.rst: -------------------------------------------------------------------------------- 1 | Running detailed output 2 | ========================= 3 | 4 | The COMPAS run from the tutorial creates a new directory ``COMPAS_Output``, inside which you will find the following files/directories 5 | (here we assume ``logfile_type = 'HDF5'`` in the python submit file): 6 | 7 | **Run_Details** |br| 8 | A record of the COMPAS command-line program options specified for this tutorial (these are the values set by ``compasConfigDefault.yaml`` when using 9 | ``runSubmit.py``, or the COMPAS default values if not executing via ``runSubmit.py``). 10 | 11 | **COMPAS_Output.h5** |br| 12 | The primary output file, containing ``HDF5`` data groups for the relevant output physics. By default, and for a sufficiently large simulation, 13 | this will include: 14 | 15 | - BSE_Common_Envelopes 16 | - BSE_Double_Compact_Objects 17 | - BSE_RLOF 18 | - BSE_Supernovae 19 | - BSE_System_Parameters 20 | 21 | **Detailed_Output** |br| 22 | This directory contains the detailed output file, ``BSE_Detailed_Output_0.h5``, which records the detailed time evolution of binary. 23 | This file, and directory, is only produced if ``detailed_output = True`` in the python submit file. 24 | 25 | We examine ``BSE_Detailed_Output_0.h5`` to look at the evolution of the two stars. A default python plotting script has been included to 26 | visualise the data. Let's run the script:: 27 | 28 | python3 plot_detailed_evolution.py 29 | 30 | This should produce a plot similar to :ref:`Figure 5 `: 31 | 32 | .. _fig-5: 33 | 34 | .. figure:: ../../../images/example-plot-compressed.svg 35 | :width: 1100px 36 | :height: 625px 37 | :align: center 38 | :figclass: align-center 39 | :alt: Example COMPAS run demo plot 40 | 41 | Figure 5 Example COMPAS run. 42 | 43 | COMPAS provides many tools for analysing and post-processing the data - see :doc:`../Post-processing/post-processing` for more details. 44 | 45 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Running COMPAS/running-via-docker-installation.rst: -------------------------------------------------------------------------------- 1 | Installing the COMPAS Docker image 2 | ---------------------------------- 3 | 4 | COMPAS ``Docker`` images for all releases of COMPAS are hosted on ``dockerHub``, and tagged\ [#f1]_ with the COMPAS version number. 5 | 6 | The latest COMPAS ``Docker`` compiled version of COMPAS (dev branch) can be retrieved by executing either of the following commands:: 7 | 8 | docker pull teamcompas/compas 9 | docker pull teamcompas/compas:latest 10 | 11 | Other versions can be retrieved by specifying the tag that corresponds to the COMPAS version required. For example, to retrieve the 12 | image for COMPAS version 2.12.0, type:: 13 | 14 | docker pull teamcompas/compas:2.12.0 15 | 16 | 17 | To see all available versions, go to the `TeamCOMPAS docker hub page `_. 18 | 19 | 20 | .. rubric:: Footnotes 21 | 22 | .. [#f1] https://docs.docker.com/engine/reference/commandline/tag/ 23 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/Running COMPAS/running-via-docker.rst: -------------------------------------------------------------------------------- 1 | Running COMPAS via Docker 2 | ========================= 3 | 4 | Docker functionality has been added to COMPAS to reduce time and effort required to set up the COMPAS deployment environment. 5 | 6 | Instead of having to install and configure several libraries and tools (e.g. ``python``/``pip``, ``numpy``, ``g++``, ``boost``, ``hdf5``) 7 | which can vary considerably between operating systems and existing toolchains, users can instead opt to install ``Docker`` and run COMPAS 8 | with a single command. 9 | 10 | This also gives users the ability to run COMPAS on cloud solutions like ``AWS EC2``\ [#f1]_ or ``Google Compute Engine``\ [#f2]_ where hundreds 11 | of cores can be provisioned without having to manually configure the environment. 12 | 13 | ``Docker`` works by creating an isolated and standalone environment known as a `container`\ [#f3]_. Containers can be created or destroyed 14 | without affecting the host machine or other containers (containers can still interact with each other and the host machine through mounted 15 | directories/files or exposed ports). 16 | 17 | Containers are instances of images. An image is a pre-defined setup/environment that is instantiated when started as a container (containers 18 | are to images what objects are to classes in the OO paradigm)\ [#f4]_. 19 | 20 | Containers are (almost) always run as a ``Linux`` environment. A major benefit of this is the ability to run Linux applications in a ``Windows`` 21 | or ``macOS`` environment without having to jump through hoops or have a diminished experience. 22 | 23 | Image definitions can be defined by users (e.g. ``Dockerfiles``); there are also standard images publicly available on ``dockerHub``\ [#f5]_ 24 | 25 | This following sections assume ``Docker`` has been installed and is running. For Windows and MacOS users, see 26 | `Docker Desktop `_. 27 | 28 | 29 | .. toctree:: 30 | :maxdepth: 1 31 | 32 | running-via-docker-installation 33 | running-via-docker-running 34 | 35 | 36 | .. rubric:: Footnotes 37 | 38 | .. [#f1] https://aws.amazon.com/ec2/ 39 | .. [#f2] https://cloud.google.com/compute 40 | .. [#f3] https://www.docker.com/resources/what-container 41 | .. [#f4] `https://stackoverflow.com/questions/23735149 `_ 42 | .. [#f5] https://hub.docker.com/ 43 | 44 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/configuration.rst: -------------------------------------------------------------------------------- 1 | Configuration 2 | ============= 3 | 4 | Run-time Configuration 5 | ---------------------- 6 | 7 | COMPAS is configured at run-time via command-line options, referred to as "program options" in this documentation, and, optionally, 8 | grid files. 9 | 10 | Configuring COMPAS via command-line options and grid files gives users the flexibility to specify both the initial conditions and the 11 | evolutionary parameters that define single and binary stars at birth, and the conditions under which the stars and systems evolve over 12 | their lifetime. 13 | 14 | COMPAS has a rich set of command-line options that can be set by the user, and these, coupled with the flexibility afforded by the 15 | COMPAS grid file implementation, allow users to configure COMPAS over a broad range of initial conditions and evolutionary parameters. 16 | This provides users with the means to explore a broad range of physics and physical assumptions. 17 | 18 | 19 | Compile-time Configuration 20 | -------------------------- 21 | 22 | The values of some physical constants, bounds for some initial conditions, evolutionary parameters, and physical processes, etc., are 23 | specified in the COMPAS source file `constants.h`. While it is unlikely that these constants would need to be changed in most ordinary 24 | COMPAS runs, the possibility exists that users may want to change some of them. Should that be the case, the user should change the 25 | value(s) required in ``constants.h`` and rebuild the COMPAS executable. A makefile is provided in the source directory. 26 | 27 | See :doc:`../Getting started/getting-started` for details of how to build the COMPAS executable. 28 | -------------------------------------------------------------------------------- /online-docs/pages/User guide/user-guide.rst: -------------------------------------------------------------------------------- 1 | User guide 2 | ========== 3 | 4 | This section contains the basic user guide for COMPAS. 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | ./configuration 11 | ./Program options/program-options 12 | ./timestep-files 13 | ./random-seed 14 | ./Running COMPAS/running-compas 15 | ./COMPAS output/output 16 | ./Handling errors/handling-errors 17 | ./pre-processing 18 | ./Post-processing/post-processing 19 | ./docker 20 | -------------------------------------------------------------------------------- /online-docs/pages/contact-us.rst: -------------------------------------------------------------------------------- 1 | Contact us 2 | ========== 3 | 4 | Join the `COMPAS User Google Group `__ to engage in discussions with 5 | COMPAS users and developers, or email your queries to compas-user@googlegroups.com. 6 | 7 | -------------------------------------------------------------------------------- /online-docs/pages/how-to-cite.rst: -------------------------------------------------------------------------------- 1 | Citing COMPAS 2 | ------------- 3 | 4 | If you use this code or parts of this code for results presented in a scientific publication, we would greatly appreciate you sending 5 | us your paper reference and making your input settings and output data publicly available by uploading it to the COMPAS Zenodo community. 6 | 7 | Please also cite: 8 | 9 | .. _cite-compas: 10 | 11 | Team COMPAS: J. Riley `et al.` [:cite:year:`compas2021`]. |_| |_| |_| |_| |_| |_| :download:`Bibtex citation <../COMPAS-2021methodsPaper.bib>` 12 | 13 | |br| 14 | We would also greatly appreciate an acknowledgement of the form: 15 | 16 | "Simulations in this paper made use of the COMPAS rapid binary population synthesis code (version x.y.z), which is freely available at 17 | http://github.com/TeamCOMPAS/COMPAS." 18 | 19 | |br| 20 | Furthermore, 21 | 22 | If using the COMPAS model of gravitational wave selection effects, please cite :cite:t:`Barrett2018`. 23 | 24 | If you use COMPAS's importance sampling algorithm STROOPWAFEL, please cite :cite:t:`Broekgaarden2019`. 25 | 26 | If using COMPAS's integration over cosmic star formation history, please cite :cite:t:`Neijssel2019`. 27 | 28 | If using the COMPAS model of (pulsational) pair instability supernova, please cite :cite:t:`Stevenson2019`. 29 | 30 | If evolving pulsar spins and magnetic fields with COMPAS, please cite :cite:t:`Chattopadhyay2020`. 31 | 32 | If you use the COMPAS model of chemically homogeneous evolution, please cite :cite:t:`Riley2021`. 33 | 34 | -------------------------------------------------------------------------------- /online-docs/pages/quick-links.rst: -------------------------------------------------------------------------------- 1 | Quick Links 2 | =========== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./User guide/Program options/program-options-list-defaults 8 | ./User guide/COMPAS output/standard-logfiles-record-types 9 | ./how-to-cite 10 | -------------------------------------------------------------------------------- /online-docs/pages/references.rst: -------------------------------------------------------------------------------- 1 | References 2 | ========== 3 | 4 | .. bibliography:: 5 | :all: 6 | 7 | -------------------------------------------------------------------------------- /py_tests/conftest.py: -------------------------------------------------------------------------------- 1 | import os 2 | from typing import Any, Dict 3 | 4 | import subprocess 5 | import h5py 6 | import pytest 7 | from compas_python_utils.cosmic_integration.binned_cosmic_integrator.binary_population import \ 8 | generate_mock_population 9 | 10 | HERE = os.path.dirname(__file__) 11 | TEST_CONFIG_DIR = os.path.join(HERE, "test_data") 12 | TEST_BASH = os.path.join(TEST_CONFIG_DIR, "run.sh") 13 | TEST_ARCHIVE_DIR = os.path.join(HERE, "test_artifacts") 14 | REPO_ROOT = os.getenv("COMPAS_ROOT_DIR", os.path.abspath(os.path.join(HERE, ".."))) 15 | COMPAS_EXE = os.path.join(REPO_ROOT, "src", "COMPAS") 16 | 17 | @pytest.fixture() 18 | def example_compas_output_path(clean=False): 19 | """Get the path to the COMPAS output file generated by the test suite. 20 | 21 | (This is a fixture so it can passed as a parameter to other tests) 22 | """ 23 | compas_data_path = os.path.join( 24 | TEST_CONFIG_DIR, "COMPAS_Output/COMPAS_Output.h5" 25 | ) 26 | 27 | if not os.path.exists(compas_data_path) or clean: # Check if path exists 28 | curr_dir = os.getcwd() 29 | os.chdir(TEST_CONFIG_DIR) 30 | # run the command in shell "compas_run_submit {TEST_CONFIG_FNAME}" with subprocess 31 | subprocess.run(TEST_BASH, shell=True, check=True) 32 | os.chdir(curr_dir) 33 | print("Generated COMPAS test data") 34 | 35 | 36 | return compas_data_path 37 | 38 | 39 | @pytest.fixture() 40 | def test_archive_dir(): 41 | """Get the path to the test archive directory.""" 42 | os.makedirs(TEST_ARCHIVE_DIR, exist_ok=True) 43 | return TEST_ARCHIVE_DIR 44 | 45 | 46 | def get_compas_data(path: str) -> Dict[str, Any]: 47 | """Reads in a COMPAS h5 file and returns a dict with some data from the file.""" 48 | data = {} 49 | with h5py.File(path, "r") as f: 50 | data["groups"] = list(f.keys()) 51 | for group in data["groups"]: 52 | data[f"{group}_n_cols"] = len(f[group]) 53 | if "SEED" in f[group]: 54 | data[f"{group}_SEED"] = f[group]["SEED"][:] 55 | return data 56 | 57 | 58 | @pytest.fixture 59 | def fake_compas_output(tmpdir) -> str: 60 | fname = f"{tmpdir}/COMPAS_mock_output.h5" 61 | generate_mock_population( 62 | filename=fname, 63 | ) 64 | return fname -------------------------------------------------------------------------------- /py_tests/test_cosmology_setter.py: -------------------------------------------------------------------------------- 1 | from compas_python_utils.cosmic_integration import cosmology 2 | from astropy import cosmology as cosmo 3 | 4 | from astropy.cosmology import WMAP9, Planck18 5 | 6 | 7 | def test_set_cosmology(): 8 | assert isinstance(cosmology.DEFAULT_COSMOLOGY, cosmo.FLRW) 9 | assert cosmology.DEFAULT_COSMOLOGY.name == "Planck18" 10 | 11 | 12 | def test_setting_cosmology_with_string(): 13 | cosmology.get_cosmology("WMAP9") 14 | assert cosmology.COSMOLOGY[1] == "WMAP9" 15 | cosmology.get_cosmology("Planck18") 16 | 17 | 18 | def test_setting_cosmology_with_astropy_object(): 19 | cosmology.get_cosmology(WMAP9) 20 | assert cosmology.COSMOLOGY[1] == "WMAP9" 21 | cosmology.get_cosmology(Planck18) 22 | 23 | 24 | def test_setting_cosmology_with_default(): 25 | cosmology.get_cosmology() 26 | assert cosmology.COSMOLOGY[1] == cosmology.DEFAULT_COSMOLOGY.name 27 | 28 | 29 | def test_setting_cosmology_with_flat_lambda_cdm_dict(): 30 | cosmo_dict = dict(H0=67.7, Om0=0.3) 31 | cosmology.get_cosmology(cosmo_dict) 32 | assert cosmology.COSMOLOGY[1][:13] == "FlatLambdaCDM" 33 | 34 | 35 | def test_setting_cosmology_with_lambda_cdm_dict(): 36 | cosmo_dict = dict(H0=67.7, Om0=0.3, Ode0=0.7) 37 | cosmology.get_cosmology(cosmo_dict) 38 | assert cosmology.COSMOLOGY[1][:9] == "LambdaCDM" 39 | 40 | 41 | def test_setting_cosmology_with_w_cdm_dict(): 42 | cosmo_dict = dict(H0=67.7, Om0=0.3, Ode0=0.7, w0=-1.0) 43 | cosmology.get_cosmology(cosmo_dict) 44 | assert cosmology.COSMOLOGY[1][:4] == "wCDM" 45 | -------------------------------------------------------------------------------- /py_tests/test_data/README.md: -------------------------------------------------------------------------------- 1 | # Test Data 2 | 3 | This folder contains COMPAS configs used for testing. 4 | COMPAS is run from within the pytest environment and the output is cached for the remainder of the tests. 5 | 6 | The pytest runs the following command: 7 | ```bash 8 | compas_run_submit fiducial_bbh_configs.yaml 9 | ``` 10 | 11 | The pytest cache is _not_ cleared locally (but will be cleared on the CI server). 12 | Hence, this may need to be rerun locally if changes are made to COMPAS. -------------------------------------------------------------------------------- /py_tests/test_data/run.sh: -------------------------------------------------------------------------------- 1 | #bin/bash 2 | echo ">>> GENERATING TEST COMPAS DATA <<<" 3 | # if $COMPAS_EXECUTABLE_PATH not set, set to ../../src/COMPAS 4 | COMPAS_EXECUTABLE_PATH=${COMPAS_EXECUTABLE_PATH:-../../src/COMPAS} 5 | $COMPAS_EXECUTABLE_PATH \ 6 | -n 2 \ 7 | --initial-mass-1 35 \ 8 | --initial-mass-2 31 \ 9 | -a 3.5 \ 10 | --random-seed 0 \ 11 | --metallicity 0.001 \ 12 | --detailed-output \ 13 | > compas_run.log 14 | cat compas_run.log 15 | echo "Generating detailed evolution plot" 16 | compas_plot_detailed_evolution "./COMPAS_Output/Detailed_Output/BSE_Detailed_Output_0.h5" --dont-show >> detailed_evolution.log 17 | echo "Out files:" 18 | ls -l 19 | echo ">>> DONE <<<" 20 | -------------------------------------------------------------------------------- /py_tests/test_example_notebooks.py: -------------------------------------------------------------------------------- 1 | import glob 2 | from tqdm.auto import tqdm 3 | import jupytext 4 | import os 5 | import nbformat 6 | from nbconvert.preprocessors import CellExecutionError, ExecutePreprocessor 7 | import pytest 8 | 9 | HERE = os.path.dirname(__file__) 10 | NB_DIR = os.path.join(HERE, "../online-docs/pages/User guide/Post-processing/notebooks/") 11 | 12 | EXAMPLE_NB = [ 13 | os.path.join(NB_DIR, "CosmicIntegration.py"), 14 | # add others here 15 | ] 16 | 17 | 18 | @pytest.mark.webtest 19 | def test_run_examples(): 20 | """Test that all examples run without error""" 21 | for example_py_file in tqdm(EXAMPLE_NB, desc="Running examples"): 22 | ipynb = __convert_to_ipynb(example_py_file) 23 | success = __execute_ipynb(ipynb, execute_dir=NB_DIR) 24 | if not success: 25 | os.remove(ipynb) 26 | assert False, f"{example_py_file} failed to run" 27 | 28 | 29 | def __convert_to_ipynb(py_file): 30 | """Convert a python file to a notebook""" 31 | ipynb_fn = py_file.replace(".py", ".ipynb") 32 | if os.path.exists(ipynb_fn): 33 | os.remove(ipynb_fn) 34 | nb = jupytext.read(py_file, fmt="py:light") 35 | jupytext.write(nb, ipynb_fn, fmt="ipynb") 36 | return ipynb_fn 37 | 38 | 39 | def __execute_ipynb(notebook_filename: str, execute_dir: str = None) -> bool: 40 | """ 41 | :param notebook_filename: path of notebook to process 42 | :return: bool if notebook-preprocessing successful/unsuccessful 43 | """ 44 | success = True 45 | with open(notebook_filename) as f: 46 | notebook = nbformat.read(f, as_version=4) 47 | 48 | ep = ExecutePreprocessor(timeout=-1) 49 | try: 50 | ep.preprocess(notebook, {"metadata": {"path": execute_dir}}) 51 | except CellExecutionError as e: 52 | print( 53 | f"Preprocessing {notebook_filename} failed:\n\n {e.traceback}" 54 | ) 55 | success = False 56 | finally: 57 | with open(notebook_filename, mode="wt") as f: 58 | nbformat.write(notebook, f) 59 | return success 60 | -------------------------------------------------------------------------------- /py_tests/test_fast_cosmic_integration.py: -------------------------------------------------------------------------------- 1 | from compas_python_utils.cosmic_integration import FastCosmicIntegration 2 | from compas_python_utils.cosmic_integration.ClassCOMPAS import COMPASData 3 | 4 | import time 5 | import os 6 | 7 | 8 | def test_fast_cosmic_integration(example_compas_output_path, test_archive_dir, capsys): 9 | """Test that fast cosmic integration works""" 10 | t0 = time.time() 11 | ( 12 | detection_rate, 13 | formation_rate, 14 | merger_rate, 15 | redshifts, 16 | COMPAS, 17 | ) = FastCosmicIntegration.find_detection_rate( 18 | path=example_compas_output_path, 19 | merges_hubble_time=False, 20 | pessimistic_CEE=False, 21 | no_RLOF_after_CEE=False, 22 | ) 23 | runtime = time.time() - t0 24 | assert runtime < 10 25 | 26 | # write logs from run to file in OUTDIR 27 | logfname = os.path.join(test_archive_dir, "test_fast_cosmic_integration.log") 28 | with open(logfname, "w") as f: 29 | sout = capsys.readouterr().out 30 | f.write(sout) 31 | 32 | 33 | # check that the shape of the detection rate, formation rate and merger rate are the same 34 | num_rows = [detection_rate.shape[0], formation_rate.shape[0], merger_rate.shape[0]] 35 | assert len(set(num_rows)) == 1 36 | 37 | # check that the len of the redshifts is the same as the number of cols in formation and merger rate 38 | assert len(redshifts) == formation_rate.shape[1] 39 | assert len(redshifts) == merger_rate.shape[1] 40 | 41 | # check that the COMPAS object is a COMPASData object 42 | assert isinstance(COMPAS, COMPASData) 43 | 44 | 45 | 46 | def test_compas_output_has_dcos(example_compas_output_path): 47 | """Test that the COMPAS output has dco_type""" 48 | COMPAS = COMPASData(path=example_compas_output_path, lazyData=False) 49 | COMPAS.setCOMPASDCOmask(types='BBH', withinHubbleTime=False, pessimistic=False, noRLOFafterCEE=False) 50 | COMPAS.setCOMPASData() 51 | n_bin = len(COMPAS.seedsDCO) 52 | assert n_bin > 1 53 | assert sum(COMPAS.DCOmask) == n_bin -------------------------------------------------------------------------------- /py_tests/test_h5copy.py: -------------------------------------------------------------------------------- 1 | import os 2 | from typing import Any, Dict 3 | 4 | import h5py 5 | from conftest import get_compas_data 6 | from deepdiff import DeepDiff 7 | 8 | from compas_python_utils import h5copy 9 | 10 | 11 | def test_h5copy_copyHDF5File(tmp_path, example_compas_output_path): 12 | """Test that h5copy Copy file can copy a file""" 13 | init_file = example_compas_output_path 14 | 15 | # creating new h5 file to copy contents to 16 | new_file = f"{tmp_path}/copied_compas_out.h5" 17 | with h5py.File(new_file, "w") as new_h5file: 18 | h5copy.copyHDF5File(path=init_file, outFile=new_h5file) 19 | assert os.path.exists(new_file), f"File {new_file} does not exist" 20 | init_data = get_compas_data(init_file) 21 | new_data = get_compas_data(new_file) 22 | diff = DeepDiff(init_data, new_data) 23 | assert len(diff) == 0, f"The copied file is not the same as the original: {diff}" 24 | -------------------------------------------------------------------------------- /py_tests/test_h5sample.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import numpy as np 4 | from conftest import get_compas_data 5 | from deepdiff import DeepDiff 6 | 7 | from compas_python_utils import h5sample 8 | import pytest 9 | 10 | 11 | @pytest.mark.parametrize( 12 | "test_kwargs", 13 | [ 14 | dict(n=100, replace=True), 15 | dict(frac=0.5, replace=False), 16 | dict(frac=1.2, replace=True), 17 | dict(seed_group="BSE_Double_Compact_Objects", frac=2.0, replace=True), 18 | ], 19 | ) 20 | def test_sample(test_kwargs, tmp_path, fake_compas_output): 21 | """Test that h5sample can sample a file""" 22 | np.random.seed(0) 23 | init_file = fake_compas_output 24 | 25 | new_file = f"{tmp_path}/sampled_compas_out.h5" 26 | if os.path.exists(new_file): 27 | os.remove(new_file) 28 | h5sample.sample_h5(init_file, new_file, **test_kwargs) 29 | assert os.path.exists(new_file), f"File {new_file} does not exist" 30 | init_data = get_compas_data(init_file) 31 | new_data = get_compas_data(new_file) 32 | diff = DeepDiff(init_data, new_data) 33 | assert ( 34 | len(diff) > 0 35 | ), f"The sampled file is the same as the original when using kwgs: {test_kwargs}" 36 | 37 | 38 | def test_argparser(capsys): 39 | with pytest.raises(SystemExit): 40 | h5sample.parse_args(["-h"]) 41 | output = capsys.readouterr().out 42 | assert "Sample an COMPAS h5 file" in output 43 | -------------------------------------------------------------------------------- /py_tests/test_h5view.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests that the utils/h5view.py module works as expected. 3 | """ 4 | 5 | import h5py 6 | 7 | from compas_python_utils import h5view 8 | 9 | 10 | def test_h5view_print_contents_doest_fail(example_compas_output_path, capsys): 11 | """Test that h5view print_contents doesn't fail""" 12 | h5file = h5py.File(example_compas_output_path, 'r') 13 | h5view.printContents( 14 | h5name=example_compas_output_path, h5file=h5file 15 | ) 16 | sout = capsys.readouterr().out 17 | assert f"Contents of HDF5 file {example_compas_output_path}" in sout 18 | assert "COMPAS file: Run_Details" in sout 19 | -------------------------------------------------------------------------------- /py_tests/test_plot_detailed_evolution.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | import time 3 | import pytest 4 | 5 | from compas_python_utils.detailed_evolution_plotter import plot_detailed_evolution 6 | 7 | 8 | def test_plotter(example_compas_output_path, capsys, test_archive_dir): 9 | data_path = example_compas_output_path 10 | bse_detailed_out_path = os.path.join( 11 | os.path.dirname(data_path), "Detailed_Output/BSE_Detailed_Output_0.h5" 12 | ) 13 | t0 = time.time() 14 | plot_detailed_evolution.run_main_plotter( 15 | bse_detailed_out_path, outdir=test_archive_dir, show=False, use_latex=False 16 | ) 17 | runtime = time.time() - t0 18 | 19 | sout = capsys.readouterr().out 20 | 21 | assert runtime < 30 22 | assert os.path.exists(os.path.join(test_archive_dir, "vanDenHeuvelPlot.eps")) 23 | assert os.path.exists(os.path.join(test_archive_dir, "detailedEvolutionPlot.png")) 24 | 25 | with open(os.path.join(test_archive_dir, "test_plotter.log"), "w") as f: 26 | f.write(sout) 27 | -------------------------------------------------------------------------------- /py_tests/test_run_submit.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | from yaml.scanner import ScannerError 4 | 5 | from compas_python_utils.preprocessing.runSubmit import ( 6 | DEFAULT_CONFIG_FILE, runSubmit 7 | ) 8 | 9 | 10 | def test_run_submit(tmp_path, capsys): 11 | """Capture the stdout from runSubmit(execute=False) and check that it is as expected""" 12 | 13 | runSubmit(cli_args=[DEFAULT_CONFIG_FILE], execute=False) 14 | _check_if_expected_kwgs_in_stdout(capsys, ["COMPAS", "output-path"]) 15 | 16 | temp_ini, ini_contents = _make_tmp_ini(tmp_path) 17 | try: 18 | runSubmit(execute=False, cli_args=[temp_ini]) 19 | except ScannerError: 20 | raise Exception( 21 | f"runSubmit failed to parse the ini file. Ini file:\n{ini_contents}" 22 | ) 23 | _check_if_expected_kwgs_in_stdout(capsys, ["log-level", "debug-to_file"]) 24 | 25 | 26 | def _make_tmp_ini(tmp_path) -> str: 27 | """ 28 | Make a temporary ini file for testing 29 | uncomment all default options to ensure they can be parsed 30 | """ 31 | with open(DEFAULT_CONFIG_FILE, "r") as f: 32 | lines = f.read() 33 | lines = lines.replace("\n#", "\n") 34 | ini = f"{tmp_path}/test.ini" 35 | with open(ini, "w") as f: 36 | f.writelines(lines) 37 | return ini, lines 38 | 39 | 40 | def _check_if_expected_kwgs_in_stdout(capsys, expected_kwgs: List[str]): 41 | """Check that all expected_kwgs are in stdout""" 42 | stdout = capsys.readouterr().out 43 | for expected_kwarg in expected_kwgs: 44 | assert ( 45 | expected_kwarg in stdout, 46 | f"Expected kwarg {expected_kwarg} not found in sout: {stdout}", 47 | ) 48 | -------------------------------------------------------------------------------- /py_tests/test_sample_moe_di_stefano.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import os 3 | from compas_python_utils.preprocessing import sampleMoeDiStefano 4 | 5 | 6 | @pytest.mark.slow 7 | def test_generate_MoeDiStefano_gridfile(tmp_path): 8 | fname = os.path.join(tmp_path, "gridfn.txt") 9 | # This can take ~1 minute to run 10 | sampleMoeDiStefano.main(cli_args=['--gridname', fname, '--nSamples', '10']) 11 | assert os.path.exists(fname) 12 | # TODO: ask reinhold if there is a way to check the contents 13 | # TODO: ask reinhold how to allow createParameterDistributionsAndSampler to be run with smaller grid-points 14 | -------------------------------------------------------------------------------- /py_tests/test_stroopwafel_interface.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | @pytest.mark.skip("Not implemented yet") 5 | def test_stroopwafel_config(self): 6 | self.fail("Not implemented yet") 7 | # TODO: get help with this -- need to make the stroopwafel interface modular -------------------------------------------------------------------------------- /src/COWD.cpp: -------------------------------------------------------------------------------- 1 | #include "COWD.h" 2 | 3 | /* 4 | * Specifies next stage, if the star changes its phase. 5 | * 6 | * STELLAR_TYPE EvolveToNextPhase() 7 | * 8 | * @return Stellar type of the upcoming stage. 9 | */ 10 | 11 | STELLAR_TYPE COWD::EvolveToNextPhase() { 12 | 13 | STELLAR_TYPE stellarType; 14 | 15 | if (m_OffCenterIgnition) { 16 | stellarType = STELLAR_TYPE::OXYGEN_NEON_WHITE_DWARF; 17 | } 18 | else { 19 | stellarType = ResolveSNIa(); 20 | } 21 | return stellarType; 22 | } 23 | -------------------------------------------------------------------------------- /src/EnumHash.h: -------------------------------------------------------------------------------- 1 | #ifndef __EnumHash_h__ 2 | #define __EnumHash_h__ 3 | 4 | // functor object to calculate hash for enum class 5 | // note: this was written because c++11 didn't allow the use of enum hashes, 6 | // but I believe it was considered a defect and has been fixed in c++14 7 | // check http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2148 8 | // we may be able to remove this 9 | struct EnumClassHash 10 | { 11 | template 12 | std::size_t operator()(T t) const 13 | { 14 | return static_cast(t); 15 | } 16 | }; 17 | 18 | template 19 | using HashType = typename std::conditional::value, EnumClassHash, std::hash>::type; 20 | 21 | // type alias for unordered map with enum hash 22 | template 23 | using COMPASUnorderedMap = std::unordered_map>; 24 | 25 | 26 | #endif // __EnumHash_h__ 27 | -------------------------------------------------------------------------------- /src/MR.cpp: -------------------------------------------------------------------------------- 1 | #include "MR.h" 2 | 3 | // Nothing to see here... 4 | // 5 | // Add Massless Remnant (MR) specific code here 6 | -------------------------------------------------------------------------------- /src/MR.h: -------------------------------------------------------------------------------- 1 | #ifndef __MR_h__ 2 | #define __MR_h__ 3 | 4 | #include "constants.h" 5 | #include "typedefs.h" 6 | #include "limits.h" 7 | 8 | #include "Remnants.h" 9 | 10 | class BaseStar; 11 | class Remnants; 12 | 13 | class MR: virtual public BaseStar, public Remnants { 14 | 15 | public: 16 | 17 | MR() { m_StellarType = STELLAR_TYPE::MASSLESS_REMNANT; }; 18 | 19 | MR(const BaseStar &p_BaseStar, const bool p_Initialise = true) : BaseStar(p_BaseStar), Remnants(p_BaseStar) { 20 | m_StellarType = STELLAR_TYPE::MASSLESS_REMNANT; // Set stellar type 21 | if (p_Initialise) Initialise(); // Initialise if required 22 | } 23 | 24 | MR* Clone(const OBJECT_PERSISTENCE p_Persistence, const bool p_Initialise = true) { 25 | MR* clone = new MR(*this, p_Initialise); 26 | clone->SetPersistence(p_Persistence); 27 | return clone; 28 | } 29 | 30 | static MR* Clone(MR& p_Star, const OBJECT_PERSISTENCE p_Persistence, const bool p_Initialise = true) { 31 | MR* clone = new MR(p_Star, p_Initialise); 32 | clone->SetPersistence(p_Persistence); 33 | return clone; 34 | } 35 | 36 | 37 | protected: 38 | 39 | void Initialise() { 40 | // ensure it's a massless remnant... 41 | m_Age = 0.0; 42 | m_Mass = 0.0; 43 | m_COCoreMass = 0.0; 44 | m_HeCoreMass = 0.0; 45 | m_CoreMass = 0.0; 46 | m_Mass0 = 0.0; 47 | m_Luminosity = 0.0; 48 | m_Radius = 0.0; 49 | m_Temperature = 0.0; 50 | } 51 | 52 | 53 | // member functions 54 | double CalculateMomentOfInertia() const { return 0.0; } // No moment of inertia for massless remnants - use 0.0 55 | double CalculateMomentOfInertiaAU() const { return 0.0; } // No moment of inertia for massless remnants - use 0.0 56 | 57 | double ChooseTimestep(const double p_Time) const { return std::numeric_limits::max(); } // Can take arbitrarily long time steps for massless remnants -- nothing is happening 58 | 59 | void SetPulsarParameters() const { } // NO-OP 60 | 61 | bool ShouldEvolveOnPhase() const { return true; } // Always 62 | bool ShouldSkipPhase() const { return false; } // Don't skip 63 | }; 64 | 65 | #endif // __MR_h__ 66 | -------------------------------------------------------------------------------- /src/MS_lte_07.cpp: -------------------------------------------------------------------------------- 1 | #include "MS_lte_07.h" 2 | 3 | 4 | 5 | 6 | /* 7 | * Determines if mass transfer is unstable according to the critical mass ratio. 8 | * 9 | * See e.g de Mink et al. 2013, Claeys et al. 2014, and Ge et al. 2010, 2015, 2020 for discussions. 10 | * 11 | * Assumes this star is the donor; relevant accretor details are passed as parameters. 12 | * Critical mass ratio is defined as qCrit = mAccretor/mDonor. 13 | * 14 | * double MS_lte_07::CalculateCriticalMassRatioClaeys14(const bool p_AccretorIsDegenerate) 15 | * 16 | * @param [IN] p_AccretorIsDegenerate Boolean indicating if accretor in degenerate (true = degenerate) 17 | * @return Critical mass ratio for unstable MT 18 | */ 19 | double MS_lte_07::CalculateCriticalMassRatioClaeys14(const bool p_AccretorIsDegenerate) const { 20 | 21 | double qCrit; 22 | 23 | qCrit = p_AccretorIsDegenerate 24 | ? OPTIONS->MassTransferCriticalMassRatioMSLowMassDegenerateAccretor() // degenerate accretor 25 | : OPTIONS->MassTransferCriticalMassRatioMSLowMassNonDegenerateAccretor(); // non-degenerate accretor 26 | 27 | return qCrit; 28 | } 29 | -------------------------------------------------------------------------------- /src/MS_lte_07.h: -------------------------------------------------------------------------------- 1 | #ifndef __MS_lte_07_h__ 2 | #define __MS_lte_07_h__ 3 | 4 | #include "constants.h" 5 | #include "typedefs.h" 6 | #include "profiling.h" 7 | #include "utils.h" 8 | 9 | #include "BaseStar.h" 10 | #include "MainSequence.h" 11 | 12 | class BaseStar; 13 | class MainSequence; 14 | 15 | class MS_lte_07: virtual public BaseStar, public MainSequence { 16 | 17 | public: 18 | 19 | MS_lte_07() { m_StellarType = STELLAR_TYPE::MS_LTE_07; }; 20 | 21 | MS_lte_07(const BaseStar &p_BaseStar, const bool p_Initialise = true) : BaseStar(p_BaseStar), MainSequence(p_BaseStar) { 22 | m_StellarType = STELLAR_TYPE::MS_LTE_07; // Set stellar type 23 | if (p_Initialise) Initialise(); // Initialise if required 24 | } 25 | 26 | MS_lte_07* Clone(const OBJECT_PERSISTENCE p_Persistence, const bool p_Initialise = true) { 27 | MS_lte_07* clone = new MS_lte_07(*this, p_Initialise); 28 | clone->SetPersistence(p_Persistence); 29 | return clone; 30 | } 31 | 32 | static MS_lte_07* Clone(MS_lte_07& p_Star, const OBJECT_PERSISTENCE p_Persistence, const bool p_Initialise = true) { 33 | MS_lte_07* clone = new MS_lte_07(p_Star, p_Initialise); 34 | clone->SetPersistence(p_Persistence); 35 | return clone; 36 | } 37 | 38 | 39 | protected: 40 | 41 | void Initialise() { 42 | CalculateTimescales(); // Initialise timescales 43 | m_Age = 0.0; // Set age appropriately 44 | } 45 | 46 | 47 | // member functions - alphabetically 48 | double CalculateCriticalMassRatioClaeys14(const bool p_AccretorIsDegenerate) const ; 49 | double CalculateCriticalMassRatioHurleyHjellmingWebbink() const { return HURLEY_HJELLMING_WEBBINK_QCRIT_MS_LTE_07; } 50 | double CalculateMassTransferRejuvenationFactor() { return 1.0; } 51 | 52 | ENVELOPE DetermineEnvelopeType() const { return ENVELOPE::CONVECTIVE; } // Always CONVECTIVE 53 | }; 54 | 55 | #endif // __MS_lte_07_h__ 56 | -------------------------------------------------------------------------------- /src/ONeWD.cpp: -------------------------------------------------------------------------------- 1 | #include "ONeWD.h" 2 | 3 | /* 4 | * Allow evolution to a new phase (currently, only SN) 5 | * 6 | * bool ShouldEvolveOnPhase() 7 | * 8 | * @return Whether the WD should evolve on phase or towards a SN. 9 | */ 10 | bool ONeWD::ShouldEvolveOnPhase() const { 11 | return !IsSupernova(); 12 | } 13 | 14 | 15 | /* 16 | * List all conditions for SN (AIC) for ONeWD. 17 | * Each condition should also be a separate clause in EvolveToNextPhase. 18 | * 19 | * bool IsSupernova() 20 | * 21 | * @return Whether WD should undergo AIC 22 | */ 23 | bool ONeWD::IsSupernova() const { 24 | return IsMassAboveChandrasekhar(); 25 | } 26 | 27 | 28 | /* 29 | * Specifies next stage, if the star changes its phase. 30 | * 31 | * STELLAR_TYPE EvolveToNextPhase() 32 | * 33 | * @return Stellar type of the upcoming stage. 34 | */ 35 | STELLAR_TYPE ONeWD::EvolveToNextPhase() { 36 | return ResolveAIC(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/Rand.h: -------------------------------------------------------------------------------- 1 | #ifndef __Rand_H__ 2 | #define __Rand_H__ 3 | 4 | #define RAND Rand::Instance() 5 | 6 | #include // GSL random number generator 7 | #include 8 | 9 | 10 | /* 11 | * Rand Singleton - interface to GSL rng (random number generator) 12 | * 13 | * Singletons and global variables are sometimes frowned-upon, but doing it this 14 | * way means the objects don't need to be passed around to all and sundry. 15 | * I think convenience and clarity sometimes trump dogma. 16 | */ 17 | 18 | class Rand { 19 | 20 | private: 21 | 22 | Rand() { m_Rng = NULL; }; 23 | Rand(Rand const&) = delete; 24 | Rand& operator = (Rand const&) = delete; 25 | 26 | static Rand* m_Instance; 27 | 28 | gsl_rng* m_Rng; // GSL random number generator 29 | 30 | unsigned long int m_Seed; 31 | 32 | 33 | public: 34 | 35 | static Rand* Instance(); 36 | 37 | void Initialise(); 38 | void Free(); 39 | 40 | unsigned long int CurrentSeed() { return m_Seed; } 41 | unsigned long int DefaultSeed() { return gsl_rng_default_seed; } 42 | unsigned long int Seed(const unsigned long p_Seed) { gsl_rng_set(m_Rng, p_Seed); m_Seed = p_Seed; return p_Seed; } 43 | 44 | double Random(); 45 | double Random(const double p_Lower, const double p_Upper); 46 | int RandomInt(const int p_Lower, const int p_Upper); 47 | int RandomInt(const int p_Upper) { return p_Upper < 0 ? 0 : RandomInt(0, p_Upper); } 48 | double RandomGaussian(const double p_Sigma); 49 | }; 50 | 51 | 52 | #endif // __Rand_H__ 53 | -------------------------------------------------------------------------------- /src/Remnants.cpp: -------------------------------------------------------------------------------- 1 | #include "Remnants.h" 2 | 3 | 4 | /* 5 | * Calculate: 6 | * 7 | * (a) the maximum mass acceptance rate of this star, as the accretor, during mass transfer, and 8 | * (b) the accretion efficiency parameter 9 | * 10 | * 11 | * The maximum acceptance rate of the accretor star during mass transfer is based on stellar type: this function 12 | * is for compact remnants (NS, BH). 13 | * 14 | * Mass transfer is assumed Eddington limited for BHs and NSs. The formalism of Nomoto/Claeys is used for WDs. 15 | * 16 | * For non compact objects: 17 | * 18 | * 1) Kelvin-Helmholtz (thermal) timescale if THERMAL (thermally limited) mass transfer efficiency 19 | * 2) Choose a fraction of the mass rate that will be effectively accreted for FIXED fraction mass transfer (as in StarTrack) 20 | * 21 | * 22 | * DBL_DBL CalculateMassAcceptanceRate(const double p_DonorMassRate, const double p_AccretorMassRate) 23 | * 24 | * @param [IN] p_DonorMassRate Mass transfer rate of the donor 25 | * @param [IN] p_AccretorMassRate Thermal mass loss rate of the accretor (this star) - ignored here 26 | * @return Tuple containing the Maximum Mass Acceptance Rate and the Accretion Efficiency Parameter 27 | */ 28 | DBL_DBL Remnants::CalculateMassAcceptanceRate(const double p_DonorMassRate, const double p_AccretorMassRate) { 29 | 30 | double thisMassRate = CalculateEddingtonCriticalRate(); 31 | 32 | double acceptanceRate = std::min(thisMassRate, p_DonorMassRate); 33 | double fractionAccreted = acceptanceRate / p_DonorMassRate; 34 | 35 | return std::make_tuple(acceptanceRate, fractionAccreted); 36 | } 37 | 38 | 39 | /* 40 | * Choose timestep for evolution 41 | * 42 | * Given in the discussion in Hurley et al. 2000 43 | * 44 | * 45 | * ChooseTimestep(const double p_Time) 46 | * 47 | * @param [IN] p_Time Current age of star in Myr 48 | * @return Suggested timestep (dt) 49 | */ 50 | double Remnants::ChooseTimestep(const double p_Time) const { 51 | 52 | double dtk = std::min(std::max(1.0, p_Time), 500.0); 53 | 54 | return std::max(dtk, NUCLEAR_MINIMUM_TIMESTEP); 55 | } 56 | --------------------------------------------------------------------------------