Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions bin/cosmic-pop
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,25 @@ if __name__ == '__main__':
pass
filters['timestep_conditions'] = []

# Create a pool
bpp, bcm, initCond, kick_info = Evolve.evolve(initialbinarytable=IBT,
pool=pool,
BSEDict=BSEDict,
SSEDict=SSEDict,
idx=idx,
dtp=dtp,
timestep_conditions=filters['timestep_conditions'])
# For MPI, pass the pool directly; for local multiprocessing, pass nproc so
# Evolve.evolve creates a fresh pool whose workers fork after Fortran globals
# (checkstate, dtp_state) have been initialized, avoiding a deadlock.
if isinstance(pool, MPIPool):
bpp, bcm, initCond, kick_info = Evolve.evolve(initialbinarytable=IBT,
pool=pool,
BSEDict=BSEDict,
SSEDict=SSEDict,
idx=idx,
dtp=dtp,
timestep_conditions=filters['timestep_conditions'])
else:
bpp, bcm, initCond, kick_info = Evolve.evolve(initialbinarytable=IBT,
nproc=nproc,
BSEDict=BSEDict,
SSEDict=SSEDict,
idx=idx,
dtp=dtp,
timestep_conditions=filters['timestep_conditions'])

# extract single stars

Expand Down
126 changes: 74 additions & 52 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# COSMIC Changelog
## Prepend only plese!
## Prepend only please!

## 4.1.0

- Additions/changes
- kick_info table now includes another column with the time of each supernova

- Code cleanup
- Function signature for kick() and evolv2() in the fortran changed to remove ``bkick`` entirely
- Also removed ``kick_info_out``. Both of these can be reconstructed from ``kick_info``

## 4.0.1

Expand All @@ -18,7 +26,7 @@
## 3.7.8

- Additions/changes:
- Added `smt_periastron_check` setting, which allows the user to toggle whether to check for periastron collision during stable mass transfer. By default, we set this off, which changes the behaviour of previous versions since 3.6.0 (PR #694) which did check for contact at periastron during stable mass transfer. We set this to off as the radial expansion from SSE is likely overestimated, once we connect with COSMIC-METISSE this should likely be set to 1.
- Added ``smt_periastron_check`` setting, which allows the user to toggle whether to check for periastron collision during stable mass transfer. By default, we set this off, which changes the behaviour of previous versions since 3.6.0 (PR #694) which did check for contact at periastron during stable mass transfer. We set this to off as the radial expansion from SSE is likely overestimated, once we connect with COSMIC-METISSE this should likely be set to 1.

## 3.7.7

Expand All @@ -29,7 +37,7 @@
## 3.7.6

- Additions/changes:
- Added `pool` and `nproc` parameters to the `independent` sampler. Users can either specify an existing multiprocessing pool or a number of processors to use to create a pool that will be used for the sampling. This offers significant speed-ups for samples larger than 10,000 binaries.
- Added ``pool`` and ``nproc`` parameters to the ``independent`` sampler. Users can either specify an existing multiprocessing pool or a number of processors to use to create a pool that will be used for the sampling. This offers significant speed-ups for samples larger than 10,000 binaries.

## 3.7.5

Expand All @@ -38,11 +46,8 @@
- Track mean_anomaly (save to kick_info) array even when a system is disrupted
- Throw an error if invalid metallicities are provided for evolution

## 3.7.2-3.7.3
Issues with PyPi, unreleased.

## 3.7.4
This release contains _several_ fixes to how CO core masses/remnant masses are handled. It also adds a new PISN prescription, windflag and LBV winds flag.
This release contains *several* fixes to how CO core masses/remnant masses are handled. It also adds a new PISN prescription, windflag and LBV winds flag.

- Fixes:
- Update ``mc_co`` and ``mc_he`` after adjusting ``mc = mcmax`` in ``hrdiag.f`` for stripped stars. This can be a fairly significant change, up to ~2 Msun. (Used to actually be up to 10 Msun because we added HeMS core mass growth)
Expand Down Expand Up @@ -74,79 +79,96 @@ This release contains _several_ fixes to how CO core masses/remnant masses are h
- Start new settings gallery in the documentation
- Tag settings/options with the version they were added in the docs page and auto link them to release

## 3.7.2-3.7.3
Issues with PyPi, unreleased.


## 3.7.1
- Bug fix [[#729](https://github.com/COSMIC-PopSynth/COSMIC/issues/729)]: ensure disruptions are logged with ``evol_type==11`` when SNe occur during CEs
- Bug fix [[#725](https://github.com/COSMIC-PopSynth/COSMIC/issues/725)]: set ``tb=sep=0`` for cases where AIC caused a WD to explode and leave behind no remnant (``evolve_type==9``)
- Bug fix [[#724](https://github.com/COSMIC-PopSynth/COSMIC/issues/724)]: remove bug where ``kstar=15`` was assigned its previous epoch mass after merging during a CE and the merger product goes SN

- Bug fix ([#729](https://github.com/COSMIC-PopSynth/COSMIC/issues/729)): ensure disruptions are logged with ``evol_type==11`` when SNe occur during CEs
- Bug fix ([#725](https://github.com/COSMIC-PopSynth/COSMIC/issues/725)): set ``tb=sep=0`` for cases where AIC caused a WD to explode and leave behind no remnant (``evolve_type==9``)
- Bug fix ([#724](https://github.com/COSMIC-PopSynth/COSMIC/issues/724)): remove bug where ``kstar=15`` was assigned its previous epoch mass after merging during a CE and the merger product goes SN

## 3.7.0
- Add `remnantflag=5`: The Mandel & Muller 2020 prescription for remnant masses
- Add `kickflag=6`: The Mandel & Muller 2020 prescription for natal kicks. This can be tuned with `mm_mu_ns` and `mm_mu_bh`
- Add `remnantflag=6`: The Maltsev+25 and Willcox+25 prescription for remnant masses. This can be tuned with `maltsev_mode` and `maltsev_fallback`
- (Docs) Any tutorial that uses a plain BSEDict now uses one that is drawn from the cosmic-settings.json file to avoid missing changes and saves us updating each docs page

- Add ``remnantflag=5``: The Mandel & Muller 2020 prescription for remnant masses
- Add ``kickflag=6``: The Mandel & Muller 2020 prescription for natal kicks. This can be tuned with ``mm_mu_ns`` and ``mm_mu_bh``
- Add ``remnantflag=6``: The Maltsev+25 and Willcox+25 prescription for remnant masses. This can be tuned with ``maltsev_mode`` and ``maltsev_fallback``
- (Docs) Any tutorial that uses a plain BSEDict now uses one that is drawn from the cosmic-settings.json file to avoid missing changes and saves us updating each docs page

## 3.6.2
- Add functions to `cosmic.utils` for initC IO that's more efficient (`save_initC`, `load_initC`) by saving
identical setting columns separately with only one copy - saves ~1kb per binary
- Make He and CO core masses available in output
- Change defaults; `qcflag=5` and `eccfac=10`
- Prevent users from supplying both `qmin` and `m2_min`
- Prevent users from supplying both `sep` and `porb` when sampling, calculate `porb` from `sep` as necessary
- Define `binstate=-1` as single stars

- Add functions to ``cosmic.utils`` for initC IO that's more efficient (``save_initC``, ``load_initC``) by saving identical setting columns separately with only one copy - saves ~1kb per binary
- Make He and CO core masses available in output
- Change defaults; ``qcflag=5`` and ``eccfac=10``
- Prevent users from supplying both ``qmin`` and ``m2_min``
- Prevent users from supplying both ``sep`` and ``porb`` when sampling, calculate ``porb`` from ``sep`` as necessary
- Define ``binstate=-1`` as single stars

## 3.6.1
- Add support for single stars in both independent and multidim sampling
- update documentation

- Add support for single stars in both independent and multidim sampling
- update documentation

## 3.6.0
- Overhaul documentation and added debugging environment
- Feature: Added Disberg+2025 kick prescription as a new choice of `kickflag` (`kickflag=5`). Applies log-normal distribution to regular CCSN, ECSN/USSN still use `sigmadiv` Maxwellian and BH fallback scaling is still applied via `bhflag` and `bhsigmafrac` as with `kickflag=1`

- Overhaul documentation and added debugging environment
- Feature: Added Disberg+2025 kick prescription as a new choice of ``kickflag`` (``kickflag=5``). Applies log-normal distribution to regular CCSN, ECSN/USSN still use ``sigmadiv`` Maxwellian and BH fallback scaling is still applied via ``bhflag`` and ``bhsigmafrac`` as with ``kickflag=1``

## 3.5.0
- Feature: Added `bpp_columns` and `bcm_columns` parameters to the `evolve()` function to allow users to specify the columns in the bpp and bcm tables
- Bug fix: Changed `kick.f` to use the Pfahl+02 kick prescription by default instead of Kiel & Hurley 2009, this fixes ejection velocities of secondaries and also changed kick_info to have an extra column

- Feature: Added ``bpp_columns`` and ``bcm_columns`` parameters to the ``evolve()`` function to allow users to specify the columns in the bpp and bcm tables
- Bug fix: Changed ``kick.f`` to use the Pfahl+02 kick prescription by default instead of Kiel & Hurley 2009, this fixes ejection velocities of secondaries and also changed kick_info to have an extra column

## 3.4.11
- Added sampling options to ``independent`` sampler to allow for custom power law distributions for ``porb`` and ``q``

- Added sampling options to ``independent`` sampler to allow for custom power law distributions for ``porb`` and ``q``

## 3.4.10
- Bug fixes: `timestep_conditions` for `bcm` arrays now raise errors for invalid columns instead of failing silently
- Add `teff_1` and `teff_2` as variables that can be used to set `timestep_conditions`
- Add in `-1` option to turn off Magnetic Braking in htmb
- Added `central_bh` and `scale_with_central_bh` as options to the CMC sampler, in order to add central massive black holes to CMC initial conditions

- Bug fixes: ``timestep_conditions`` for ``bcm`` arrays now raise errors for invalid columns instead of failing silently
- Add ``teff_1`` and ``teff_2`` as variables that can be used to set ``timestep_conditions``
- Add in ``-1`` option to turn off Magnetic Braking in htmb
- Added ``central_bh`` and ``scale_with_central_bh`` as options to the CMC sampler, in order to add central massive black holes to CMC initial conditions

## 3.4.9
- Added `sampling_target == "total_mass"` option to independent sampler so you can target a specific total mass instead of number of binaries
- Added `trim_extra_samples` parameter to the same function - which trims your samples to get as close as possible to the target total mass
- Bug fixes: secondaries of single stars are now marked as massless remnants instead of main sequence stars, binfrac=0.0 no longer leads to an infinite loop in sampling

- Added ``sampling_target == "total_mass"`` option to independent sampler so you can target a specific total mass instead of number of binaries
- Added ``trim_extra_samples`` parameter to the same function - which trims your samples to get as close as possible to the target total mass
- Bug fixes: secondaries of single stars are now marked as massless remnants instead of main sequence stars, binfrac=0.0 no longer leads to an infinite loop in sampling

## 3.4.8
- removed zsun_wind so that we can match stock BSE exactly and added extra documentation surrounding the winds
- added a NaN catch in cosmic-pop that throws a warning of NaNs, saves them to a file, and instructs the user to consider changing pts1 since this is the main driver of NaNs so far

- removed zsun_wind so that we can match stock BSE exactly and added extra documentation surrounding the winds
- added a NaN catch in cosmic-pop that throws a warning of NaNs, saves them to a file, and instructs the user to consider changing pts1 since this is the main driver of NaNs so far

## 3.4.7
- Exchanged any print statements for `warnings.warn` to allow silencing
- Fixed up docs to catch warnings

- Exchanged any print statements for ``warnings.warn`` to allow silencing
- Fixed up docs to catch warnings

## 3.4.6
- added new Eddington limit prescriptions for BH accretion
- cleaned up versioning

- added new Eddington limit prescriptions for BH accretion
- cleaned up versioning

## 3.4.1-3.4.5
- updated the actions to build properly

- updated the actions to build properly

## 3.4.1
- fixed sampling issues for renzo19 and sana12 so that they work with CMC
- update to Docker ubuntu image
- minor fixes to documentation to stop warnings/errors which break doc website deployment
- adds in build wheels for Python 3.9 and 3.10
- add warning for mlwind prescriptions which assume zsun = 0.019
- modifications to how m2min and qmin are specified in initial conditions sampling
- fixed sampling issues from Plummer profiles in cmc.py
- fixed Eddington limits such that wind accretion is limited to eddington and thus limits RLO accretion if the wind accretion is already super-Eddington
- fixed errors in Marchant+ PISN prescription

- fixed sampling issues for renzo19 and sana12 so that they work with CMC
- update to Docker ubuntu image
- minor fixes to documentation to stop warnings/errors which break doc website deployment
- adds in build wheels for Python 3.9 and 3.10
- add warning for mlwind prescriptions which assume zsun = 0.019
- modifications to how m2min and qmin are specified in initial conditions sampling
- fixed sampling issues from Plummer profiles in cmc.py
- fixed Eddington limits such that wind accretion is limited to eddington and thus limits RLO accretion if the wind accretion is already super-Eddington
- fixed errors in Marchant+ PISN prescription

## 0.0 - 3.4
See the discussed changes in our previous releases here: https://github.com/COSMIC-PopSynth/COSMIC/releases

See the discussed changes in our previous releases [here](https://github.com/COSMIC-PopSynth/COSMIC/releases)

1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ clean:
html: apidoc
python generate_default_bsedict.py
python create_settings_html.py
python create_whats_new.py
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
Expand Down
65 changes: 65 additions & 0 deletions docs/create_whats_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""
create_whats_new.py

This file constructs the "What's New" section of the documentation, which highlights new features and settings in the latest version of COSMIC. It ingests the changelog and converts it to an rst file for the docs.

Each heading that starts with ## is converted to a new section in the "What's New" page, and each bullet point is converted to a new feature.
The script also links any headings of the form "## x.x.x" to the corresponding release in GitHub

Written by Tom Wagg
"""

import re
from pathlib import Path

def parse_changelog(changelog_path):
with open(changelog_path, 'r') as f:
changelog = f.read()

# Split the changelog into sections based on "## " headings
sections = re.split(r'##\s+', changelog)[1:] # Skip the first split which is before the first heading

parsed_sections = []
for section in sections:
lines = section.strip().split('\n')
heading = lines[0].strip()
features = [line for line in lines[1:]]

# if the first character of the heading is not a number, skip
if not re.match(r'^\d', heading):
continue

# for each feature, replace markdown links of the form [text](link) with rst links of the form `text <link>`_
features = [re.sub(r'\[([^\]]+)\]\(([^)]+)\)', r'`\1 <\2>`_', feature) for feature in features]

parsed_sections.append((heading, features))

return parsed_sections

def generate_rst(parsed_sections, output_path):
with open(output_path, 'w') as f:
f.write("What's New in COSMIC\n")
f.write("====================\n\n")

for heading, features in parsed_sections:

f.write(f"v{heading}\n")
f.write(f"{'-' * (len(heading) + 1)}\n\n")

# Check if the heading is a version number (e.g., "4.1.0")
if re.match(r'^\d+\.\d+\.\d+$', heading):
github_link = f"https://github.com/COSMIC-PopSynth/COSMIC/releases/tag/v{heading}"
f.write(f"`GitHub release <{github_link}>`_\n\n")

for feature in features:
f.write(feature + "\n")
f.write("\n")

if __name__ == "__main__":
changelog_path = Path("../CHANGELOG.md")
output_path = Path("_generated/whats_new.rst")

parsed_sections = parse_changelog(changelog_path)
generate_rst(parsed_sections, output_path)

print(f"Generated {output_path} from {changelog_path}")
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COSMIC (Compact Object Synthesis and Monte Carlo Investigation Code) is a rapid
pages/multiprocessing
pages/cite
pages/developers
_generated/whats_new

*****************
API documentation
Expand Down
8 changes: 5 additions & 3 deletions docs/pages/output_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ velocity after both supernovae).
``kick_info[i,12]: delta_vsysy_2`` change in 3D velocity of the star=2 if system is disrupted (y-component)
``kick_info[i,13]: delta_vsysz_2`` change in 3D velocity of the star=2 if system is disrupted (z-component)
``kick_info[i,14]: vsys_2_total`` magnitude of velocity of star=2 if disrupted, accounting for both SNe [:math:`{\rm{km/s}}`]
``kick_info[i,15]: delta_theta_total`` angular change in orbital plane due to supernovae, relative to the pre-SN1 orbital plane [:math:`{\rm{degrees}}`]
``kick_info[i,16]: omega`` azimuthal angle of the orbital plane w.r.t. spins [:math:`{\rm{degrees}}`]
``kick_info[i,17]: randomseed`` random seed at the start of call to kick.f
``kick_info[i,15]: theta_euler`` First Euler angle of rotation of orbital plane after each SN
``kick_info[i,16]: phi_euler`` Second Euler angle of rotation of orbital plane after each SN
``kick_info[i,17]: psi_euler`` Third Euler angle of rotation of orbital plane after each SN
``kick_info[i,18]: randomseed`` random seed at the start of call to kick.f
``kick_info[i,19]: tphys`` time of the supernova in Myr

========================================== ========================================================================================================================================
2 changes: 1 addition & 1 deletion src/cosmic/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.0.1"
__version__ = "4.1.0"
Loading
Loading