nrcatalogtools.metadata¶
Cross-catalog metadata key mappings and source-parameter extraction.
Key mapping constants¶
RIT_KEYS
module-attribute
¶
Mapping from canonical quantity names to RIT metadata keys (hyphenated).
In the simulations_dataframe these keys appear as-is (with hyphens).
get_source_parameters_from_metadata() accesses them with underscores after
parse_metadata_txt() converts hyphens to underscores during DataFrame
construction.
SXS_KEYS
module-attribute
¶
Mapping from canonical quantity names to SXS metadata keys (snake_case).
Spin components are stored as 3-element lists under spin1_vector /
spin2_vector; the individual spin1x etc. entries are None to
signal that they must be accessed by index::
spin1 = metadata[SXS_KEYS["spin1_vector"]] # [chi_x, chi_y, chi_z]
chi1x = spin1[0]
MAYA_KEYS
module-attribute
¶
Mapping from canonical quantity names to MAYA/GT metadata keys.
Note that MAYA does not record a dedicated relaxation time, initial ADM quantities, or a separate reference epoch distinct from the simulation start.
CANONICAL_TO_CATALOG
module-attribute
¶
CANONICAL_TO_CATALOG = {canonical: {'RIT': get(canonical), 'SXS': get(canonical), 'MAYA': get(canonical)} for canonical in (sorted(set(RIT_KEYS) | set(SXS_KEYS) | set(MAYA_KEYS)))}
Dict mapping each canonical quantity name to its key in every catalog.
Example::
>>> from nrcatalogtools.metadata import CANONICAL_TO_CATALOG
>>> CANONICAL_TO_CATALOG["mass_ratio"]
{'RIT': 'relaxed-mass-ratio-1-over-2', 'SXS': 'reference_mass_ratio', 'MAYA': 'q'}
>>> CANONICAL_TO_CATALOG["spin1x"]
{'RIT': 'relaxed-chi1x', 'SXS': None, 'MAYA': 'a1x'}
A value of None means the quantity is not stored as a scalar key in that
catalog (see the per-catalog dict docstring for the access pattern).
CANONICAL_TO_PYCBC
module-attribute
¶
CANONICAL_TO_PYCBC = {'mass1': 'mass1', 'mass2': 'mass2', 'spin1x': 'spin1x', 'spin1y': 'spin1y', 'spin1z': 'spin1z', 'spin2x': 'spin2x', 'spin2y': 'spin2y', 'spin2z': 'spin2z', 'freq_start_22': 'f_lower', 'orbital_frequency': 'f_lower', 'orbital_frequency_vector': 'f_lower'}
Maps canonical quantity names to their PyCBC output parameter name.
Quantities absent from this dict are not directly exposed as PyCBC parameters (e.g. remnant properties, ADM quantities, numerical method flags).
PYCBC_KEYS
module-attribute
¶
PYCBC_KEYS = {'mass1': 'mass1', 'mass2': 'mass2', 'spin1x': 'spin1x', 'spin1y': 'spin1y', 'spin1z': 'spin1z', 'spin2x': 'spin2x', 'spin2y': 'spin2y', 'spin2z': 'spin2z', 'f_lower': 'f_lower'}
PyCBC-compatible parameter names output by get_source_parameters_from_metadata().
These are the keys accepted by pycbc.waveform.get_td_waveform_modes() and
related functions. All catalog-specific keys are normalised to these names by
get_source_parameters_from_metadata().
Functions¶
get_source_parameters_from_metadata
¶
Return the initial physical parameters for the simulation. Only for quasicircular simulations are supported, orbital eccentricity is ignored
Args:
metadata (dict): Simulation metadata dict. Must contain a
"catalog_type" key with value "RIT", "SXS", or
"MAYA". This key is injected automatically by
CatalogBase.get_metadata().
total_mass (float, optional): Total Mass of Binary (solar masses).
Defaults to 1.0.
Returns: dict: Initial binary parameters with names compatible with PyCBC.
Raises:
ValueError: If catalog_type is absent or not one of the known
values.
Source code in nrcatalogtools/metadata.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |