Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0414a83
Metisse integration meson (#628)
poojanagrawal Jun 4, 2024
766f2e5
added METISSE as submodule (#629)
poojanagrawal Jun 4, 2024
b3b9518
updated comprad for METISSE (#631)
poojanagrawal Jun 6, 2024
d54bd83
Kb metisse add ce facc split (#630)
katiebreivik Jun 6, 2024
2ea2def
Stop statements (#632)
poojanagrawal Jun 6, 2024
6ebf8d8
fix pickle protocol (#633)
katiebreivik Jun 7, 2024
18da43d
added path validity checks for METISSE as stellar engine (#634)
poojanagrawal Jun 7, 2024
f071e82
update utils call for when initC is passed directly and added SSEDict…
katiebreivik Jun 7, 2024
c5ec59f
warnings_fix (#636)
poojanagrawal Jun 13, 2024
da86873
submodule update (#637)
katiebreivik Jun 13, 2024
a20d7b8
fixed lum, r etc. of kw=15 stars for binary_type 9 (#638)
poojanagrawal Jun 14, 2024
da3b928
submodule update (#640)
katiebreivik Jun 14, 2024
e41c21f
added rejuventaion flag for very low mass stars (#646)
poojanagrawal Jun 24, 2024
908848b
update METISSE
katiebreivik Jul 17, 2024
6f7c774
update METISSE (#649)
katiebreivik Jul 17, 2024
aff9097
bring METISSE-integrate level with develop (+ METISSE-integrate commi…
katiebreivik Aug 8, 2024
2a5a387
glob_issues (#650)
poojanagrawal Aug 8, 2024
fdd418b
trying to make metisse-integrate incorporate develop updates (#658)
katiebreivik Aug 8, 2024
2159a11
Metisse integrate kb (#674)
katiebreivik Sep 11, 2024
c9a1ede
updated METISSE
Oct 8, 2024
eb18b18
updated METISSE (#680)
d-maclean Oct 9, 2024
6ee84a9
Merge branch 'COSMIC-PopSynth:METISSE-integrate' into METISSE-integrate
d-maclean Nov 1, 2024
2c2390b
added 'SSEDict' to cosmic-pop binary
d-maclean Nov 3, 2024
d02b64e
Fix cosmic-pop executable for METISSE-integrate (#681)
d-maclean Dec 12, 2024
2cf10c1
Fastforward to develop branch (#684)
katiebreivik Dec 12, 2024
57c6f8c
update using_sse and using_metisse to ints for C in CMC (#686)
katiebreivik Dec 13, 2024
21e1744
Merge branch 'COSMIC-PopSynth:METISSE-integrate' into METISSE-integrate
d-maclean Jan 5, 2025
545e074
Kb metisse (#689)
katiebreivik Jan 29, 2025
cb66a11
Merge pull request #1 from COSMIC-PopSynth/METISSE-integrate
d-maclean Jan 30, 2025
379e6ec
Cmc integrate (#691)
poojanagrawal Feb 23, 2025
52da991
Metisse variables (#693)
poojanagrawal Feb 24, 2025
f5f55ff
Merge branch 'COSMIC-PopSynth:METISSE-integrate' into METISSE-integrate
d-maclean Mar 4, 2025
b6321fe
updated METISSE
d-maclean Mar 4, 2025
62c102b
allowed indepdent sampler to return metallicity outside of SSE range …
d-maclean Mar 27, 2025
a9959ca
:Revert "allowed indepdent sampler to return metallicity outside of S…
d-maclean Mar 27, 2025
54e6a36
added logic for independent sampler to return binaries with Z outside…
d-maclean Mar 27, 2025
4f8684a
Update python-package.yml
katiebreivik Mar 31, 2025
4c49804
Update build_wheels_and_publish.yml
katiebreivik Mar 31, 2025
daa0ad7
added a warning when the user passes an invalid metallicity value for…
d-maclean Mar 27, 2025
a0b8b1e
fixed sampler crashing if SSEDict is not passed
d-maclean Mar 31, 2025
01bd53a
Allow Independent sampler to return low/high-metallicity binary table…
d-maclean Apr 1, 2025
f14fcb4
updated exmaple/Params.ini: changed dtype of 'acc_lim' and 'alpha1' t…
d-maclean Apr 12, 2025
9989e01
documented Params.ini changes
d-maclean Apr 12, 2025
c336f33
added SSEDict to cosmic-pop's independent sampler calls
d-maclean Apr 12, 2025
c616ffe
Metisse integrate branch - fix default inifile and independent sample…
d-maclean May 7, 2025
f4a8a42
Merge branch 'COSMIC-PopSynth:METISSE-integrate' into METISSE-integrate
d-maclean Jun 27, 2025
2b9cb60
Implement Disberg & Mandel 2025 model for natal kicks (#704)
TomWagg Jun 18, 2025
6d05ff4
bump version to 3.5.1
d-maclean Jun 28, 2025
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
84 changes: 41 additions & 43 deletions .github/workflows/build_wheels_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,89 @@ on:
release:
types: [published]
workflow_dispatch:


env:
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-*"
CIBW_BUILD: "cp39-* cp310-*"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_SKIP: "*-win32 *musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BEFORE_BUILD: pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ENVIRONMENT_MACOS: "FC=gfortran"

jobs:
build-wheels:
build-wheels-and-dist:
name: Build ${{ matrix.python-version }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, "3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.7"
python-version: "3.10"

- name: Setup Mac
- name: link gfortran and hdf5
if: runner.os == 'macOS'
run: |
python -m pip install numpy h5py versioneer
sudo ln -s /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
sudo mkdir /usr/local/gfortran
sudo ln -s /usr/local/Cellar/gcc@9/9.3.0_1/lib/gcc/9 /usr/local/gfortran/lib
sudo ln -s /opt/homebrew/bin/gfortran-12 /usr/local/bin/gfortran
brew reinstall hdf5

- name: Setup Linux
if: runner.os == 'Linux'
- name: Install numpy
run: |
python -m pip install --upgrade pip
python -m pip install numpy h5py versioneer

- name: Install dependencies
run: |
python -m pip install numpy h5py versioneer
python -m pip install setuptools wheel build meson-python ninja meson pytest cibuildwheel

- name: Build source and wheels distribution on MacOS
if: runner.os == 'macOS'
run: |
python -m build --outdir dist
find ./dist/*.whl | xargs pip install
pytest src/cosmic

- name: Build wheels
- name: Build source and wheels distribution on Linux
if: runner.os == 'Linux'
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
python -m build --sdist --outdir dist
python -m cibuildwheel --output-dir dist

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build-source-dist:
name: Build source dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.7"

- name: Build dist
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine numpy
python setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
path: ./dist/*.tar.gz

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

publish:
needs: [build-wheels, build-source-dist]
needs: [build-wheels-and-dist]
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Download builds
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: artifact
path: dist
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.9', '3.10']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# ignore files without extensions
*
!/**/
!*.*

.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -102,3 +109,9 @@ ENV/

# mypy
.mypy_cache/

*.o
binary.in
binary.dat
*.h5
fort.99
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/cosmic/src/METISSE"]
path = src/cosmic/src/METISSE
url = https://github.com/TeamMETISSE/METISSE.git
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/debug/test",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/debug",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "make",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
]
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make test",
"options": {
"cwd": "${workspaceFolder}/cosmic/src"
},
}
]
}
33 changes: 23 additions & 10 deletions bin/cosmic-pop
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def str2bool(v):
###############################################################################
# DEFINE COMMANDLINE ARGUMENTS
###############################################################################

def binfrac_type(value):
try:
return float(value)
except ValueError:
return value

def parse_commandline():
"""Parse the arguments given on the command-line.
"""
Expand All @@ -68,7 +75,7 @@ def parse_commandline():

defaults = {}
if not (args.inifile is None and (('-h' in remaining_argv) or ('--help' in remaining_argv))):
BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
BSEDict, SSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
defaults.update(sampling)
defaults.update(filters)
defaults.update(convergence)
Expand Down Expand Up @@ -98,10 +105,12 @@ def parse_commandline():
help="Number of binaries to try before checking for "
"convergence, it will check ever Nstep binaries until "
"it reach Niter binaries", type=int, default=10000)
parser.add_argument("--max-wall-time", type=int, default=3155760,
help="Maximum wall time (seconds) for sampling binaries")
parser.add_argument("--binary_state", nargs='+', type=int)
parser.add_argument("--sampling_method")
parser.add_argument("--primary_model", help="Chooses the initial primary mass function from: salpeter55, kroupa93, kroupa01", type=str)
parser.add_argument("--binfrac_model", help="Chooses the binary fraction model from: a float between [0,1] and vanHaaften", type=float)
parser.add_argument("--binfrac_model", help="Chooses the binary fraction model from: a float between [0,1], vanHaaften, and offner22", type=binfrac_type)
parser.add_argument("--ecc_model", help="Chooses the initial eccentricity distribution model from: thermal, uniform, and sana12", type=str)
parser.add_argument("--porb_model", help="Chooses the initial orbital period distribution model from: log_uniform and sana12", type=str)
parser.add_argument("--SF_start", help="Sets the time in the past when star formation initiates in Myr", type=float)
Expand Down Expand Up @@ -163,8 +172,9 @@ if __name__ == '__main__':
pool = schwimmbad.choose_pool(mpi=args.mpi, processes=args.nproc)
if isinstance(pool, MPIPool):
if not pool.is_master():
from sys import exit
pool.wait()
sys.exit(0)
exit(0)
nproc = len(pool.workers)
else:
nproc = args.nproc
Expand All @@ -175,7 +185,7 @@ if __name__ == '__main__':

# READ AND PARSE INIFILE
###########################################################################
BSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)
BSEDict, SSEDict, seed_int, filters, convergence, sampling = utils.parse_inifile(args.inifile)

# we now overwrite the inifile values with what was specified from the command line
# (which could mean not overwriting anything at all because they are populated
Expand Down Expand Up @@ -211,8 +221,8 @@ if __name__ == '__main__':
"with {0}={2} from the commandline".format(argument, seed_int, getattr(args, argument)))
seed_int = getattr(args, argument)

# Check that the values in BSEDict, filters, and convergence are valid
utils.error_check(BSEDict, filters, convergence, sampling)
# Check that the values in BSEDict, SSEDict, filters, and convergence are valid
utils.error_check(BSEDict, SSEDict, filters, convergence, sampling)

if seed_int != 0:
np.random.seed(seed_int)
Expand Down Expand Up @@ -261,7 +271,7 @@ if __name__ == '__main__':
log_file = open('log_kstar1_{0}_kstar2_{1}_SFstart_{2}_SFduration_{3}_metallicity_{4}.txt'.format(kstar1_range_string, kstar2_range_string, sampling['SF_start'], sampling['SF_duration'], sampling['metallicity']), 'w')

# save configuration settings to output file
configuration_settings = {'BSEDict' : BSEDict, 'filters' : filters,
configuration_settings = {'BSEDict' : BSEDict, 'SSEDict': SSEDict, 'filters' : filters,
'convergence' : convergence, 'sampling' : sampling}

for k, v in configuration_settings.items():
Expand All @@ -288,7 +298,7 @@ if __name__ == '__main__':
log_file.write("You have specified both qmin and m2_min.\n")
log_file.write("COSMIC will use qmin={} to determine the secondary masses in the initial sample.\n".format(args.qmin))

while (Nstep < args.Niter) & (np.max(match) > convergence['match']):
while (Nstep < args.Niter) & (np.max(match) > convergence['match']) & ((time.time() - start_time) < args.max_wall_time):
# Set random seed such that each iteration gets a unique, determinable seed
rand_seed = seed_int + Nstep
np.random.seed(rand_seed)
Expand All @@ -309,7 +319,8 @@ if __name__ == '__main__':
met = sampling['metallicity'],
size = args.Nstep,
qmin = args.qmin,
params = args.inifile)
params = args.inifile,
SSEDict = SSEDict)
elif hasattr(args,'m2_min'):
init_samp_list = InitialBinaryTable.sampler(format_ = sampling['sampling_method'],
final_kstar1 = kstar1_range,
Expand All @@ -324,7 +335,8 @@ if __name__ == '__main__':
met = sampling['metallicity'],
size = args.Nstep,
m2_min = args.m2_min,
params = args.inifile)
params = args.inifile,
SSEDict = SSEDict)
else:
raise ValueError("You must specify either qmin or m2_min in the",
" inifile if you are using the independent sampler")
Expand Down Expand Up @@ -374,6 +386,7 @@ if __name__ == '__main__':
bpp, bcm, initCond, kick_info = Evolve.evolve(initialbinarytable=IBT,
pool=pool,
BSEDict=BSEDict,
SSEDict=SSEDict,
idx=idx,
dtp=dtp,
timestep_conditions=filters['timestep_conditions'])
Expand Down
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ See the discussed changes in our previous releases here: https://github.com/COSM
- 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.11
- Added sampling options to ``independent`` sampler to allow for custom power law distributions for ``porb`` and ``q``

## 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
## 3.5.1
- 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`
2 changes: 1 addition & 1 deletion ci/compile_benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gfortran -coverage -fprofile-arcs -ftest-coverage -O0 src/cosmic/src/assign_remnant.f src/cosmic/src/benchmarkevolv2.f src/cosmic/src/comenv.f src/cosmic/src/corerd.f src/cosmic/src/deltat.f src/cosmic/src/dgcore.f src/cosmic/src/evolv2.f src/cosmic/src/gntage.f src/cosmic/src/hrdiag.f src/cosmic/src/hrdiag_remnant.f src/cosmic/src/instar.f src/cosmic/src/kick.f src/cosmic/src/mix.f src/cosmic/src/mlwind.f src/cosmic/src/mrenv.f src/cosmic/src/ran3.f src/cosmic/src/rl.f src/cosmic/src/star.f src/cosmic/src/zcnsts.f src/cosmic/src/zfuncs.f src/cosmic/src/concatkstars.f src/cosmic/src/bpp_array.f src/cosmic/src/checkstate.f -o benchmarkevolv2.exe -I src/cosmic/src -Wl,-rpath,${CONDA_PREFIX}/lib
gfortran -coverage -fprofile-arcs -ftest-coverage -O0 src/cosmic/src/hrdiag_remnant.f src/cosmic/src/assign_remnant.f src/cosmic/src/benchmarkevolv2.f src/cosmic/src/corerd.f src/cosmic/src/comenv.f src/cosmic/src/dgcore.f src/cosmic/src/evolv2.f src/cosmic/src/gntage.f src/cosmic/src/instar.f src/cosmic/src/kick.f src/cosmic/src/mix.f src/cosmic/src/mrenv.f src/cosmic/src/ran3.f src/cosmic/src/rl.f src/cosmic/src/concatkstars.f src/cosmic/src/comprad.f src/cosmic/src/bpp_array.f src/cosmic/src/checkstate.f src/cosmic/src/deltat.f src/cosmic/src/mlwind.f src/cosmic/src/hrdiag.f src/cosmic/src/star.f src/cosmic/src/zcnsts.f src/cosmic/src/SSE/SSE_deltat.f src/cosmic/src/SSE/SSE_mlwind.f src/cosmic/src/SSE/SSE_hrdiag.f src/cosmic/src/SSE/SSE_star.f src/cosmic/src/SSE/SSE_zcnsts.f src/cosmic/src/SSE/SSE_zfuncs.f src/cosmic/src/SSE/SSE_gntage.f src/cosmic/src/METISSE/src/track_support.f90 src/cosmic/src/METISSE/src/z_support.f90 src/cosmic/src/METISSE/src/sse_support.f90 src/cosmic/src/METISSE/src/remnant_support.f90 src/cosmic/src/METISSE/src/interp_support.f90 src/cosmic/src/METISSE/src/METISSE_gntage.f90 src/cosmic/src/METISSE/src/METISSE_deltat.f90 src/cosmic/src/METISSE/src/METISSE_mlwind.f90 src/cosmic/src/METISSE/src/METISSE_hrdiag.f90 src/cosmic/src/METISSE/src/METISSE_star.f90 src/cosmic/src/METISSE/src/METISSE_zcnsts.f90 src/cosmic/src/METISSE/src/comenv_lambda.f90 src/cosmic/src/METISSE/src/METISSE_miscellaneous.f90 src/cosmic/src/METISSE_utils.f90 -o benchmarkevolv2.exe -I src/cosmic/src -Wl,-rpath,${CONDA_PREFIX}/lib
./benchmarkevolv2.exe
Loading
Loading