Vectorized rejection checking for binary star systems.

Provides fully vectorized numpy operations for ZAMS radius, Roche lobe radius, and physical rejection criteria used to discard unphysical binary systems prior to evolution.

cosmic.sample.stroopwafel.rejection.default_reject(binary_params, SSEDict=None, min_secondary_mass=0.08, n_radius_grid=5000)[source]

Default rejection function for DCO progenitor systems.

Rejects systems where the secondary mass is below the minimum, the stars are in contact at ZAMS, or either star overflows its Roche lobe at periastron. The orbital separation is computed from the orbital period via Kepler’s third law, and both stars share the binary metallicity.

Parameters:
binary_paramsdict

Assembled binary parameters with keys 'mass_1', 'mass_2' (solar masses), 'porb' (days), 'ecc', and 'metallicity', each an (N,) array.

SSEDictdict, optional

COSMIC single stellar evolution settings. The ZAMS radii are obtained from Sample.set_reff, which depends on the stellar engine (e.g. sse vs METISSE); passing the same SSEDict used for evolution ensures the rejection radii are computed consistently. By default None (COSMIC’s sse engine). AdaptiveSampler wires its own SSEDict into this argument automatically.

min_secondary_massfloat, optional

Minimum allowed secondary mass in solar masses, by default 0.08

n_radius_gridint or None, optional

Number of grid masses used to tabulate METISSE ZAMS radii, see zams_radii(). Pass None to compute every radius directly. By default 5000

Returns:
numpy.ndarray

(N,) boolean mask where True indicates a rejected system.

cosmic.sample.stroopwafel.rejection.zams_radii(mass, metallicity, SSEDict=None, n_grid=5000)[source]

ZAMS radii for a set of masses at a single metallicity

With METISSE, computing a ZAMS radius costs ~0.1 ms per star (interpolating a full track), which dominates rejection when it is applied to millions of samples. Since the radius depends only on the mass (for a given metallicity and set of tracks), METISSE radii are instead tabulated once on a log-spaced grid of n_grid masses spanning the hydrogen tracks and then linearly interpolated in log-log space (relative errors ~1e-4 for the default grid). Masses outside the grid’s range are computed directly. SSE radii are cheap and are always computed directly.

Parameters:
massnumpy.ndarray

(N,) array of masses in solar masses

metallicityfloat

Metallicity of all stars

SSEDictdict, optional

COSMIC single stellar evolution settings, by default None (COSMIC’s sse engine)

n_gridint or None, optional

Number of grid masses used for METISSE radii, by default 5000. Pass None to compute every radius directly with Sample.set_reff

Returns:
numpy.ndarray

(N,) array of ZAMS radii in solar radii